]> err.no Git - linux-2.6/blobdiff - drivers/scsi/aha1542.c
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6] / drivers / scsi / aha1542.c
index 24f0f5461792d4068c35d053a6967cb4525b6347..961a1882cb7eb0741ea26659c67ac8a557fb6516 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
-#include <linux/pci.h>
 #include <linux/isapnp.h>
 #include <linux/blkdev.h>
 #include <linux/mca.h>
@@ -62,15 +61,15 @@ static void BAD_DMA(void *address, unsigned int length)
 }
 
 static void BAD_SG_DMA(Scsi_Cmnd * SCpnt,
-                      struct scatterlist *sgpnt,
+                      struct scatterlist *sgp,
                       int nseg,
                       int badseg)
 {
        printk(KERN_CRIT "sgpnt[%d:%d] page %p/0x%llx length %u\n",
               badseg, nseg,
-              page_address(sgpnt[badseg].page) + sgpnt[badseg].offset,
-              (unsigned long long)SCSI_SG_PA(&sgpnt[badseg]),
-              sgpnt[badseg].length);
+              page_address(sgp->page) + sgp->offset,
+              (unsigned long long)SCSI_SG_PA(sgp),
+              sgp->length);
 
        /*
         * Not safe to continue.
@@ -174,9 +173,8 @@ static DEFINE_SPINLOCK(aha1542_lock);
 
 static void setup_mailboxes(int base_io, struct Scsi_Host *shpnt);
 static int aha1542_restart(struct Scsi_Host *shost);
-static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt_regs *regs);
-static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id,
-                                       struct pt_regs *regs);
+static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id);
+static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id);
 
 #define aha1542_intr_reset(base)  outb(IRST, CONTROL(base))
 
@@ -416,8 +414,7 @@ fail:
 }
 
 /* A quick wrapper for do_aha1542_intr_handle to grab the spin lock */
-static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id,
-                                       struct pt_regs *regs)
+static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id)
 {
        unsigned long flags;
        struct Scsi_Host *shost;
@@ -427,13 +424,13 @@ static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id,
                panic("Splunge!");
 
        spin_lock_irqsave(shost->host_lock, flags);
-       aha1542_intr_handle(shost, dev_id, regs);
+       aha1542_intr_handle(shost, dev_id);
        spin_unlock_irqrestore(shost->host_lock, flags);
        return IRQ_HANDLED;
 }
 
 /* A "high" level interrupt handler */
-static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt_regs *regs)
+static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id)
 {
        void (*my_done) (Scsi_Cmnd *) = NULL;
        int errstatus, mbi, mbo, mbistatus;
@@ -694,31 +691,29 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
        memcpy(ccb[mbo].cdb, cmd, ccb[mbo].cdblen);
 
        if (SCpnt->use_sg) {
-               struct scatterlist *sgpnt;
+               struct scatterlist *sg;
                struct chain *cptr;
 #ifdef DEBUG
                unsigned char *ptr;
 #endif
                int i;
                ccb[mbo].op = 2;        /* SCSI Initiator Command  w/scatter-gather */
-               SCpnt->host_scribble = (unsigned char *) kmalloc(512, GFP_KERNEL | GFP_DMA);
-               sgpnt = (struct scatterlist *) SCpnt->request_buffer;
+               SCpnt->host_scribble = kmalloc(512, GFP_KERNEL | GFP_DMA);
                cptr = (struct chain *) SCpnt->host_scribble;
                if (cptr == NULL) {
                        /* free the claimed mailbox slot */
                        HOSTDATA(SCpnt->device->host)->SCint[mbo] = NULL;
                        return SCSI_MLQUEUE_HOST_BUSY;
                }
-               for (i = 0; i < SCpnt->use_sg; i++) {
-                       if (sgpnt[i].length == 0 || SCpnt->use_sg > 16 ||
-                           (((int) sgpnt[i].offset) & 1) || (sgpnt[i].length & 1)) {
+               scsi_for_each_sg(SCpnt, sg, SCpnt->use_sg, i) {
+                       if (sg->length == 0 || SCpnt->use_sg > 16 ||
+                           (((int) sg->offset) & 1) || (sg->length & 1)) {
                                unsigned char *ptr;
                                printk(KERN_CRIT "Bad segment list supplied to aha1542.c (%d, %d)\n", SCpnt->use_sg, i);
-                               for (i = 0; i < SCpnt->use_sg; i++) {
+                               scsi_for_each_sg(SCpnt, sg, SCpnt->use_sg, i) {
                                        printk(KERN_CRIT "%d: %p %d\n", i,
-                                              (page_address(sgpnt[i].page) +
-                                               sgpnt[i].offset),
-                                              sgpnt[i].length);
+                                              (page_address(sg->page) +
+                                               sg->offset), sg->length);
                                };
                                printk(KERN_CRIT "cptr %x: ", (unsigned int) cptr);
                                ptr = (unsigned char *) &cptr[i];
@@ -726,10 +721,10 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
                                        printk("%02x ", ptr[i]);
                                panic("Foooooooood fight!");
                        };
-                       any2scsi(cptr[i].dataptr, SCSI_SG_PA(&sgpnt[i]));
-                       if (SCSI_SG_PA(&sgpnt[i]) + sgpnt[i].length - 1 > ISA_DMA_THRESHOLD)
-                               BAD_SG_DMA(SCpnt, sgpnt, SCpnt->use_sg, i);
-                       any2scsi(cptr[i].datalen, sgpnt[i].length);
+                       any2scsi(cptr[i].dataptr, SCSI_SG_PA(sg));
+                       if (SCSI_SG_PA(sg) + sg->length - 1 > ISA_DMA_THRESHOLD)
+                               BAD_SG_DMA(SCpnt, sg, SCpnt->use_sg, i);
+                       any2scsi(cptr[i].datalen, sg->length);
                };
                any2scsi(ccb[mbo].datalen, SCpnt->use_sg * sizeof(struct chain));
                any2scsi(ccb[mbo].dataptr, SCSI_BUF_PA(cptr));