From 925e4610933ed8ad047015188186b6d98105b980 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:11:49 +1100 Subject: ncr5380: Fix compiler warnings and __setup options Some __setup() options mentioned in Documentation/scsi don't work because a few lines of code went missing sometime since Linux 2.4. Fix the options and thus fix some compiler warnings for both the non-modular case, CC drivers/scsi/dtc.o drivers/scsi/dtc.c:176:20: warning: 'dtc_setup' defined but not used [-Wunused-function] and the modular case, CC [M] drivers/scsi/pas16.o drivers/scsi/pas16.c:335:20: warning: 'pas16_setup' defined but not used [-Wunused-function] CC [M] drivers/scsi/t128.o drivers/scsi/t128.c:147:20: warning: 't128_setup' defined but not used [-Wunused-function] Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 8cc80931df14..09556ebe1da1 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -148,6 +148,7 @@ static struct signature { #define NO_SIGNATURES ARRAY_SIZE(signatures) +#ifndef MODULE /* * Function : t128_setup(char *str, int *ints) * @@ -158,9 +159,13 @@ static struct signature { * */ -void __init t128_setup(char *str, int *ints){ +static int __init t128_setup(char *str) +{ static int commandline_current = 0; int i; + int ints[10]; + + get_options(str, ARRAY_SIZE(ints), ints); if (ints[0] != 2) printk("t128_setup : usage t128=address,irq\n"); else @@ -174,8 +179,12 @@ void __init t128_setup(char *str, int *ints){ } ++commandline_current; } + return 1; } +__setup("t128=", t128_setup); +#endif + /* * Function : int t128_detect(struct scsi_host_template * tpnt) * -- cgit From 48f16c9bef8ee6b699ab8e7c5c55920ddd1c7e8f Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:11:50 +1100 Subject: ncr5380: Remove unused macros Some macros are never evaluated (i.e. FOO, USLEEP, SCSI2 and USE_WRAPPER; and in some drivers, NCR5380_intr and NCR5380_proc_info). DRIVER_SETUP serves no purpose anymore. Remove these macro definitions. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 09556ebe1da1..e5acd9eb3148 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -47,17 +47,12 @@ * increase compared to polled I/O. * * PARITY - enable parity checking. Not supported. - * - * SCSI2 - enable support for SCSI-II tagged queueing. Untested. - * * * UNSAFE - leave interrupts enabled during pseudo-DMA transfers. You * only really want to use this if you're having a problem with * dropped characters during high speed communications, and even * then, you're going to be better off twiddling with transfersize. * - * USLEEP - enable support for devices that don't disconnect. Untested. - * * The card is detected and initialized in one of several ways : * 1. Autoprobe (default) - since the board is memory mapped, * a BIOS signature is scanned for to locate the registers. -- cgit From ed8b9e7f1827ebae902e868866438d1bcdbef0a2 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:11:51 +1100 Subject: ncr5380: Remove useless prototypes Add missing static qualifiers and remove the now pointless prototypes. The NCR5380_* prototypes are all declared in NCR5380.h and renamed using macros. Further declarations are redundant (some are completely unused). Remove them. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index e5acd9eb3148..ccfdc427c4c7 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -193,7 +193,8 @@ __setup("t128=", t128_setup); * */ -int __init t128_detect(struct scsi_host_template * tpnt){ +static int __init t128_detect(struct scsi_host_template *tpnt) +{ static int current_override = 0, current_base = 0; struct Scsi_Host *instance; unsigned long base; @@ -325,8 +326,8 @@ static int t128_release(struct Scsi_Host *shost) * and matching the H_C_S coordinates to what DOS uses. */ -int t128_biosparam(struct scsi_device *sdev, struct block_device *bdev, - sector_t capacity, int * ip) +static int t128_biosparam(struct scsi_device *sdev, struct block_device *bdev, + sector_t capacity, int *ip) { ip[0] = 64; ip[1] = 32; -- cgit From 4d3d2a54f731aa25f66adcf934ba9a55ca8204d4 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:11:52 +1100 Subject: ncr5380: Remove more useless prototypes Make use of the host template static initializer instead of assigning handlers at run-time. Move __maybe_unused qualifiers from declarations to definitions. Move the atari_scsi_bus_reset() wrapper after the definition of NCR5380_bus_reset(). All of the host template handler prototypes are now redundant so remove them. The write_info() handler is only relevant to drivers using PSEUDO_DMA so this patch fixes the compiler warning in atari_NCR5380.c and sun3_NCR5380.c: CC drivers/scsi/atari_scsi.o drivers/scsi/NCR5380.h:329: warning: 'NCR5380_write_info' declared 'static' but never defined Signed-off-by: Finn Thain Tested-by: Michael Schmitz Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index ccfdc427c4c7..f06ad91d737d 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -201,10 +201,6 @@ static int __init t128_detect(struct scsi_host_template *tpnt) void __iomem *p; int sig, count; - tpnt->proc_name = "t128"; - tpnt->show_info = t128_show_info; - tpnt->write_info = t128_write_info; - for (count = 0; current_override < NO_OVERRIDES; ++current_override) { base = 0; p = NULL; @@ -435,6 +431,9 @@ static struct scsi_host_template driver_template = { .name = "Trantor T128/T128F/T228", .detect = t128_detect, .release = t128_release, + .proc_name = "t128", + .show_info = t128_show_info, + .write_info = t128_write_info, .queuecommand = t128_queue_command, .eh_abort_handler = t128_abort, .eh_bus_reset_handler = t128_bus_reset, -- cgit From 997acab7d593913eaa0606ff257079efcfcb146d Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:11:54 +1100 Subject: ncr5380: Remove redundant AUTOSENSE macro Every NCR5380 driver sets AUTOSENSE so it need not be optional (and the mid-layer expects it). Remove this redundant macro to improve readability. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index f06ad91d737d..4253fe97c210 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -1,4 +1,3 @@ -#define AUTOSENSE #define PSEUDO_DMA /* @@ -40,9 +39,6 @@ /* * Options : - * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically - * for commands that return with a CHECK CONDITION status. - * * PSEUDO_DMA - enables PSEUDO-DMA hardware, should give a 3-4X performance * increase compared to polled I/O. * -- cgit From 3f9e986e2f1df8fa69ffe213098c1ee98f1c9584 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:11:55 +1100 Subject: ncr5380: Remove duplicate comments The LIMIT_TRANSFERSIZE, PSEUDO_DMA, PARITY and UNSAFE options are all documented in the core drivers where they are used. The same goes for the chip databook reference. Remove the duplicate comments. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 4253fe97c210..6220dee8b697 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -23,32 +23,9 @@ * 5415 Randall Place * Fremont, CA 94538 * 1+ (415) 770-1400, FAX 1+ (415) 770-9910 - * - * and - * - * NCR 5380 Family - * SCSI Protocol Controller - * Databook - * - * NCR Microelectronics - * 1635 Aeroplaza Drive - * Colorado Springs, CO 80916 - * 1+ (719) 578-3400 - * 1+ (800) 334-5454 */ /* - * Options : - * PSEUDO_DMA - enables PSEUDO-DMA hardware, should give a 3-4X performance - * increase compared to polled I/O. - * - * PARITY - enable parity checking. Not supported. - * - * UNSAFE - leave interrupts enabled during pseudo-DMA transfers. You - * only really want to use this if you're having a problem with - * dropped characters during high speed communications, and even - * then, you're going to be better off twiddling with transfersize. - * * The card is detected and initialized in one of several ways : * 1. Autoprobe (default) - since the board is memory mapped, * a BIOS signature is scanned for to locate the registers. -- cgit From 22f5f10d2dadc50bf26a482b782a5e04f6e9b362 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:11:56 +1100 Subject: ncr5380: Fix SCSI_IRQ_NONE bugs Oak scsi doesn't use any IRQ, but it sets irq = IRQ_NONE rather than SCSI_IRQ_NONE. Problem is, the core NCR5380 driver expects SCSI_IRQ_NONE if it is to issue IDENTIFY commands that prevent target disconnection. And, as Geert points out, IRQ_NONE is part of enum irqreturn. Other drivers, when they can't get an IRQ or can't use one, will set host->irq = SCSI_IRQ_NONE (that is, 255). But when they exit they will attempt to free IRQ 255 which was never requested. Fix these bugs by using NO_IRQ in place of SCSI_IRQ_NONE and IRQ_NONE. That means IRQ 0 is no longer probed by ISA drivers but I don't think this matters. Setting IRQ = 255 for these ISA drivers is understood to mean no IRQ. This remains supported so as to avoid breaking existing ISA setups (which can be difficult to get working) and because existing documentation (SANE, TLDP etc) describes this usage for the ISA NCR5380 driver options. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 6220dee8b697..ad833689b311 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -228,15 +228,19 @@ found: else instance->irq = NCR5380_probe_irq(instance, T128_IRQS); - if (instance->irq != SCSI_IRQ_NONE) + /* Compatibility with documented NCR5380 kernel parameters */ + if (instance->irq == 255) + instance->irq = NO_IRQ; + + if (instance->irq != NO_IRQ) if (request_irq(instance->irq, t128_intr, 0, "t128", instance)) { printk("scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); - instance->irq = SCSI_IRQ_NONE; + instance->irq = NO_IRQ; } - if (instance->irq == SCSI_IRQ_NONE) { + if (instance->irq == NO_IRQ) { printk("scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no); printk("scsi%d : please jumper the board for a free IRQ.\n", instance->host_no); } @@ -246,7 +250,7 @@ found: #endif printk("scsi%d : at 0x%08lx", instance->host_no, instance->base); - if (instance->irq == SCSI_IRQ_NONE) + if (instance->irq == NO_IRQ) printk (" interrupts disabled"); else printk (" irq %d", instance->irq); @@ -265,7 +269,7 @@ static int t128_release(struct Scsi_Host *shost) { NCR5380_local_declare(); NCR5380_setup(shost); - if (shost->irq) + if (shost->irq != NO_IRQ) free_irq(shost->irq, shost); NCR5380_exit(shost); if (shost->io_port && shost->n_io_port) -- cgit From 8c32513bd395dc5d382e4883097482567cf8bbc5 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:11:58 +1100 Subject: ncr5380: Cleanup host info() methods If the host->info() method is not set, then host->name is used by default. For atari_scsi, that is exactly the same text. So remove the redundant info() method. Keep sun3_scsi.c in line with atari_scsi. Some NCR5380 drivers return an empty string from the info() method (arm/cumana_1.c arm/oak.c mac_scsi.c) while other drivers use the default (dmx3191d dtc.c g_NCR5380.c pas16.c t128.c). Implement a common info() method to replace a lot of duplicated code which the various drivers use to announce the same information. This replaces most of the (deprecated) show_info() output and all of the NCR5380_print_info() output. This also eliminates a bunch of code in g_NCR5380 which just duplicates functionality in the core driver. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index ad833689b311..60aff4ed4cbf 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -249,16 +249,6 @@ found: printk("scsi%d : irq = %d\n", instance->host_no, instance->irq); #endif - printk("scsi%d : at 0x%08lx", instance->host_no, instance->base); - if (instance->irq == NO_IRQ) - printk (" interrupts disabled"); - else - printk (" irq %d", instance->irq); - printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", - CAN_QUEUE, CMD_PER_LUN, T128_PUBLIC_RELEASE); - NCR5380_print_options(instance); - printk("\n"); - ++current_override; ++count; } @@ -411,6 +401,7 @@ static struct scsi_host_template driver_template = { .proc_name = "t128", .show_info = t128_show_info, .write_info = t128_write_info, + .info = t128_info, .queuecommand = t128_queue_command, .eh_abort_handler = t128_abort, .eh_bus_reset_handler = t128_bus_reset, -- cgit From 96068e6b4d86a397f50ae401723f315110874e1a Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:12:01 +1100 Subject: ncr5380: Remove *_RELEASE macros The *_RELEASE macros don't tell me anything. In some cases the version in the macro contradicts the version in the comments. Anyway, the Linux kernel version is sufficient information. Remove these macros to improve readability. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 60aff4ed4cbf..69dac7776059 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -11,8 +11,6 @@ * drew@colorado.edu * +1 (303) 440-4894 * - * DISTRIBUTION RELEASE 3. - * * For more information, please consult * * Trantor Systems, Ltd. -- cgit From 710ddd0d50d22b40e3b644ea35966489ad178978 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 12 Nov 2014 16:12:02 +1100 Subject: ncr5380: Drop legacy scsi.h include Convert Scsi_Cmnd to struct scsi_cmnd and drop the #include "scsi.h". The sun3_NCR5380.c core driver already uses struct scsi_cmnd so converting the other core drivers reduces the diff which makes them easier to unify. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Michael Schmitz Signed-off-by: Christoph Hellwig --- drivers/scsi/t128.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/scsi/t128.c') diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 69dac7776059..87828acbf7c6 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -77,7 +77,6 @@ #include #include -#include "scsi.h" #include #include "t128.h" #define AUTOPROBE_IRQ -- cgit