X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fscsi%2Fimm.c;h=0464c182c5771fc44d02a3549bbd19fbd6b8d227;hb=refs%2Fheads%2Fvserver;hp=915d593fbf21b2760981fb04b67ed1689a74e880;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 915d593fb..0464c182c 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c @@ -3,21 +3,18 @@ * * (The IMM is the embedded controller in the ZIP Plus drive.) * - * Current Maintainer: David Campbell (Perth, Western Australia) - * campbell@torque.net - * * My unoffical company acronym list is 21 pages long: * FLA: Four letter acronym with built in facility for * future expansion to five letters. */ -#include #include #include #include #include #include #include +#include #include #include @@ -39,7 +36,7 @@ typedef struct { int base_hi; /* Hi Base address for ECP-ISA chipset */ int mode; /* Transfer mode */ struct scsi_cmnd *cur_cmd; /* Current queued command */ - struct work_struct imm_tq; /* Polling interrupt stuff */ + struct delayed_work imm_tq; /* Polling interrupt stuff */ unsigned long jstart; /* Jiffies at start */ unsigned failed:1; /* Failure flag */ unsigned dp:1; /* Data phase present */ @@ -60,7 +57,7 @@ static inline imm_struct *imm_dev(struct Scsi_Host *host) return *(imm_struct **)&host->hostdata; } -static spinlock_t arbitration_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(arbitration_lock); static void got_it(imm_struct *dev) { @@ -610,9 +607,9 @@ static int imm_init(imm_struct *dev) if (imm_connect(dev, 0) != 1) return -EIO; imm_reset_pulse(dev->base); - udelay(1000); /* Delay to allow devices to settle */ + mdelay(1); /* Delay to allow devices to settle */ imm_disconnect(dev); - udelay(1000); /* Another delay to allow devices to settle */ + mdelay(1); /* Another delay to allow devices to settle */ return device_check(dev); } @@ -736,9 +733,9 @@ static int imm_completion(struct scsi_cmnd *cmd) * the scheduler's task queue to generate a stream of call-backs and * complete the request when the drive is ready. */ -static void imm_interrupt(void *data) +static void imm_interrupt(struct work_struct *work) { - imm_struct *dev = (imm_struct *) data; + imm_struct *dev = container_of(work, imm_struct, imm_tq.work); struct scsi_cmnd *cmd = dev->cur_cmd; struct Scsi_Host *host = cmd->device->host; unsigned long flags; @@ -748,7 +745,6 @@ static void imm_interrupt(void *data) return; } if (imm_engine(dev, cmd)) { - INIT_WORK(&dev->imm_tq, imm_interrupt, (void *) dev); schedule_delayed_work(&dev->imm_tq, 1); return; } @@ -758,7 +754,7 @@ static void imm_interrupt(void *data) case DID_OK: break; case DID_NO_CONNECT: - printk("imm: no device at SCSI ID %i\n", cmd->target); + printk("imm: no device at SCSI ID %i\n", cmd->device->id); break; case DID_BUS_BUSY: printk("imm: BUS BUSY - EPP timeout detected\n"); @@ -829,7 +825,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) /* Phase 2 - We are now talking to the scsi bus */ case 2: - if (!imm_select(dev, cmd->device->id)) { + if (!imm_select(dev, scmd_id(cmd))) { imm_fail(dev, DID_NO_CONNECT); return 0; } @@ -956,8 +952,7 @@ static int imm_queuecommand(struct scsi_cmnd *cmd, cmd->result = DID_ERROR << 16; /* default return code */ cmd->SCp.phase = 0; /* bus free */ - INIT_WORK(&dev->imm_tq, imm_interrupt, dev); - schedule_work(&dev->imm_tq); + schedule_delayed_work(&dev->imm_tq, 0); imm_pb_claim(dev); @@ -1026,9 +1021,9 @@ static int imm_reset(struct scsi_cmnd *cmd) imm_connect(dev, CONNECT_NORMAL); imm_reset_pulse(dev->base); - udelay(1000); /* device settle delay */ + mdelay(1); /* device settle delay */ imm_disconnect(dev); - udelay(1000); /* device settle delay */ + mdelay(1); /* device settle delay */ return SUCCESS; } @@ -1118,6 +1113,10 @@ static int device_check(imm_struct *dev) return -ENODEV; } +/* + * imm cannot deal with highmem, so this causes all IO pages for this host + * to reside in low memory (hence mapped) + */ static int imm_adjust_queue(struct scsi_device *device) { blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH); @@ -1152,7 +1151,7 @@ static int __imm_attach(struct parport *pb) { struct Scsi_Host *host; imm_struct *dev; - DECLARE_WAIT_QUEUE_HEAD(waiting); + DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waiting); DEFINE_WAIT(wait); int ports; int modes, ppb; @@ -1224,7 +1223,7 @@ static int __imm_attach(struct parport *pb) else ports = 8; - INIT_WORK(&dev->imm_tq, imm_interrupt, dev); + INIT_DELAYED_WORK(&dev->imm_tq, imm_interrupt); err = -ENOMEM; host = scsi_host_alloc(&imm_template, sizeof(imm_struct *));