X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Fwd7000.c;h=255c611e78b8469a8ee2b2951c18f3b357d123c5;hb=f563d53c30f3e60cde3a194cc1a87284ee0b3366;hp=331e1cf159b05169b5e05af7487591f5b916b1db;hpb=24fcbacedb0d83cabc6761acbecfbf751265ce52;p=linux-2.6 diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index 331e1cf159..255c611e78 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c @@ -178,10 +178,10 @@ #include #include #include +#include #include #include -#include #include #include @@ -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) { + 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->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); + any2scsi(scb->dataptr, isa_virt_to_bus(scsi_sglist(SCpnt))); + any2scsi(scb->maxlen, scsi_bufflen(SCpnt)); } /* FIXME: drop lock and yield here ? */ @@ -1669,6 +1671,7 @@ static struct scsi_host_template driver_template = { .cmd_per_lun = 1, .unchecked_isa_dma = 1, .use_clustering = ENABLE_CLUSTERING, + .use_sg_chaining = ENABLE_SG_CHAINING, }; #include "scsi_module.c"