Pull ia64-mutex-primitives into release branch
[pandora-kernel.git] / drivers / ide / ide.c
index b069b13..b2cc437 100644 (file)
@@ -222,7 +222,7 @@ static void init_hwif_data(ide_hwif_t *hwif, unsigned int index)
        hwif->mwdma_mask = 0x80;        /* disable all mwdma */
        hwif->swdma_mask = 0x80;        /* disable all swdma */
 
-       sema_init(&hwif->gendev_rel_sem, 0);
+       init_completion(&hwif->gendev_rel_comp);
 
        default_hwif_iops(hwif);
        default_hwif_transport(hwif);
@@ -242,10 +242,9 @@ static void init_hwif_data(ide_hwif_t *hwif, unsigned int index)
                drive->name[2]                  = 'a' + (index * MAX_DRIVES) + unit;
                drive->max_failures             = IDE_DEFAULT_MAX_FAILURES;
                drive->using_dma                = 0;
-               drive->is_flash                 = 0;
                drive->vdma                     = 0;
                INIT_LIST_HEAD(&drive->list);
-               sema_init(&drive->gendev_rel_sem, 0);
+               init_completion(&drive->gendev_rel_comp);
        }
 }
 
@@ -602,7 +601,7 @@ void ide_unregister(unsigned int index)
                }
                spin_unlock_irq(&ide_lock);
                device_unregister(&drive->gendev);
-               down(&drive->gendev_rel_sem);
+               wait_for_completion(&drive->gendev_rel_comp);
                spin_lock_irq(&ide_lock);
        }
        hwif->present = 0;
@@ -662,7 +661,7 @@ void ide_unregister(unsigned int index)
        /* More messed up locking ... */
        spin_unlock_irq(&ide_lock);
        device_unregister(&hwif->gendev);
-       down(&hwif->gendev_rel_sem);
+       wait_for_completion(&hwif->gendev_rel_comp);
 
        /*
         * Remove us from the kernel's knowledge
@@ -1949,10 +1948,41 @@ static int ide_uevent(struct device *dev, char **envp, int num_envp,
        return 0;
 }
 
+static int generic_ide_probe(struct device *dev)
+{
+       ide_drive_t *drive = to_ide_device(dev);
+       ide_driver_t *drv = to_ide_driver(dev->driver);
+
+       return drv->probe ? drv->probe(drive) : -ENODEV;
+}
+
+static int generic_ide_remove(struct device *dev)
+{
+       ide_drive_t *drive = to_ide_device(dev);
+       ide_driver_t *drv = to_ide_driver(dev->driver);
+
+       if (drv->remove)
+               drv->remove(drive);
+
+       return 0;
+}
+
+static void generic_ide_shutdown(struct device *dev)
+{
+       ide_drive_t *drive = to_ide_device(dev);
+       ide_driver_t *drv = to_ide_driver(dev->driver);
+
+       if (dev->driver && drv->shutdown)
+               drv->shutdown(drive);
+}
+
 struct bus_type ide_bus_type = {
        .name           = "ide",
        .match          = ide_bus_match,
        .uevent         = ide_uevent,
+       .probe          = generic_ide_probe,
+       .remove         = generic_ide_remove,
+       .shutdown       = generic_ide_shutdown,
        .dev_attrs      = ide_dev_attrs,
        .suspend        = generic_ide_suspend,
        .resume         = generic_ide_resume,