ncr5380: Remove NCR5380_local_declare and NCR5380_setup macros
The NCR5380_local_declare and NCR5380_setup macros exist to define and
initialize a particular local variable, to provide the address of the
chip registers needed for the driver's implementation of its
NCR5380_read/write register access macros.
In cumana_1 and macscsi, these macros generate pointless code like this,
struct Scsi_Host *_instance;
_instance = instance;
In pas16, the use of NCR5380_read/write in pas16_hw_detect() requires that
the io_port local variable has been defined and initialized, but the
NCR5380_local_declare and NCR5380_setup macros can't be used for that
purpose because the Scsi_Host struct has not yet been instantiated.
Moreover, these macros were removed from atari_NCR5380.c long ago and
now they constitute yet another discrepancy between the two core driver
forks.
Remove these "optimizations".
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 4cca973..21f8236 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -459,9 +459,6 @@
static int generic_NCR5380_release_resources(struct Scsi_Host *instance)
{
- NCR5380_local_declare();
- NCR5380_setup(instance);
-
if (instance->irq != NO_IRQ)
free_irq(instance->irq, instance);
NCR5380_exit(instance);
@@ -520,13 +517,13 @@
static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
{
+#ifdef SCSI_G_NCR5380_MEM
+ struct NCR5380_hostdata *hostdata = shost_priv(instance);
+#endif
int blocks = len / 128;
int start = 0;
int bl;
- NCR5380_local_declare();
- NCR5380_setup(instance);
-
NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE | CSR_TRANS_DIR);
NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
while (1) {
@@ -547,7 +544,8 @@
}
#else
/* implies SCSI_G_NCR5380_MEM */
- memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
+ memcpy_fromio(dst + start,
+ hostdata->iomem + NCR53C400_host_buffer, 128);
#endif
start += 128;
blocks--;
@@ -567,7 +565,8 @@
}
#else
/* implies SCSI_G_NCR5380_MEM */
- memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
+ memcpy_fromio(dst + start,
+ hostdata->iomem + NCR53C400_host_buffer, 128);
#endif
start += 128;
blocks--;
@@ -604,14 +603,14 @@
static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
{
+#ifdef SCSI_G_NCR5380_MEM
+ struct NCR5380_hostdata *hostdata = shost_priv(instance);
+#endif
int blocks = len / 128;
int start = 0;
int bl;
int i;
- NCR5380_local_declare();
- NCR5380_setup(instance);
-
NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
while (1) {
@@ -632,7 +631,8 @@
}
#else
/* implies SCSI_G_NCR5380_MEM */
- memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
+ memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
+ src + start, 128);
#endif
start += 128;
blocks--;
@@ -648,7 +648,8 @@
}
#else
/* implies SCSI_G_NCR5380_MEM */
- memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
+ memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
+ src + start, 128);
#endif
start += 128;
blocks--;