diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2016-01-03 16:05:06 +1100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-01-06 21:42:52 -0500 |
commit | 54d8fe4425c9d3fdf8473c1833c6807b61c6e70e (patch) | |
tree | 7f6597bc2f7277fa2f04496f814372413177d23d /drivers/scsi/g_NCR5380.c | |
parent | c0965e6371fa50fdf5cc2291915de97412fb1ec9 (diff) | |
download | talos-obmc-linux-54d8fe4425c9d3fdf8473c1833c6807b61c6e70e.tar.gz talos-obmc-linux-54d8fe4425c9d3fdf8473c1833c6807b61c6e70e.zip |
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>
Diffstat (limited to 'drivers/scsi/g_NCR5380.c')
-rw-r--r-- | drivers/scsi/g_NCR5380.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 4cca9734175e..21f8236df48f 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c @@ -459,9 +459,6 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt) 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 @@ generic_NCR5380_biosparam(struct scsi_device *sdev, struct block_device *bdev, 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 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, } #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 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, } #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_pread(struct Scsi_Host *instance, unsigned char *dst, 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 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, } #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 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, } #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--; |