X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fscsi%2Faha1542.c;h=24f0f5461792d4068c35d053a6967cb4525b6347;hb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;hp=030c971f5aafc11a46ac772ce68eeb7f2743db78;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 030c971f5..24f0f5461 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c @@ -25,7 +25,6 @@ * Added proper detection of the AHA-1640 (MCA version of AHA-1540) */ -#include #include #include #include @@ -47,7 +46,7 @@ #include #include "scsi.h" -#include "hosts.h" +#include #include "aha1542.h" #define SCSI_BUF_PA(address) isa_virt_to_bus(address) @@ -129,10 +128,10 @@ static int setup_dmaspeed[MAXBOARDS] __initdata = { -1, -1, -1, -1 }; */ #if defined(MODULE) -int isapnp = 0; -int aha1542[] = {0x330, 11, 4, -1}; -MODULE_PARM(aha1542, "1-4i"); -MODULE_PARM(isapnp, "i"); +static int isapnp = 0; +static int aha1542[] = {0x330, 11, 4, -1}; +module_param_array(aha1542, int, NULL, 0); +module_param(isapnp, bool, 0); static struct isapnp_device_id id_table[] __initdata = { { @@ -167,7 +166,7 @@ struct aha1542_hostdata { static struct Scsi_Host *aha_host[7]; /* One for each IRQ level (9-15) */ -static spinlock_t aha1542_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(aha1542_lock); @@ -543,10 +542,8 @@ static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt return; } my_done = SCtmp->scsi_done; - if (SCtmp->host_scribble) { - kfree(SCtmp->host_scribble); - SCtmp->host_scribble = 0; - } + kfree(SCtmp->host_scribble); + SCtmp->host_scribble = NULL; /* Fetch the sense data, and tuck it away, in the required slot. The Adaptec automatically fetches it, and there is no guarantee that we will still have it in the cdb when we come back */ @@ -951,7 +948,7 @@ fail: static char *setup_str[MAXBOARDS] __initdata; static int setup_idx = 0; -void __init aha1542_setup(char *str, int *ints) +static void __init aha1542_setup(char *str, int *ints) { const char *ahausage = "aha1542: usage: aha1542=[,,[,]]\n"; int setup_portbase; @@ -1013,7 +1010,7 @@ static int __init do_setup(char *str) int count=setup_idx; - get_options(str, sizeof(ints)/sizeof(int), ints); + get_options(str, ARRAY_SIZE(ints), ints); aha1542_setup(str,ints); return countdevice->id); - return FAILED; -} - /* * This is a device reset. This is handled by sending a special command * to the device. @@ -1419,7 +1399,8 @@ static int aha1542_dev_reset(Scsi_Cmnd * SCpnt) */ aha1542_out(SCpnt->device->host->io_port, &ahacmd, 1); - printk(KERN_WARNING "aha1542.c: Trying device reset for target %d\n", SCpnt->device->id); + scmd_printk(KERN_WARNING, SCpnt, + "Trying device reset for target\n"); return SUCCESS; @@ -1445,10 +1426,8 @@ static int aha1542_dev_reset(Scsi_Cmnd * SCpnt) HOSTDATA(SCpnt->host)->SCint[i]->target == SCpnt->target) { Scsi_Cmnd *SCtmp; SCtmp = HOSTDATA(SCpnt->host)->SCint[i]; - if (SCtmp->host_scribble) { - kfree(SCtmp->host_scribble); - SCtmp->host_scribble = NULL; - } + kfree(SCtmp->host_scribble); + SCtmp->host_scribble = NULL; HOSTDATA(SCpnt->host)->SCint[i] = NULL; HOSTDATA(SCpnt->host)->mb[i].status = 0; } @@ -1478,8 +1457,8 @@ static int aha1542_bus_reset(Scsi_Cmnd * SCpnt) * check for timeout, and if we are doing something like this * we are pretty desperate anyways. */ - spin_unlock_irq(SCpnt->device->host->host_lock); - scsi_sleep(4 * HZ); + ssleep(4); + spin_lock_irq(SCpnt->device->host->host_lock); WAIT(STATUS(SCpnt->device->host->io_port), @@ -1508,18 +1487,18 @@ static int aha1542_bus_reset(Scsi_Cmnd * SCpnt) */ continue; } - if (SCtmp->host_scribble) { - kfree(SCtmp->host_scribble); - SCtmp->host_scribble = NULL; - } + kfree(SCtmp->host_scribble); + SCtmp->host_scribble = NULL; HOSTDATA(SCpnt->device->host)->SCint[i] = NULL; HOSTDATA(SCpnt->device->host)->mb[i].status = 0; } } + spin_unlock_irq(SCpnt->device->host->host_lock); return SUCCESS; fail: + spin_unlock_irq(SCpnt->device->host->host_lock); return FAILED; } @@ -1542,8 +1521,7 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt) * check for timeout, and if we are doing something like this * we are pretty desperate anyways. */ - spin_unlock_irq(SCpnt->device->host->host_lock); - scsi_sleep(4 * HZ); + ssleep(4); spin_lock_irq(SCpnt->device->host->host_lock); WAIT(STATUS(SCpnt->device->host->io_port), @@ -1577,18 +1555,18 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt) */ continue; } - if (SCtmp->host_scribble) { - kfree(SCtmp->host_scribble); - SCtmp->host_scribble = NULL; - } + kfree(SCtmp->host_scribble); + SCtmp->host_scribble = NULL; HOSTDATA(SCpnt->device->host)->SCint[i] = NULL; HOSTDATA(SCpnt->device->host)->mb[i].status = 0; } } + spin_unlock_irq(SCpnt->device->host->host_lock); return SUCCESS; fail: + spin_unlock_irq(SCpnt->device->host->host_lock); return FAILED; } @@ -1721,10 +1699,8 @@ static int aha1542_old_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags) Scsi_Cmnd *SCtmp; SCtmp = HOSTDATA(SCpnt->host)->SCint[i]; SCtmp->result = DID_RESET << 16; - if (SCtmp->host_scribble) { - kfree(SCtmp->host_scribble); - SCtmp->host_scribble = NULL; - } + kfree(SCtmp->host_scribble); + SCtmp->host_scribble = NULL; printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target); SCtmp->scsi_done(SCpnt); @@ -1767,10 +1743,8 @@ fail: Scsi_Cmnd *SCtmp; SCtmp = HOSTDATA(SCpnt->host)->SCint[i]; SCtmp->result = DID_RESET << 16; - if (SCtmp->host_scribble) { - kfree(SCtmp->host_scribble); - SCtmp->host_scribble = NULL; - } + kfree(SCtmp->host_scribble); + SCtmp->host_scribble = NULL; printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target); SCtmp->scsi_done(SCpnt); @@ -1811,13 +1785,12 @@ static int aha1542_biosparam(struct scsi_device *sdev, MODULE_LICENSE("GPL"); -static Scsi_Host_Template driver_template = { +static struct scsi_host_template driver_template = { .proc_name = "aha1542", .name = "Adaptec 1542", .detect = aha1542_detect, .release = aha1542_release, .queuecommand = aha1542_queuecommand, - .eh_abort_handler = aha1542_abort, .eh_device_reset_handler= aha1542_dev_reset, .eh_bus_reset_handler = aha1542_bus_reset, .eh_host_reset_handler = aha1542_host_reset,