diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:32 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:32 -0500 |
commit | 062f9f024dcdb927cfd35c9ee8a68f59cbb1136f (patch) | |
tree | ef592f702eea3e4333b1e0e2e3db7ce945408261 /drivers | |
parent | 5c05ff68b9a9b40a9be949497e0aa980185565cf (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')
-rw-r--r-- | drivers/ide/arm/icside.c | 21 | ||||
-rw-r--r-- | drivers/ide/ide-dma.c | 4 | ||||
-rw-r--r-- | drivers/ide/mips/au1xxx-ide.c | 28 |
3 files changed, 8 insertions, 45 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 774b87e1b704..12cbb5d07f61 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -204,22 +204,6 @@ static void icside_maskproc(ide_drive_t *drive, int mask) | |||
204 | * interfaces use the same IRQ, which should guarantee this. | 204 | * interfaces use the same IRQ, which should guarantee this. |
205 | */ | 205 | */ |
206 | 206 | ||
207 | static void icside_build_sglist(ide_drive_t *drive, struct request *rq) | ||
208 | { | ||
209 | ide_hwif_t *hwif = drive->hwif; | ||
210 | struct scatterlist *sg = hwif->sg_table; | ||
211 | |||
212 | ide_map_sg(drive, rq); | ||
213 | |||
214 | if (rq_data_dir(rq) == READ) | ||
215 | hwif->sg_dma_direction = DMA_FROM_DEVICE; | ||
216 | else | ||
217 | hwif->sg_dma_direction = DMA_TO_DEVICE; | ||
218 | |||
219 | hwif->sg_nents = dma_map_sg(hwif->dev, sg, hwif->sg_nents, | ||
220 | hwif->sg_dma_direction); | ||
221 | } | ||
222 | |||
223 | /* | 207 | /* |
224 | * Configure the IOMD to give the appropriate timings for the transfer | 208 | * Configure the IOMD to give the appropriate timings for the transfer |
225 | * mode being requested. We take the advice of the ATA standards, and | 209 | * mode being requested. We take the advice of the ATA standards, and |
@@ -298,8 +282,7 @@ static int icside_dma_end(ide_drive_t *drive) | |||
298 | disable_dma(ec->dma); | 282 | disable_dma(ec->dma); |
299 | 283 | ||
300 | /* Teardown mappings after DMA has completed. */ | 284 | /* Teardown mappings after DMA has completed. */ |
301 | dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents, | 285 | ide_destroy_dmatable(drive); |
302 | hwif->sg_dma_direction); | ||
303 | 286 | ||
304 | return get_dma_residue(ec->dma) != 0; | 287 | return get_dma_residue(ec->dma) != 0; |
305 | } | 288 | } |
@@ -331,7 +314,7 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
331 | */ | 314 | */ |
332 | BUG_ON(dma_channel_active(ec->dma)); | 315 | BUG_ON(dma_channel_active(ec->dma)); |
333 | 316 | ||
334 | icside_build_sglist(drive, rq); | 317 | hwif->sg_nents = ide_build_sglist(drive, rq); |
335 | 318 | ||
336 | /* | 319 | /* |
337 | * Ensure that we have the right interrupt routed. | 320 | * Ensure that we have the right interrupt routed. |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index ec7c5c8dc698..64fd78ba2810 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -170,7 +170,6 @@ static int ide_dma_good_drive(ide_drive_t *drive) | |||
170 | return ide_in_drive_list(drive->id, drive_whitelist); | 170 | return ide_in_drive_list(drive->id, drive_whitelist); |
171 | } | 171 | } |
172 | 172 | ||
173 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | ||
174 | /** | 173 | /** |
175 | * ide_build_sglist - map IDE scatter gather for DMA I/O | 174 | * ide_build_sglist - map IDE scatter gather for DMA I/O |
176 | * @drive: the drive to build the DMA table for | 175 | * @drive: the drive to build the DMA table for |
@@ -200,6 +199,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) | |||
200 | 199 | ||
201 | EXPORT_SYMBOL_GPL(ide_build_sglist); | 200 | EXPORT_SYMBOL_GPL(ide_build_sglist); |
202 | 201 | ||
202 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | ||
203 | /** | 203 | /** |
204 | * ide_build_dmatable - build IDE DMA table | 204 | * ide_build_dmatable - build IDE DMA table |
205 | * | 205 | * |
@@ -294,6 +294,7 @@ use_pio_instead: | |||
294 | } | 294 | } |
295 | 295 | ||
296 | EXPORT_SYMBOL_GPL(ide_build_dmatable); | 296 | EXPORT_SYMBOL_GPL(ide_build_dmatable); |
297 | #endif | ||
297 | 298 | ||
298 | /** | 299 | /** |
299 | * ide_destroy_dmatable - clean up DMA mapping | 300 | * ide_destroy_dmatable - clean up DMA mapping |
@@ -316,6 +317,7 @@ void ide_destroy_dmatable (ide_drive_t *drive) | |||
316 | 317 | ||
317 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); | 318 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); |
318 | 319 | ||
320 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | ||
319 | /** | 321 | /** |
320 | * config_drive_for_dma - attempt to activate IDE DMA | 322 | * config_drive_for_dma - attempt to activate IDE DMA |
321 | * @drive: the drive to place in DMA mode | 323 | * @drive: the drive to place in DMA mode |
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 | |||
213 | static 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 | |||
229 | static int auide_build_dmatable(ide_drive_t *drive) | 212 | static 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 | ||