aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-24 18:22:43 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-24 18:22:43 -0400
commit65ca5377322c7543163066f373ae9e6b0ad8de8a (patch)
tree0d333cb6c781f151d82ed66fd4ece26359525366 /drivers/ide
parentb6a45a0b1e9a358b81201659cf87b023e3ec73e0 (diff)
ide: move ide_dma_timeout_retry() to ide-dma.c
Move ide_dma_timeout_retry() to ide-dma.c and add static inline version for CONFIG_BLK_DEV_IDEDMA=n. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-dma.c57
-rw-r--r--drivers/ide/ide-io.c57
2 files changed, 57 insertions, 57 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 059c90bb5ad2..a878f4734f81 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -470,6 +470,63 @@ void ide_dma_timeout(ide_drive_t *drive)
470} 470}
471EXPORT_SYMBOL_GPL(ide_dma_timeout); 471EXPORT_SYMBOL_GPL(ide_dma_timeout);
472 472
473/*
474 * un-busy the port etc, and clear any pending DMA status. we want to
475 * retry the current request in pio mode instead of risking tossing it
476 * all away
477 */
478ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
479{
480 ide_hwif_t *hwif = drive->hwif;
481 struct request *rq;
482 ide_startstop_t ret = ide_stopped;
483
484 /*
485 * end current dma transaction
486 */
487
488 if (error < 0) {
489 printk(KERN_WARNING "%s: DMA timeout error\n", drive->name);
490 (void)hwif->dma_ops->dma_end(drive);
491 ret = ide_error(drive, "dma timeout error",
492 hwif->tp_ops->read_status(hwif));
493 } else {
494 printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name);
495 hwif->dma_ops->dma_timeout(drive);
496 }
497
498 /*
499 * disable dma for now, but remember that we did so because of
500 * a timeout -- we'll reenable after we finish this next request
501 * (or rather the first chunk of it) in pio.
502 */
503 drive->dev_flags |= IDE_DFLAG_DMA_PIO_RETRY;
504 drive->retry_pio++;
505 ide_dma_off_quietly(drive);
506
507 /*
508 * un-busy drive etc and make sure request is sane
509 */
510
511 rq = hwif->rq;
512 if (!rq)
513 goto out;
514
515 hwif->rq = NULL;
516
517 rq->errors = 0;
518
519 if (!rq->bio)
520 goto out;
521
522 rq->sector = rq->bio->bi_sector;
523 rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9;
524 rq->hard_cur_sectors = rq->current_nr_sectors;
525 rq->buffer = bio_data(rq->bio);
526out:
527 return ret;
528}
529
473void ide_release_dma_engine(ide_hwif_t *hwif) 530void ide_release_dma_engine(ide_hwif_t *hwif)
474{ 531{
475 if (hwif->dmatable_cpu) { 532 if (hwif->dmatable_cpu) {
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 835cf646bb07..557b15700ea2 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -819,63 +819,6 @@ plug_device_2:
819 blk_plug_device(q); 819 blk_plug_device(q);
820} 820}
821 821
822/*
823 * un-busy the port etc, and clear any pending DMA status. we want to
824 * retry the current request in pio mode instead of risking tossing it
825 * all away
826 */
827static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
828{
829 ide_hwif_t *hwif = drive->hwif;
830 struct request *rq;
831 ide_startstop_t ret = ide_stopped;
832
833 /*
834 * end current dma transaction
835 */
836
837 if (error < 0) {
838 printk(KERN_WARNING "%s: DMA timeout error\n", drive->name);
839 (void)hwif->dma_ops->dma_end(drive);
840 ret = ide_error(drive, "dma timeout error",
841 hwif->tp_ops->read_status(hwif));
842 } else {
843 printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name);
844 hwif->dma_ops->dma_timeout(drive);
845 }
846
847 /*
848 * disable dma for now, but remember that we did so because of
849 * a timeout -- we'll reenable after we finish this next request
850 * (or rather the first chunk of it) in pio.
851 */
852 drive->dev_flags |= IDE_DFLAG_DMA_PIO_RETRY;
853 drive->retry_pio++;
854 ide_dma_off_quietly(drive);
855
856 /*
857 * un-busy drive etc and make sure request is sane
858 */
859
860 rq = hwif->rq;
861 if (!rq)
862 goto out;
863
864 hwif->rq = NULL;
865
866 rq->errors = 0;
867
868 if (!rq->bio)
869 goto out;
870
871 rq->sector = rq->bio->bi_sector;
872 rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9;
873 rq->hard_cur_sectors = rq->current_nr_sectors;
874 rq->buffer = bio_data(rq->bio);
875out:
876 return ret;
877}
878
879static void ide_plug_device(ide_drive_t *drive) 822static void ide_plug_device(ide_drive_t *drive)
880{ 823{
881 struct request_queue *q = drive->queue; 824 struct request_queue *q = drive->queue;