forcedeth: mac address fix
[safe/jmp/linux-2.6] / drivers / scsi / wd7000.c
index e55f0ee..c975c01 100644 (file)
 #include <linux/blkdev.h>
 #include <linux/init.h>
 #include <linux/stat.h>
+#include <linux/io.h>
 
 #include <asm/system.h>
 #include <asm/dma.h>
-#include <asm/io.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -998,7 +998,7 @@ static int make_code(unsigned hosterr, unsigned scsierr)
 #define wd7000_intr_ack(host)   outb (0, host->iobase + ASC_INTR_ACK)
 
 
-static irqreturn_t wd7000_intr(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t wd7000_intr(int irq, void *dev_id)
 {
        Adapter *host = (Adapter *) dev_id;
        int flag, icmb, errstatus, icmb_status;
@@ -1091,6 +1091,7 @@ static int wd7000_queuecommand(struct scsi_cmnd *SCpnt,
        unchar *cdb = (unchar *) SCpnt->cmnd;
        unchar idlun;
        short cdblen;
+       int nseg;
        Adapter *host = (Adapter *) SCpnt->device->host->hostdata;
 
        cdblen = SCpnt->cmd_len;
@@ -1106,28 +1107,29 @@ static int wd7000_queuecommand(struct scsi_cmnd *SCpnt,
        SCpnt->host_scribble = (unchar *) scb;
        scb->host = host;
 
-       if (SCpnt->use_sg) {
-               struct scatterlist *sg = (struct scatterlist *) SCpnt->request_buffer;
+       nseg = scsi_sg_count(SCpnt);
+       if (nseg > 1) {
+               struct scatterlist *sg;
                unsigned i;
 
-               if (SCpnt->device->host->sg_tablesize == SG_NONE) {
-                       panic("wd7000_queuecommand: scatter/gather not supported.\n");
-               }
-               dprintk("Using scatter/gather with %d elements.\n", SCpnt->use_sg);
+               dprintk("Using scatter/gather with %d elements.\n", nseg);
 
                sgb = scb->sgb;
                scb->op = 1;
                any2scsi(scb->dataptr, (int) sgb);
-               any2scsi(scb->maxlen, SCpnt->use_sg * sizeof(Sgb));
+               any2scsi(scb->maxlen, nseg * sizeof(Sgb));
 
-               for (i = 0; i < SCpnt->use_sg; i++) {
-                       any2scsi(sgb[i].ptr, isa_page_to_bus(sg[i].page) + sg[i].offset);
-                       any2scsi(sgb[i].len, sg[i].length);
+               scsi_for_each_sg(SCpnt, sg, nseg, i) {
+                       any2scsi(sgb[i].ptr, isa_page_to_bus(sg_page(sg)) + sg->offset);
+                       any2scsi(sgb[i].len, sg->length);
                }
        } else {
                scb->op = 0;
-               any2scsi(scb->dataptr, isa_virt_to_bus(SCpnt->request_buffer));
-               any2scsi(scb->maxlen, SCpnt->request_bufflen);
+               if (nseg) {
+                       struct scatterlist *sg = scsi_sglist(SCpnt);
+                       any2scsi(scb->dataptr, isa_page_to_bus(sg_page(sg)) + sg->offset);
+               }
+               any2scsi(scb->maxlen, scsi_bufflen(SCpnt));
        }
 
        /* FIXME: drop lock and yield here ? */
@@ -1250,7 +1252,7 @@ static int wd7000_init(Adapter * host)
                return 0;
 
 
-       if (request_irq(host->irq, wd7000_intr, SA_INTERRUPT, "wd7000", host)) {
+       if (request_irq(host->irq, wd7000_intr, IRQF_DISABLED, "wd7000", host)) {
                printk("wd7000_init: can't get IRQ %d.\n", host->irq);
                return (0);
        }
@@ -1391,7 +1393,7 @@ static int wd7000_proc_info(struct Scsi_Host *host, char *buffer, char **start,
  *
  */
 
-static int wd7000_detect(struct scsi_host_template *tpnt)
+static __init int wd7000_detect(struct scsi_host_template *tpnt)
 {
        short present = 0, biosaddr_ptr, sig_ptr, i, pass;
        short biosptr[NUM_CONFIGS];
@@ -1522,7 +1524,7 @@ static int wd7000_detect(struct scsi_host_template *tpnt)
                                 *  For boards before rev 6.0, scatter/gather isn't supported.
                                 */
                                if (host->rev1 < 6)
-                                       sh->sg_tablesize = SG_NONE;
+                                       sh->sg_tablesize = 1;
 
                                present++;      /* count it */