From d9bb5003c00674349b76dc26fc0b4778f08604da Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sun, 15 Feb 2004 21:47:11 -0800 Subject: [PATCH] [PATCH] make __ide_dma_off() generic and remove ide_hwif_t->ide_dma_off Move ide-dma.c:__ide_dma_off() outside of #ifdef CONFIG_BLK_DEV_IDEDMA_PCI, so it can be used for all DMA capable hosts. Remove ide_hwif_t->ide_dma_off. --- drivers/ide/arm/icside.c | 7 ------- drivers/ide/ide-cd.c | 6 +++--- drivers/ide/ide-dma.c | 14 +++++++------- drivers/ide/ide-floppy.c | 4 ++-- drivers/ide/ide-iops.c | 2 +- drivers/ide/ide-tape.c | 4 ++-- drivers/ide/ide.c | 4 ++-- drivers/ide/pci/sgiioc4.c | 9 --------- drivers/ide/pci/sl82c105.c | 17 ----------------- drivers/ide/ppc/pmac.c | 1 - include/linux/ide.h | 4 +--- 11 files changed, 18 insertions(+), 54 deletions(-) diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 3d8cdcaa3a36d..1f269427c4372 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -341,12 +341,6 @@ static int icside_dma_off_quietly(ide_drive_t *drive) return icside_dma_host_off(drive); } -static int icside_dma_off(ide_drive_t *drive) -{ - printk("%s: DMA disabled\n", drive->name); - return icside_dma_off_quietly(drive); -} - static int icside_dma_host_on(ide_drive_t *drive) { return 0; @@ -643,7 +637,6 @@ static int icside_dma_init(ide_hwif_t *hwif) hwif->ide_dma_check = icside_dma_check; hwif->ide_dma_host_off = icside_dma_host_off; hwif->ide_dma_off_quietly = icside_dma_off_quietly; - hwif->ide_dma_off = icside_dma_off; hwif->ide_dma_host_on = icside_dma_host_on; hwif->ide_dma_on = icside_dma_on; hwif->ide_dma_read = icside_dma_read; diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 5e9e87eb5a37b..c2e031718cd74 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1101,7 +1101,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive) if (dma) { info->dma = 0; if ((dma_error = HWIF(drive)->ide_dma_end(drive))) - HWIF(drive)->ide_dma_off(drive); + __ide_dma_off(drive); } if (cdrom_decode_status(drive, 0, &stat)) @@ -1720,7 +1720,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) if (dma) { if (dma_error) { printk("ide-cd: dma error\n"); - HWIF(drive)->ide_dma_off(drive); + __ide_dma_off(drive); return DRIVER(drive)->error(drive, "dma error", stat); } @@ -1847,7 +1847,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) info->dma = 0; if ((dma_error = HWIF(drive)->ide_dma_end(drive))) { printk("ide-cd: write dma error\n"); - HWIF(drive)->ide_dma_off(drive); + __ide_dma_off(drive); } } diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 2048af2952cf6..c026658a5a27e 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -414,7 +414,7 @@ static int config_drive_for_dma (ide_drive_t *drive) if ((id->capability & 1) && hwif->autodma) { /* Consult the list of known "bad" drives */ if (__ide_dma_bad_drive(drive)) - return hwif->ide_dma_off(drive); + return __ide_dma_off(drive); /* * Enable DMA on any drive that has @@ -520,13 +520,14 @@ int __ide_dma_off_quietly (ide_drive_t *drive) } EXPORT_SYMBOL(__ide_dma_off_quietly); +#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ /** - * __ide_dma_host_off - Generic DMA kill - * @drive: drive to control + * __ide_dma_off - disable DMA on a device + * @drive: drive to disable DMA on * - * Turn off the current DMA on this IDE controller. Inform the - * user that DMA has been disabled. + * Disable IDE DMA for a device on this IDE controller. + * Inform the user that DMA has been disabled. */ int __ide_dma_off (ide_drive_t *drive) @@ -537,6 +538,7 @@ int __ide_dma_off (ide_drive_t *drive) EXPORT_SYMBOL(__ide_dma_off); +#ifdef CONFIG_BLK_DEV_IDEDMA_PCI /** * __ide_dma_host_on - Enable DMA on a host * @drive: drive to enable for DMA @@ -1049,8 +1051,6 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p if (!(hwif->dma_prdtable)) hwif->dma_prdtable = (hwif->dma_base + 4); - if (!hwif->ide_dma_off) - hwif->ide_dma_off = &__ide_dma_off; if (!hwif->ide_dma_off_quietly) hwif->ide_dma_off_quietly = &__ide_dma_off_quietly; if (!hwif->ide_dma_host_off) diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 68b31092e1701..6a2b432474226 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -830,7 +830,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) if (test_and_clear_bit(PC_DMA_IN_PROGRESS, &pc->flags)) { printk(KERN_ERR "ide-floppy: The floppy wants to issue " "more interrupts in DMA mode\n"); - (void) HWIF(drive)->ide_dma_off(drive); + (void)__ide_dma_off(drive); return ide_do_reset(drive); } @@ -1045,7 +1045,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p bcount.all = min(pc->request_transfer, 63 * 1024); if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) { - (void) HWIF(drive)->ide_dma_off(drive); + (void)__ide_dma_off(drive); } feature.all = 0; diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 296da725a4869..0e5c935d82cc3 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -1133,7 +1133,7 @@ void check_dma_crc (ide_drive_t *drive) if (drive->current_speed >= XFER_SW_DMA_0) (void) HWIF(drive)->ide_dma_on(drive); } else { - (void) HWIF(drive)->ide_dma_off(drive); + (void)__ide_dma_off(drive); } } diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index ad976e3f052a4..05ec90d9401e3 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -2198,7 +2198,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) printk(KERN_ERR "ide-tape: The tape wants to issue more " "interrupts in DMA mode\n"); printk(KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n"); - (void) HWIF(drive)->ide_dma_off(drive); + (void)__ide_dma_off(drive); return ide_do_reset(drive); } /* Get the number of bytes to transfer on this interrupt. */ @@ -2411,7 +2411,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) { printk(KERN_WARNING "ide-tape: DMA disabled, " "reverting to PIO\n"); - (void) HWIF(drive)->ide_dma_off(drive); + (void)__ide_dma_off(drive); } if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) { if (test_bit(PC_WRITING, &pc->flags)) diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 8054a12c17ec0..c16afef3fc5be 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -839,7 +839,6 @@ void ide_unregister (unsigned int index) hwif->ide_dma_end = old_hwif.ide_dma_end; hwif->ide_dma_check = old_hwif.ide_dma_check; hwif->ide_dma_on = old_hwif.ide_dma_on; - hwif->ide_dma_off = old_hwif.ide_dma_off; hwif->ide_dma_off_quietly = old_hwif.ide_dma_off_quietly; hwif->ide_dma_test_irq = old_hwif.ide_dma_test_irq; hwif->ide_dma_host_on = old_hwif.ide_dma_host_on; @@ -1329,7 +1328,8 @@ static int set_using_dma (ide_drive_t *drive, int arg) if (HWIF(drive)->ide_dma_check(drive)) return -EIO; if (HWIF(drive)->ide_dma_on(drive)) return -EIO; } else { - if (HWIF(drive)->ide_dma_off(drive)) return -EIO; + if (__ide_dma_off(drive)) + return -EIO; } return 0; } diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 1466a3de8ec7c..ca83a22c02019 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -302,14 +302,6 @@ sgiioc4_ide_dma_on(ide_drive_t * drive) return HWIF(drive)->ide_dma_host_on(drive); } -static int -sgiioc4_ide_dma_off(ide_drive_t * drive) -{ - printk(KERN_INFO "%s: DMA disabled\n", drive->name); - - return HWIF(drive)->ide_dma_off_quietly(drive); -} - static int sgiioc4_ide_dma_off_quietly(ide_drive_t * drive) { @@ -644,7 +636,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif) hwif->ide_dma_end = &sgiioc4_ide_dma_end; hwif->ide_dma_check = &sgiioc4_ide_dma_check; hwif->ide_dma_on = &sgiioc4_ide_dma_on; - hwif->ide_dma_off = &sgiioc4_ide_dma_off; hwif->ide_dma_off_quietly = &sgiioc4_ide_dma_off_quietly; hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq; hwif->ide_dma_host_on = &sgiioc4_ide_dma_host_on; diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 6fa7df3586177..9556c5197065f 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -272,22 +272,6 @@ static int sl82c105_ide_dma_on (ide_drive_t *drive) return __ide_dma_on(drive); } -static int sl82c105_ide_dma_off (ide_drive_t *drive) -{ - u8 speed = XFER_PIO_0; - int rc; - - DBG(("sl82c105_ide_dma_off(drive:%s)\n", drive->name)); - - rc = __ide_dma_off(drive); - if (drive->pio_speed) - speed = drive->pio_speed - XFER_PIO_0; - config_for_pio(drive, speed, 0, 1); - drive->current_speed = drive->pio_speed; - - return rc; -} - static int sl82c105_ide_dma_off_quietly (ide_drive_t *drive) { u8 speed = XFER_PIO_0; @@ -485,7 +469,6 @@ static void __init init_hwif_sl82c105(ide_hwif_t *hwif) #ifdef CONFIG_BLK_DEV_IDEDMA hwif->ide_dma_check = &sl82c105_check_drive; hwif->ide_dma_on = &sl82c105_ide_dma_on; - hwif->ide_dma_off = &sl82c105_ide_dma_off; hwif->ide_dma_off_quietly = &sl82c105_ide_dma_off_quietly; hwif->ide_dma_lostirq = &sl82c105_ide_dma_lost_irq; hwif->ide_dma_begin = &sl82c105_ide_dma_begin; diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index bf4f9bcd66ba9..4668cfbeb8e4d 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -2153,7 +2153,6 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) pmif->dma_table_cpu, pmif->dma_table_dma); return; } - hwif->ide_dma_off = &__ide_dma_off; hwif->ide_dma_off_quietly = &__ide_dma_off_quietly; hwif->ide_dma_on = &__ide_dma_on; hwif->ide_dma_check = &pmac_ide_dma_check; diff --git a/include/linux/ide.h b/include/linux/ide.h index 69db00c97a669..92c7daf0a896c 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -790,7 +790,6 @@ typedef struct ide_dma_ops_s { int (*ide_dma_end)(ide_drive_t *drive); int (*ide_dma_check)(ide_drive_t *drive); int (*ide_dma_on)(ide_drive_t *drive); - int (*ide_dma_off)(ide_drive_t *drive); int (*ide_dma_off_quietly)(ide_drive_t *drive); int (*ide_dma_test_irq)(ide_drive_t *drive); int (*ide_dma_host_on)(ide_drive_t *drive); @@ -926,7 +925,6 @@ typedef struct hwif_s { int (*ide_dma_end)(ide_drive_t *drive); int (*ide_dma_check)(ide_drive_t *drive); int (*ide_dma_on)(ide_drive_t *drive); - int (*ide_dma_off)(ide_drive_t *drive); int (*ide_dma_off_quietly)(ide_drive_t *drive); int (*ide_dma_test_irq)(ide_drive_t *drive); int (*ide_dma_host_on)(ide_drive_t *drive); @@ -1594,6 +1592,7 @@ extern void ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_de #ifdef CONFIG_BLK_DEV_IDEDMA int __ide_dma_bad_drive(ide_drive_t *); int __ide_dma_good_drive(ide_drive_t *); +int __ide_dma_off(ide_drive_t *); #ifdef CONFIG_BLK_DEV_IDEDMA_PCI extern int ide_build_sglist(ide_drive_t *, struct request *); @@ -1607,7 +1606,6 @@ extern int ide_start_dma(ide_hwif_t *, ide_drive_t *, int); extern int __ide_dma_host_off(ide_drive_t *); extern int __ide_dma_off_quietly(ide_drive_t *); -extern int __ide_dma_off(ide_drive_t *); extern int __ide_dma_host_on(ide_drive_t *); extern int __ide_dma_on(ide_drive_t *); extern int __ide_dma_check(ide_drive_t *); -- 2.53.0