]> git.hungrycats.org Git - linux/commitdiff
[PATCH] make __ide_dma_off() generic and remove ide_hwif_t->ide_dma_off
authorBartlomiej Zolnierkiewicz <b.zolnierkiewicz@elka.pw.edu.pl>
Mon, 16 Feb 2004 05:47:11 +0000 (21:47 -0800)
committerLinus Torvalds <torvalds@evo.osdl.org>
Mon, 16 Feb 2004 05:47:11 +0000 (21:47 -0800)
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
drivers/ide/ide-cd.c
drivers/ide/ide-dma.c
drivers/ide/ide-floppy.c
drivers/ide/ide-iops.c
drivers/ide/ide-tape.c
drivers/ide/ide.c
drivers/ide/pci/sgiioc4.c
drivers/ide/pci/sl82c105.c
drivers/ide/ppc/pmac.c
include/linux/ide.h

index 3d8cdcaa3a36de72d4e1d1b45bf76f9ec93ee59f..1f269427c4372d541ecec759d076462db8f83311 100644 (file)
@@ -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;
index 5e9e87eb5a37b0ee99bb9d80300681ac714ef095..c2e031718cd74a6a73fd7790279a98940b3f31e4 100644 (file)
@@ -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);
                }
        }
 
index 2048af2952cf6d96257ed1111b2a5ea6ef13bae4..c026658a5a27e83e2d290f9c2675ff17eec7eaa4 100644 (file)
@@ -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)
index 68b31092e17015ef335393f7ddf1ac73fb147007..6a2b432474226a186a37375e237d0a66691299ba 100644 (file)
@@ -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;
 
index 296da725a4869cf50390d008cebf516ad69c3f13..0e5c935d82cc3e81d5aaa95bbce5ff6dad5c0b59 100644 (file)
@@ -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);
        }
 }
 
index ad976e3f052a484259590488d1effa4df987328e..05ec90d9401e3a9b0a119032aa463c01192ec7fb 100644 (file)
@@ -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))
index 8054a12c17ec0b3ed6754837f67a4cd11df5cc13..c16afef3fc5be22c912ba479f2687f4234161f69 100644 (file)
@@ -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;
 }
index 1466a3de8ec7c9d94b3dd9d8beef72bb49cbb1c6..ca83a22c02019b87d9fc37e838c2380a7fd39a86 100644 (file)
@@ -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;
index 6fa7df358617744ae52eafb09182fb7afd771a0e..9556c5197065fb7eff564d652ca5a6688f673ec3 100644 (file)
@@ -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;
index bf4f9bcd66ba9a4604f571ce1b82ac2d91c38737..4668cfbeb8e4d04cdfb2b06046083a3fc2380b25 100644 (file)
@@ -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;
index 69db00c97a669d63efee3d440750627d37aab2ab..92c7daf0a896ccbd67cc7510e78af1c924f08472 100644 (file)
@@ -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 *);