aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2007-09-18 11:46:12 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:38 -0400
commite10b8c3f5f23188e065b1845ba732570eca007fe (patch)
treef236f3a850bbefc16e4819992a725f678c6a0421 /drivers/ata/libata-scsi.c
parentd2a84f47899d1efc24fa610696f7b793692279c7 (diff)
libata-scsi: Remove !use_sg code paths
This is a minimal patch needed to remove use of !use_sg but it is not a complete clean up of the !use_sg paths. Libata-core still has the qc->flags & ATA_QCFLAG_SG and !qc->n_elem code paths. Perhaps an ata maintainer would have a go at it. - TODO: further cleanup of qc->flags & ATA_QCFLAG_SG and !qc->n_elem code paths in libata-core - TODO: Use scsi_dma_{map,unmap} where applicable. Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f0f586b56c20..598ef1018e19 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -450,13 +450,8 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
450 qc->scsicmd = cmd; 450 qc->scsicmd = cmd;
451 qc->scsidone = done; 451 qc->scsidone = done;
452 452
453 if (cmd->use_sg) { 453 qc->__sg = (struct scatterlist *) cmd->request_buffer;
454 qc->__sg = (struct scatterlist *) cmd->request_buffer; 454 qc->n_elem = cmd->use_sg;
455 qc->n_elem = cmd->use_sg;
456 } else if (cmd->request_bufflen) {
457 qc->__sg = &qc->sgent;
458 qc->n_elem = 1;
459 }
460 } else { 455 } else {
461 cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1); 456 cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
462 done(cmd); 457 done(cmd);
@@ -1504,11 +1499,7 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
1504 goto err_did; 1499 goto err_did;
1505 } 1500 }
1506 1501
1507 if (cmd->use_sg) 1502 ata_sg_init(qc, cmd->request_buffer, cmd->use_sg);
1508 ata_sg_init(qc, cmd->request_buffer, cmd->use_sg);
1509 else
1510 ata_sg_init_one(qc, cmd->request_buffer,
1511 cmd->request_bufflen);
1512 1503
1513 qc->dma_dir = cmd->sc_data_direction; 1504 qc->dma_dir = cmd->sc_data_direction;
1514 } 1505 }
@@ -1562,15 +1553,14 @@ static unsigned int ata_scsi_rbuf_get(struct scsi_cmnd *cmd, u8 **buf_out)
1562 u8 *buf; 1553 u8 *buf;
1563 unsigned int buflen; 1554 unsigned int buflen;
1564 1555
1565 if (cmd->use_sg) { 1556 struct scatterlist *sg = (struct scatterlist *) cmd->request_buffer;
1566 struct scatterlist *sg;
1567 1557
1568 sg = (struct scatterlist *) cmd->request_buffer; 1558 if (sg) {
1569 buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; 1559 buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset;
1570 buflen = sg->length; 1560 buflen = sg->length;
1571 } else { 1561 } else {
1572 buf = cmd->request_buffer; 1562 buf = NULL;
1573 buflen = cmd->request_bufflen; 1563 buflen = 0;
1574 } 1564 }
1575 1565
1576 *buf_out = buf; 1566 *buf_out = buf;
@@ -1590,12 +1580,9 @@ static unsigned int ata_scsi_rbuf_get(struct scsi_cmnd *cmd, u8 **buf_out)
1590 1580
1591static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, u8 *buf) 1581static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, u8 *buf)
1592{ 1582{
1593 if (cmd->use_sg) { 1583 struct scatterlist *sg = (struct scatterlist *) cmd->request_buffer;
1594 struct scatterlist *sg; 1584 if (sg)
1595
1596 sg = (struct scatterlist *) cmd->request_buffer;
1597 kunmap_atomic(buf - sg->offset, KM_IRQ0); 1585 kunmap_atomic(buf - sg->offset, KM_IRQ0);
1598 }
1599} 1586}
1600 1587
1601/** 1588/**