]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide.c
ide: make void and rename ide_dma_lostirq() method
[linux-2.6-omap-h63xx.git] / drivers / ide / ide.c
index 614c5fd43cd277025fe330944678520a3bbea4c8..8a8674d3223fda1d20847d610591f12a44b5800c 100644 (file)
@@ -168,12 +168,11 @@ static const u8 ide_hwif_to_major[] = { IDE0_MAJOR, IDE1_MAJOR,
 
 static int idebus_parameter;   /* holds the "idebus=" parameter */
 static int system_bus_speed;   /* holds what we think is VESA/PCI bus speed */
-static int initializing;       /* set while initializing built-in drivers */
 
 DECLARE_MUTEX(ide_cfg_sem);
  __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock);
 
-#ifdef CONFIG_BLK_DEV_IDEPCI
+#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
 static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
 #endif
 
@@ -302,9 +301,7 @@ static void __init init_ide_data (void)
 #endif
        }
 #ifdef CONFIG_IDE_ARM
-       initializing = 1;
        ide_arm_init();
-       initializing = 0;
 #endif
 }
 
@@ -350,10 +347,6 @@ static int ide_system_bus_speed(void)
        return system_bus_speed;
 }
 
-#ifdef CONFIG_IDE_PROC_FS
-struct proc_dir_entry *proc_ide_root;
-#endif
-
 static struct resource* hwif_request_region(ide_hwif_t *hwif,
                                            unsigned long addr, int num)
 {
@@ -503,7 +496,7 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
        hwif->ide_dma_clear_irq         = tmp_hwif->ide_dma_clear_irq;
        hwif->dma_host_on               = tmp_hwif->dma_host_on;
        hwif->dma_host_off              = tmp_hwif->dma_host_off;
-       hwif->ide_dma_lostirq           = tmp_hwif->ide_dma_lostirq;
+       hwif->dma_lost_irq              = tmp_hwif->dma_lost_irq;
        hwif->ide_dma_timeout           = tmp_hwif->ide_dma_timeout;
 
        hwif->OUTB                      = tmp_hwif->OUTB;
@@ -597,7 +590,7 @@ void ide_unregister(unsigned int index)
 
        spin_unlock_irq(&ide_lock);
 
-       destroy_proc_ide_interface(hwif);
+       ide_proc_unregister_port(hwif);
 
        hwgroup = hwif->hwgroup;
        /*
@@ -749,6 +742,7 @@ void ide_setup_ports (      hw_regs_t *hw,
 /**
  *     ide_register_hw_with_fixup      -       register IDE interface
  *     @hw: hardware registers
+ *     @initializing: set while initializing built-in drivers
  *     @hwifp: pointer to returned hwif
  *     @fixup: fixup function
  *
@@ -758,7 +752,9 @@ void ide_setup_ports (      hw_regs_t *hw,
  *     Returns -1 on error.
  */
 
-int ide_register_hw_with_fixup(hw_regs_t *hw, ide_hwif_t **hwifp, void(*fixup)(ide_hwif_t *hwif))
+int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing,
+                              ide_hwif_t **hwifp,
+                              void(*fixup)(ide_hwif_t *hwif))
 {
        int index, retry = 1;
        ide_hwif_t *hwif;
@@ -799,7 +795,7 @@ found:
 
        if (!initializing) {
                probe_hwif_init_with_fixup(hwif, fixup);
-               create_proc_ide_interfaces();
+               ide_proc_register_port(hwif);
        }
 
        if (hwifp)
@@ -810,9 +806,9 @@ found:
 
 EXPORT_SYMBOL(ide_register_hw_with_fixup);
 
-int ide_register_hw(hw_regs_t *hw, ide_hwif_t **hwifp)
+int ide_register_hw(hw_regs_t *hw, int initializing, ide_hwif_t **hwifp)
 {
-       return ide_register_hw_with_fixup(hw, hwifp, NULL);
+       return ide_register_hw_with_fixup(hw, initializing, hwifp, NULL);
 }
 
 EXPORT_SYMBOL(ide_register_hw);
@@ -914,6 +910,7 @@ int set_using_dma(ide_drive_t *drive, int arg)
        err = 0;
 
        if (arg) {
+               hwif->dma_off_quietly(drive);
                if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
                        err = -EIO;
        } else
@@ -1016,6 +1013,7 @@ static int generic_ide_resume(struct device *dev)
        struct request rq;
        struct request_pm_state rqpm;
        ide_task_t args;
+       int err;
 
        /* Call ACPI _STM only once */
        if (!(drive->dn % 2))
@@ -1032,7 +1030,16 @@ static int generic_ide_resume(struct device *dev)
        rqpm.pm_step = ide_pm_state_start_resume;
        rqpm.pm_state = PM_EVENT_ON;
 
-       return ide_do_drive_cmd(drive, &rq, ide_head_wait);
+       err = ide_do_drive_cmd(drive, &rq, ide_head_wait);
+
+       if (err == 0 && dev->driver) {
+               ide_driver_t *drv = to_ide_driver(dev->driver);
+
+               if (drv->resume)
+                       drv->resume(drive);
+       }
+
+       return err;
 }
 
 int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev,
@@ -1108,7 +1115,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
                        ide_init_hwif_ports(&hw, (unsigned long) args[0],
                                            (unsigned long) args[1], NULL);
                        hw.irq = args[2];
-                       if (ide_register_hw(&hw, NULL) == -1)
+                       if (ide_register_hw(&hw, 0, NULL) == -1)
                                return -EIO;
                        return 0;
                }
@@ -1337,13 +1344,13 @@ static int __init ide_setup(char *s)
                return 1;
        }
 
-#ifdef CONFIG_BLK_DEV_IDEPCI
+#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
        if (!strcmp(s, "ide=reverse")) {
                ide_scan_direction = 1;
                printk(" : Enabled support for IDE inverse scan order.\n");
                return 1;
        }
-#endif /* CONFIG_BLK_DEV_IDEPCI */
+#endif
 
 #ifdef CONFIG_BLK_DEV_IDEACPI
        if (!strcmp(s, "ide=noacpi")) {
@@ -1603,9 +1610,9 @@ extern void __init h8300_ide_init(void);
  */
 static void __init probe_for_hwifs (void)
 {
-#ifdef CONFIG_BLK_DEV_IDEPCI
+#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
        ide_scan_pcibus(ide_scan_direction);
-#endif /* CONFIG_BLK_DEV_IDEPCI */
+#endif
 
 #ifdef CONFIG_ETRAX_IDE
        {
@@ -1794,9 +1801,7 @@ static int __init ide_init(void)
 
        init_ide_data();
 
-#ifdef CONFIG_IDE_PROC_FS
-       proc_ide_root = proc_mkdir("ide", NULL);
-#endif
+       proc_ide_create();
 
 #ifdef CONFIG_BLK_DEV_ALI14XX
        if (probe_ali14xx)
@@ -1819,12 +1824,8 @@ static int __init ide_init(void)
                (void)qd65xx_init();
 #endif
 
-       initializing = 1;
        /* Probe for special PCI and other "known" interface chipsets. */
        probe_for_hwifs();
-       initializing = 0;
-
-       proc_ide_create();
 
        return 0;
 }