aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/mips
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:32 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:32 -0500
commit062f9f024dcdb927cfd35c9ee8a68f59cbb1136f (patch)
treeef592f702eea3e4333b1e0e2e3db7ce945408261 /drivers/ide/mips
parent5c05ff68b9a9b40a9be949497e0aa980185565cf (diff)
ide: use ide_build_sglist() and ide_destroy_dmatable() in non-PCI host drivers
* Make ide_build_sglist() and ide_destroy_dmatable() available also when CONFIG_BLK_DEV_IDEDMA_PCI=n. * Use ide_build_sglist() and ide_destroy_dmatable() in {ics,au1xxx-}ide.c and remove no longer needed {ics,au}ide_build_sglist(). There should be no functionality changes caused by this patch. Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/mips')
-rw-r--r--drivers/ide/mips/au1xxx-ide.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 7ec96a030041..ed1a285efe14 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -209,23 +209,6 @@ static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed)
209 */ 209 */
210 210
211#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 211#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
212
213static int auide_build_sglist(ide_drive_t *drive, struct request *rq)
214{
215 ide_hwif_t *hwif = drive->hwif;
216 struct scatterlist *sg = hwif->sg_table;
217
218 ide_map_sg(drive, rq);
219
220 if (rq_data_dir(rq) == READ)
221 hwif->sg_dma_direction = DMA_FROM_DEVICE;
222 else
223 hwif->sg_dma_direction = DMA_TO_DEVICE;
224
225 return dma_map_sg(hwif->dev, sg, hwif->sg_nents,
226 hwif->sg_dma_direction);
227}
228
229static int auide_build_dmatable(ide_drive_t *drive) 212static int auide_build_dmatable(ide_drive_t *drive)
230{ 213{
231 int i, iswrite, count = 0; 214 int i, iswrite, count = 0;
@@ -240,8 +223,7 @@ static int auide_build_dmatable(ide_drive_t *drive)
240 /* Save for interrupt context */ 223 /* Save for interrupt context */
241 ahwif->drive = drive; 224 ahwif->drive = drive;
242 225
243 /* Build sglist */ 226 hwif->sg_nents = i = ide_build_sglist(drive, rq);
244 hwif->sg_nents = i = auide_build_sglist(drive, rq);
245 227
246 if (!i) 228 if (!i)
247 return 0; 229 return 0;
@@ -299,10 +281,7 @@ static int auide_build_dmatable(ide_drive_t *drive)
299 return 1; 281 return 1;
300 282
301 use_pio_instead: 283 use_pio_instead:
302 dma_unmap_sg(hwif->dev, 284 ide_destroy_dmatable(drive);
303 hwif->sg_table,
304 hwif->sg_nents,
305 hwif->sg_dma_direction);
306 285
307 return 0; /* revert to PIO for this request */ 286 return 0; /* revert to PIO for this request */
308} 287}
@@ -312,8 +291,7 @@ static int auide_dma_end(ide_drive_t *drive)
312 ide_hwif_t *hwif = HWIF(drive); 291 ide_hwif_t *hwif = HWIF(drive);
313 292
314 if (hwif->sg_nents) { 293 if (hwif->sg_nents) {
315 dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents, 294 ide_destroy_dmatable(drive);
316 hwif->sg_dma_direction);
317 hwif->sg_nents = 0; 295 hwif->sg_nents = 0;
318 } 296 }
319 297