diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2014-11-12 00:11:59 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-20 03:11:09 -0500 |
commit | a9c2dc43c14cc9e9333d451bc4db8a827a695332 (patch) | |
tree | 70e239cb8ebf6f09fa6d4c37cb3cc2884a37d144 | |
parent | 8c32513bd395dc5d382e4883097482567cf8bbc5 (diff) |
ncr5380: Move static PDMA spin counters to host data
Static variables from dtc.c and pas16.c should not appear in the core
NCR5380.c driver. Aside from being a layering issue this worsens the
divergence between the three core driver variants (atari_NCR5380.c and
sun3_NCR5380.c don't support PSEUDO_DMA) and it can mean multiple hosts
share the same counters.
Fix this by making the pseudo DMA spin counters in the core more generic.
This also avoids the abuse of the {DTC,PAS16}_PUBLIC_RELEASE macros, so
they can be removed.
oak.c doesn't use PDMA and hence it doesn't use the counters and hence it
needs no write_info() method. Remove it.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/scsi/NCR5380.c | 22 | ||||
-rw-r--r-- | drivers/scsi/NCR5380.h | 4 | ||||
-rw-r--r-- | drivers/scsi/arm/oak.c | 2 | ||||
-rw-r--r-- | drivers/scsi/dtc.c | 13 | ||||
-rw-r--r-- | drivers/scsi/pas16.c | 12 |
5 files changed, 26 insertions, 27 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index f1792bb80e70..77e8908f644e 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -692,6 +692,7 @@ static void NCR5380_print_status(struct Scsi_Host *instance) | |||
692 | NCR5380_dprint_phase(NDEBUG_ANY, instance); | 692 | NCR5380_dprint_phase(NDEBUG_ANY, instance); |
693 | } | 693 | } |
694 | 694 | ||
695 | #ifdef PSEUDO_DMA | ||
695 | /******************************************/ | 696 | /******************************************/ |
696 | /* | 697 | /* |
697 | * /proc/scsi/[dtc pas16 t128 generic]/[0-ASC_NUM_BOARD_SUPPORTED] | 698 | * /proc/scsi/[dtc pas16 t128 generic]/[0-ASC_NUM_BOARD_SUPPORTED] |
@@ -709,14 +710,13 @@ static void NCR5380_print_status(struct Scsi_Host *instance) | |||
709 | static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, | 710 | static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, |
710 | char *buffer, int length) | 711 | char *buffer, int length) |
711 | { | 712 | { |
712 | #ifdef DTC_PUBLIC_RELEASE | 713 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
713 | dtc_wmaxi = dtc_maxi = 0; | 714 | |
714 | #endif | 715 | hostdata->spin_max_r = 0; |
715 | #ifdef PAS16_PUBLIC_RELEASE | 716 | hostdata->spin_max_w = 0; |
716 | pas_wmaxi = pas_maxi = 0; | 717 | return 0; |
717 | #endif | ||
718 | return (-ENOSYS); /* Currently this is a no-op */ | ||
719 | } | 718 | } |
719 | #endif | ||
720 | 720 | ||
721 | #undef SPRINTF | 721 | #undef SPRINTF |
722 | #define SPRINTF(args...) seq_printf(m, ## args) | 722 | #define SPRINTF(args...) seq_printf(m, ## args) |
@@ -751,11 +751,9 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m, | |||
751 | SPRINTF("PAS16 release=%d", PAS16_PUBLIC_RELEASE); | 751 | SPRINTF("PAS16 release=%d", PAS16_PUBLIC_RELEASE); |
752 | #endif | 752 | #endif |
753 | 753 | ||
754 | #ifdef DTC_PUBLIC_RELEASE | 754 | #ifdef PSEUDO_DMA |
755 | SPRINTF("Highwater I/O busy_spin_counts -- write: %d read: %d\n", dtc_wmaxi, dtc_maxi); | 755 | SPRINTF("Highwater I/O busy spin counts: write %d, read %d\n", |
756 | #endif | 756 | hostdata->spin_max_w, hostdata->spin_max_r); |
757 | #ifdef PAS16_PUBLIC_RELEASE | ||
758 | SPRINTF("Highwater I/O busy_spin_counts -- write: %d read: %d\n", pas_wmaxi, pas_maxi); | ||
759 | #endif | 757 | #endif |
760 | spin_lock_irq(instance->host_lock); | 758 | spin_lock_irq(instance->host_lock); |
761 | if (!hostdata->connected) | 759 | if (!hostdata->connected) |
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h index dc37da49656b..6bd90eef4460 100644 --- a/drivers/scsi/NCR5380.h +++ b/drivers/scsi/NCR5380.h | |||
@@ -274,6 +274,10 @@ struct NCR5380_hostdata { | |||
274 | struct delayed_work coroutine; /* our co-routine */ | 274 | struct delayed_work coroutine; /* our co-routine */ |
275 | struct scsi_eh_save ses; | 275 | struct scsi_eh_save ses; |
276 | char info[256]; | 276 | char info[256]; |
277 | #ifdef PSEUDO_DMA | ||
278 | unsigned spin_max_r; | ||
279 | unsigned spin_max_w; | ||
280 | #endif | ||
277 | }; | 281 | }; |
278 | 282 | ||
279 | #ifdef __KERNEL__ | 283 | #ifdef __KERNEL__ |
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c index a5ef3f79a2fd..840a53dc556e 100644 --- a/drivers/scsi/arm/oak.c +++ b/drivers/scsi/arm/oak.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #define NCR5380_queue_command oakscsi_queue_command | 31 | #define NCR5380_queue_command oakscsi_queue_command |
32 | #define NCR5380_info oakscsi_info | 32 | #define NCR5380_info oakscsi_info |
33 | #define NCR5380_show_info oakscsi_show_info | 33 | #define NCR5380_show_info oakscsi_show_info |
34 | #define NCR5380_write_info oakscsi_write_info | ||
35 | 34 | ||
36 | #define NCR5380_implementation_fields \ | 35 | #define NCR5380_implementation_fields \ |
37 | void __iomem *base | 36 | void __iomem *base |
@@ -108,7 +107,6 @@ printk("reading %p len %d\n", addr, len); | |||
108 | static struct scsi_host_template oakscsi_template = { | 107 | static struct scsi_host_template oakscsi_template = { |
109 | .module = THIS_MODULE, | 108 | .module = THIS_MODULE, |
110 | .show_info = oakscsi_show_info, | 109 | .show_info = oakscsi_show_info, |
111 | .write_info = oakscsi_write_info, | ||
112 | .name = "Oak 16-bit SCSI", | 110 | .name = "Oak 16-bit SCSI", |
113 | .info = oakscsi_info, | 111 | .info = oakscsi_info, |
114 | .queuecommand = oakscsi_queue_command, | 112 | .queuecommand = oakscsi_queue_command, |
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 2dacf2833b64..62b8de67f65f 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c | |||
@@ -332,13 +332,11 @@ static int dtc_biosparam(struct scsi_device *sdev, struct block_device *dev, | |||
332 | * timeout. | 332 | * timeout. |
333 | */ | 333 | */ |
334 | 334 | ||
335 | static int dtc_maxi = 0; | ||
336 | static int dtc_wmaxi = 0; | ||
337 | |||
338 | static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len) | 335 | static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len) |
339 | { | 336 | { |
340 | unsigned char *d = dst; | 337 | unsigned char *d = dst; |
341 | int i; /* For counting time spent in the poll-loop */ | 338 | int i; /* For counting time spent in the poll-loop */ |
339 | struct NCR5380_hostdata *hostdata = shost_priv(instance); | ||
342 | NCR5380_local_declare(); | 340 | NCR5380_local_declare(); |
343 | NCR5380_setup(instance); | 341 | NCR5380_setup(instance); |
344 | 342 | ||
@@ -369,8 +367,8 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, | |||
369 | NCR5380_write(MODE_REG, 0); /* Clear the operating mode */ | 367 | NCR5380_write(MODE_REG, 0); /* Clear the operating mode */ |
370 | rtrc(0); | 368 | rtrc(0); |
371 | NCR5380_read(RESET_PARITY_INTERRUPT_REG); | 369 | NCR5380_read(RESET_PARITY_INTERRUPT_REG); |
372 | if (i > dtc_maxi) | 370 | if (i > hostdata->spin_max_r) |
373 | dtc_maxi = i; | 371 | hostdata->spin_max_r = i; |
374 | return (0); | 372 | return (0); |
375 | } | 373 | } |
376 | 374 | ||
@@ -390,6 +388,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, | |||
390 | static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len) | 388 | static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len) |
391 | { | 389 | { |
392 | int i; | 390 | int i; |
391 | struct NCR5380_hostdata *hostdata = shost_priv(instance); | ||
393 | NCR5380_local_declare(); | 392 | NCR5380_local_declare(); |
394 | NCR5380_setup(instance); | 393 | NCR5380_setup(instance); |
395 | 394 | ||
@@ -422,8 +421,8 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
422 | /* Check for parity error here. fixme. */ | 421 | /* Check for parity error here. fixme. */ |
423 | NCR5380_write(MODE_REG, 0); /* Clear the operating mode */ | 422 | NCR5380_write(MODE_REG, 0); /* Clear the operating mode */ |
424 | rtrc(0); | 423 | rtrc(0); |
425 | if (i > dtc_wmaxi) | 424 | if (i > hostdata->spin_max_w) |
426 | dtc_wmaxi = i; | 425 | hostdata->spin_max_w = i; |
427 | return (0); | 426 | return (0); |
428 | } | 427 | } |
429 | 428 | ||
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c index 51766895e90e..7994b5275431 100644 --- a/drivers/scsi/pas16.c +++ b/drivers/scsi/pas16.c | |||
@@ -88,8 +88,6 @@ | |||
88 | #include "NCR5380.h" | 88 | #include "NCR5380.h" |
89 | 89 | ||
90 | 90 | ||
91 | static int pas_maxi = 0; | ||
92 | static int pas_wmaxi = 0; | ||
93 | static unsigned short pas16_addr = 0; | 91 | static unsigned short pas16_addr = 0; |
94 | static int pas16_irq = 0; | 92 | static int pas16_irq = 0; |
95 | 93 | ||
@@ -502,6 +500,7 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, | |||
502 | P_DATA_REG_OFFSET); | 500 | P_DATA_REG_OFFSET); |
503 | register int i = len; | 501 | register int i = len; |
504 | int ii = 0; | 502 | int ii = 0; |
503 | struct NCR5380_hostdata *hostdata = shost_priv(instance); | ||
505 | 504 | ||
506 | while ( !(inb(instance->io_port + P_STATUS_REG_OFFSET) & P_ST_RDY) ) | 505 | while ( !(inb(instance->io_port + P_STATUS_REG_OFFSET) & P_ST_RDY) ) |
507 | ++ii; | 506 | ++ii; |
@@ -514,8 +513,8 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, | |||
514 | instance->host_no); | 513 | instance->host_no); |
515 | return -1; | 514 | return -1; |
516 | } | 515 | } |
517 | if (ii > pas_maxi) | 516 | if (ii > hostdata->spin_max_r) |
518 | pas_maxi = ii; | 517 | hostdata->spin_max_r = ii; |
519 | return 0; | 518 | return 0; |
520 | } | 519 | } |
521 | 520 | ||
@@ -538,6 +537,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src | |||
538 | register unsigned short reg = (instance->io_port + P_DATA_REG_OFFSET); | 537 | register unsigned short reg = (instance->io_port + P_DATA_REG_OFFSET); |
539 | register int i = len; | 538 | register int i = len; |
540 | int ii = 0; | 539 | int ii = 0; |
540 | struct NCR5380_hostdata *hostdata = shost_priv(instance); | ||
541 | 541 | ||
542 | while ( !((inb(instance->io_port + P_STATUS_REG_OFFSET)) & P_ST_RDY) ) | 542 | while ( !((inb(instance->io_port + P_STATUS_REG_OFFSET)) & P_ST_RDY) ) |
543 | ++ii; | 543 | ++ii; |
@@ -550,8 +550,8 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src | |||
550 | instance->host_no); | 550 | instance->host_no); |
551 | return -1; | 551 | return -1; |
552 | } | 552 | } |
553 | if (ii > pas_maxi) | 553 | if (ii > hostdata->spin_max_w) |
554 | pas_wmaxi = ii; | 554 | hostdata->spin_max_w = ii; |
555 | return 0; | 555 | return 0; |
556 | } | 556 | } |
557 | 557 | ||