aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-26 13:02:30 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-26 13:02:30 -0400
commitcdbbde14cb55dd10771ce79154f787322d88411b (patch)
treed9b0f1f1a16e7c3d2fb656f794826aa3b37e7628 /drivers
parent284e423811495f632a7a334b2b93caba07d4f778 (diff)
parent32529e0128923e42126b5d14e444c18295a452ba (diff)
Merge of 'misc-fixes' branch from
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/libata-core.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index ee9b96da841e..63d3f70d06e1 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -2071,7 +2071,7 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
2071 sg = qc->sg; 2071 sg = qc->sg;
2072 sg->page = virt_to_page(buf); 2072 sg->page = virt_to_page(buf);
2073 sg->offset = (unsigned long) buf & ~PAGE_MASK; 2073 sg->offset = (unsigned long) buf & ~PAGE_MASK;
2074 sg_dma_len(sg) = buflen; 2074 sg->length = buflen;
2075} 2075}
2076 2076
2077void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 2077void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
@@ -2101,11 +2101,12 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
2101 dma_addr_t dma_address; 2101 dma_addr_t dma_address;
2102 2102
2103 dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt, 2103 dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt,
2104 sg_dma_len(sg), dir); 2104 sg->length, dir);
2105 if (dma_mapping_error(dma_address)) 2105 if (dma_mapping_error(dma_address))
2106 return -1; 2106 return -1;
2107 2107
2108 sg_dma_address(sg) = dma_address; 2108 sg_dma_address(sg) = dma_address;
2109 sg_dma_len(sg) = sg->length;
2109 2110
2110 DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg), 2111 DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg),
2111 qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); 2112 qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
@@ -2310,7 +2311,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
2310 qc->cursect++; 2311 qc->cursect++;
2311 qc->cursg_ofs++; 2312 qc->cursg_ofs++;
2312 2313
2313 if ((qc->cursg_ofs * ATA_SECT_SIZE) == sg_dma_len(&sg[qc->cursg])) { 2314 if ((qc->cursg_ofs * ATA_SECT_SIZE) == (&sg[qc->cursg])->length) {
2314 qc->cursg++; 2315 qc->cursg++;
2315 qc->cursg_ofs = 0; 2316 qc->cursg_ofs = 0;
2316 } 2317 }
@@ -2347,7 +2348,7 @@ next_page:
2347 page = nth_page(page, (offset >> PAGE_SHIFT)); 2348 page = nth_page(page, (offset >> PAGE_SHIFT));
2348 offset %= PAGE_SIZE; 2349 offset %= PAGE_SIZE;
2349 2350
2350 count = min(sg_dma_len(sg) - qc->cursg_ofs, bytes); 2351 count = min(sg->length - qc->cursg_ofs, bytes);
2351 2352
2352 /* don't cross page boundaries */ 2353 /* don't cross page boundaries */
2353 count = min(count, (unsigned int)PAGE_SIZE - offset); 2354 count = min(count, (unsigned int)PAGE_SIZE - offset);
@@ -2358,7 +2359,7 @@ next_page:
2358 qc->curbytes += count; 2359 qc->curbytes += count;
2359 qc->cursg_ofs += count; 2360 qc->cursg_ofs += count;
2360 2361
2361 if (qc->cursg_ofs == sg_dma_len(sg)) { 2362 if (qc->cursg_ofs == sg->length) {
2362 qc->cursg++; 2363 qc->cursg++;
2363 qc->cursg_ofs = 0; 2364 qc->cursg_ofs = 0;
2364 } 2365 }
@@ -2371,7 +2372,7 @@ next_page:
2371 kunmap(page); 2372 kunmap(page);
2372 2373
2373 if (bytes) { 2374 if (bytes) {
2374 if (qc->cursg_ofs < sg_dma_len(sg)) 2375 if (qc->cursg_ofs < sg->length)
2375 goto next_page; 2376 goto next_page;
2376 goto next_sg; 2377 goto next_sg;
2377 } 2378 }