From b0a709d5e08fce421d1987bff5d3270aee6d6be7 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 13 Mar 2009 21:16:13 +0100 Subject: [PATCH] --- yaml --- r: 132263 b: refs/heads/master c: 5d82720a7f41f0c877e026c7d17e3bf20ccdbae0 h: refs/heads/master i: 132261: 31ad7463fed4a600da7ff5aba0e7831ec4f8f74a 132259: e039a13f202b9fdad8d78ee0473e4d2392afd947 132255: 3d8c32715132b2f4a0170bfb23c319a156cf8070 v: v3 --- [refs] | 2 +- trunk/drivers/ide/ide-dma.c | 12 +++++++++--- trunk/include/linux/ide.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 8e5350e2dfb5..8f9b78976d77 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3eb76c1ccde496c3c0bfda23d1c803e40b762ce6 +refs/heads/master: 5d82720a7f41f0c877e026c7d17e3bf20ccdbae0 diff --git a/trunk/drivers/ide/ide-dma.c b/trunk/drivers/ide/ide-dma.c index 72ebab0bc755..059c90bb5ad2 100644 --- a/trunk/drivers/ide/ide-dma.c +++ b/trunk/drivers/ide/ide-dma.c @@ -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); @@ -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); @@ -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); diff --git a/trunk/include/linux/ide.h b/trunk/include/linux/ide.h index e0cedfe9fad4..25087aead657 100644 --- a/trunk/include/linux/ide.h +++ b/trunk/include/linux/ide.h @@ -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) */