|
@@ -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);
|