[PATCH v2 06/22] ncr5380: Remove PSEUDO_DMA macro
For those wrapper drivers which only implement Programmed IO, have NCR5380_dma_xfer_len() evaluate to zero. That allows PDMA to be easily disabled at run-time and so the PSEUDO_DMA macro is no longer needed. Also remove the spin counters used for debugging pseudo DMA drivers. Signed-off-by: Finn ThainReviewed-by: Hannes Reinecke --- drivers/scsi/NCR5380.c | 32 +--- drivers/scsi/NCR5380.h |4 drivers/scsi/arm/cumana_1.c |2 -- drivers/scsi/arm/oak.c |3 +-- drivers/scsi/dmx3191d.c |4 drivers/scsi/dtc.c |7 --- drivers/scsi/dtc.h |2 -- drivers/scsi/g_NCR5380.c|1 - drivers/scsi/g_NCR5380.h|1 - drivers/scsi/mac_scsi.c | 10 -- drivers/scsi/pas16.c| 10 -- drivers/scsi/pas16.h|2 -- drivers/scsi/t128.c |4 drivers/scsi/t128.h |2 -- 14 files changed, 6 insertions(+), 78 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-16 14:18:09.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-16 14:18:11.0 +1100 @@ -469,34 +469,9 @@ static void prepare_info(struct Scsi_Hos #ifdef PARITY "PARITY " #endif -#ifdef PSEUDO_DMA -"PSEUDO_DMA " -#endif ""); } -#ifdef PSEUDO_DMA -static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, - char *buffer, int length) -{ - struct NCR5380_hostdata *hostdata = shost_priv(instance); - - hostdata->spin_max_r = 0; - hostdata->spin_max_w = 0; - return 0; -} - -static int __maybe_unused NCR5380_show_info(struct seq_file *m, -struct Scsi_Host *instance) -{ - struct NCR5380_hostdata *hostdata = shost_priv(instance); - - seq_printf(m, "Highwater I/O busy spin counts: write %d, read %d\n", - hostdata->spin_max_w, hostdata->spin_max_r); - return 0; -} -#endif - /** * NCR5380_init - initialise an NCR5380 * @instance: adapter to configure @@ -1436,7 +1411,6 @@ timeout: return -1; } -#if defined(PSEUDO_DMA) /* * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance, * unsigned char *phase, int *count, unsigned char **data) @@ -1592,7 +1566,6 @@ static int NCR5380_transfer_dma(struct S *phase = NCR5380_read(STATUS_REG) & PHASE_MASK; return foo; } -#endif /* PSEUDO_DMA */ /* * Function : NCR5380_information_transfer (struct Scsi_Host *instance) @@ -1683,7 +1656,6 @@ static void NCR5380_information_transfer * in an unconditional loop. */ -#if defined(PSEUDO_DMA) transfersize = 0; if (!cmd->device->borken) transfersize = NCR5380_dma_xfer_len(instance, cmd, phase); @@ -1706,9 +1678,7 @@ static void NCR5380_information_transfer /* XXX - need to source or sink data here, as appropriate */ } else cmd->SCp.this_residual -= transfersize - len; - } else -#endif /* PSEUDO_DMA */ - { + } else { /* Break up transfer into 3 ms chunks, * presuming 6 accesses per handshake. */ Index: linux/drivers/scsi/NCR5380.h === --- linux.orig/drivers/scsi/NCR5380.h 2016-03-16 14:18:09.0 +1100 +++ linux/drivers/scsi/NCR5380.h2016-03-16 14:18:11.0 +1100 @@ -257,10 +257,6 @@ struct NCR5380_hostdata { #ifdef SUPPORT_TAGS struct tag_alloc TagAlloc[8][8];/* 8 targets and 8 LUNs */ #endif -#ifdef PSEUDO_DMA - unsigned spin_max_r; - unsigned spin_max_w; -#endif struct workqueue_struct *work_q; unsigned long accesses_per_ms; /* chip register accesses per ms */ }; Index: linux/drivers/scsi/arm/cumana_1.c === --- linux.orig/drivers/scsi/arm/cumana_1.c 2016-03-16 14:18:09.0 +1100 +++ linux/drivers/scsi/arm/cumana_1.c 2016-03-16 14:18:11.0 +1100 @@ -13,8 +13,6 @@ #include -#define PSEUDO_DMA - #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) #define NCR5380_read(reg) cumanascsi_read(instance, reg) #define NCR5380_write(reg, value) cumanascsi_write(instance, reg, value) Index: linux/drivers/scsi/arm/oak.c
[PATCH v2 06/22] ncr5380: Remove PSEUDO_DMA macro
For those wrapper drivers which only implement Programmed IO, have NCR5380_dma_xfer_len() evaluate to zero. That allows PDMA to be easily disabled at run-time and so the PSEUDO_DMA macro is no longer needed. Also remove the spin counters used for debugging pseudo DMA drivers. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke --- drivers/scsi/NCR5380.c | 32 +--- drivers/scsi/NCR5380.h |4 drivers/scsi/arm/cumana_1.c |2 -- drivers/scsi/arm/oak.c |3 +-- drivers/scsi/dmx3191d.c |4 drivers/scsi/dtc.c |7 --- drivers/scsi/dtc.h |2 -- drivers/scsi/g_NCR5380.c|1 - drivers/scsi/g_NCR5380.h|1 - drivers/scsi/mac_scsi.c | 10 -- drivers/scsi/pas16.c| 10 -- drivers/scsi/pas16.h|2 -- drivers/scsi/t128.c |4 drivers/scsi/t128.h |2 -- 14 files changed, 6 insertions(+), 78 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers/scsi/NCR5380.c 2016-03-16 14:18:09.0 +1100 +++ linux/drivers/scsi/NCR5380.c2016-03-16 14:18:11.0 +1100 @@ -469,34 +469,9 @@ static void prepare_info(struct Scsi_Hos #ifdef PARITY "PARITY " #endif -#ifdef PSEUDO_DMA -"PSEUDO_DMA " -#endif ""); } -#ifdef PSEUDO_DMA -static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, - char *buffer, int length) -{ - struct NCR5380_hostdata *hostdata = shost_priv(instance); - - hostdata->spin_max_r = 0; - hostdata->spin_max_w = 0; - return 0; -} - -static int __maybe_unused NCR5380_show_info(struct seq_file *m, -struct Scsi_Host *instance) -{ - struct NCR5380_hostdata *hostdata = shost_priv(instance); - - seq_printf(m, "Highwater I/O busy spin counts: write %d, read %d\n", - hostdata->spin_max_w, hostdata->spin_max_r); - return 0; -} -#endif - /** * NCR5380_init - initialise an NCR5380 * @instance: adapter to configure @@ -1436,7 +1411,6 @@ timeout: return -1; } -#if defined(PSEUDO_DMA) /* * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance, * unsigned char *phase, int *count, unsigned char **data) @@ -1592,7 +1566,6 @@ static int NCR5380_transfer_dma(struct S *phase = NCR5380_read(STATUS_REG) & PHASE_MASK; return foo; } -#endif /* PSEUDO_DMA */ /* * Function : NCR5380_information_transfer (struct Scsi_Host *instance) @@ -1683,7 +1656,6 @@ static void NCR5380_information_transfer * in an unconditional loop. */ -#if defined(PSEUDO_DMA) transfersize = 0; if (!cmd->device->borken) transfersize = NCR5380_dma_xfer_len(instance, cmd, phase); @@ -1706,9 +1678,7 @@ static void NCR5380_information_transfer /* XXX - need to source or sink data here, as appropriate */ } else cmd->SCp.this_residual -= transfersize - len; - } else -#endif /* PSEUDO_DMA */ - { + } else { /* Break up transfer into 3 ms chunks, * presuming 6 accesses per handshake. */ Index: linux/drivers/scsi/NCR5380.h === --- linux.orig/drivers/scsi/NCR5380.h 2016-03-16 14:18:09.0 +1100 +++ linux/drivers/scsi/NCR5380.h2016-03-16 14:18:11.0 +1100 @@ -257,10 +257,6 @@ struct NCR5380_hostdata { #ifdef SUPPORT_TAGS struct tag_alloc TagAlloc[8][8];/* 8 targets and 8 LUNs */ #endif -#ifdef PSEUDO_DMA - unsigned spin_max_r; - unsigned spin_max_w; -#endif struct workqueue_struct *work_q; unsigned long accesses_per_ms; /* chip register accesses per ms */ }; Index: linux/drivers/scsi/arm/cumana_1.c === --- linux.orig/drivers/scsi/arm/cumana_1.c 2016-03-16 14:18:09.0 +1100 +++ linux/drivers/scsi/arm/cumana_1.c 2016-03-16 14:18:11.0 +1100 @@ -13,8 +13,6 @@ #include -#define PSEUDO_DMA - #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) #define NCR5380_read(reg) cumanascsi_read(instance, reg) #define NCR5380_write(reg, value) cumanascsi_write(instance, reg, value) Index: linux/drivers/scsi/arm/oak.c === ---