Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132263
b: refs/heads/master
c: 5d82720
h: refs/heads/master
i:
  132261: 31ad746
  132259: e039a13
  132255: 3d8c327
v: v3
  • Loading branch information
FUJITA Tomonori authored and Bartlomiej Zolnierkiewicz committed Mar 13, 2009
1 parent a1525f0 commit b0a709d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3eb76c1ccde496c3c0bfda23d1c803e40b762ce6
refs/heads/master: 5d82720a7f41f0c877e026c7d17e3bf20ccdbae0
12 changes: 9 additions & 3 deletions trunk/drivers/ide/ide-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
{
ide_hwif_t *hwif = drive->hwif;
struct scatterlist *sg = hwif->sg_table;
int i;

ide_map_sg(drive, rq);

Expand All @@ -136,8 +137,13 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
else
hwif->sg_dma_direction = DMA_TO_DEVICE;

return dma_map_sg(hwif->dev, sg, hwif->sg_nents,
hwif->sg_dma_direction);
i = dma_map_sg(hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction);
if (i) {
hwif->orig_sg_nents = hwif->sg_nents;
hwif->sg_nents = i;
}

return i;
}
EXPORT_SYMBOL_GPL(ide_build_sglist);

Expand All @@ -156,7 +162,7 @@ void ide_destroy_dmatable(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;

dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents,
dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->orig_sg_nents,
hwif->sg_dma_direction);
}
EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ typedef struct hwif_s {
struct scatterlist *sg_table;
int sg_max_nents; /* Maximum number of entries in it */
int sg_nents; /* Current number of entries in it */
int orig_sg_nents;
int sg_dma_direction; /* dma transfer direction */

/* data phase of the active command (currently only valid for PIO/DMA) */
Expand Down

0 comments on commit b0a709d

Please sign in to comment.