With atapi_request_sense() converted to use sg, there's no user of
non-sg interface. Kill non-sg interface.
* ATA_QCFLAG_SINGLE and ATA_QCFLAG_SG are removed. ATA_QCFLAG_DMAMAP
is used instead. (this way no LLD change is necessary)
* qc-buf_virt is removed.
* ata_sg_init_one() and ata_sg_setup_one() are removed.
Signed-off-by: Tejun Heo [EMAIL PROTECTED]
Cc: Rusty Russel [EMAIL PROTECTED]
---
drivers/ata/libata-core.c | 148 +
include/linux/libata.h|7 +--
2 files changed, 16 insertions(+), 139 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 76b8dc9..c492746 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4487,9 +4487,6 @@ void ata_sg_clean(struct ata_queued_cmd *qc)
WARN_ON(!(qc-flags ATA_QCFLAG_DMAMAP));
WARN_ON(sg == NULL);
- if (qc-flags ATA_QCFLAG_SINGLE)
- WARN_ON(qc-n_elem 1);
-
VPRINTK(unmapping %u sg elements\n, qc-n_elem);
/* if we padded the buffer out to 32-bit bound, and data
@@ -4499,27 +4496,15 @@ void ata_sg_clean(struct ata_queued_cmd *qc)
if (qc-pad_len !(qc-tf.flags ATA_TFLAG_WRITE))
pad_buf = ap-pad + (qc-tag * ATA_DMA_PAD_SZ);
- if (qc-flags ATA_QCFLAG_SG) {
- if (qc-n_elem)
- dma_unmap_sg(ap-dev, sg, qc-n_elem, dir);
- /* restore last sg */
- sg_last(sg, qc-orig_n_elem)-length += qc-pad_len;
- if (pad_buf) {
- struct scatterlist *psg = qc-pad_sgent;
- void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
- memcpy(addr + psg-offset, pad_buf, qc-pad_len);
- kunmap_atomic(addr, KM_IRQ0);
- }
- } else {
- if (qc-n_elem)
- dma_unmap_single(ap-dev,
- sg_dma_address(sg[0]), sg_dma_len(sg[0]),
- dir);
- /* restore sg */
- sg-length += qc-pad_len;
- if (pad_buf)
- memcpy(qc-buf_virt + sg-length - qc-pad_len,
- pad_buf, qc-pad_len);
+ if (qc-n_elem)
+ dma_unmap_sg(ap-dev, sg, qc-n_elem, dir);
+ /* restore last sg */
+ sg_last(sg, qc-orig_n_elem)-length += qc-pad_len;
+ if (pad_buf) {
+ struct scatterlist *psg = qc-pad_sgent;
+ void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
+ memcpy(addr + psg-offset, pad_buf, qc-pad_len);
+ kunmap_atomic(addr, KM_IRQ0);
}
qc-flags = ~ATA_QCFLAG_DMAMAP;
@@ -4759,33 +4744,6 @@ void ata_dumb_qc_prep(struct ata_queued_cmd *qc)
void ata_noop_qc_prep(struct ata_queued_cmd *qc) { }
/**
- * ata_sg_init_one - Associate command with memory buffer
- * @qc: Command to be associated
- * @buf: Memory buffer
- * @buflen: Length of memory buffer, in bytes.
- *
- * Initialize the data-related elements of queued_cmd @qc
- * to point to a single memory buffer, @buf of byte length @buflen.
- *
- * LOCKING:
- * spin_lock_irqsave(host lock)
- */
-
-void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
-{
- qc-flags |= ATA_QCFLAG_SINGLE;
-
- qc-__sg = qc-sgent;
- qc-n_elem = 1;
- qc-orig_n_elem = 1;
- qc-buf_virt = buf;
- qc-nbytes = buflen;
- qc-cursg = qc-__sg;
-
- sg_init_one(qc-sgent, buf, buflen);
-}
-
-/**
* ata_sg_init - Associate command with scatter-gather table.
* @qc: Command to be associated
* @sg: Scatter-gather table.
@@ -4802,7 +4760,7 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void
*buf, unsigned int buflen)
void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
unsigned int n_elem)
{
- qc-flags |= ATA_QCFLAG_SG;
+ qc-flags |= ATA_QCFLAG_DMAMAP;
qc-__sg = sg;
qc-n_elem = n_elem;
qc-orig_n_elem = n_elem;
@@ -4810,75 +4768,6 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct
scatterlist *sg,
}
/**
- * ata_sg_setup_one - DMA-map the memory buffer associated with a command.
- * @qc: Command with memory buffer to be mapped.
- *
- * DMA-map the memory buffer associated with queued_cmd @qc.
- *
- * LOCKING:
- * spin_lock_irqsave(host lock)
- *
- * RETURNS:
- * Zero on success, negative on error.
- */
-
-static int ata_sg_setup_one(struct ata_queued_cmd *qc)
-{
- struct ata_port *ap = qc-ap;
- int dir = qc-dma_dir;
- struct scatterlist *sg = qc-__sg;
- dma_addr_t dma_address;
- int trim_sg = 0;
-
- /* we must lengthen transfers to end on a 32-bit boundary */
- qc-pad_len = sg-length 3;
- if (qc-pad_len) {
- void *pad_buf = ap-pad + (qc-tag * ATA_DMA_PAD_SZ);
- struct