]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-park.c
ide: fix ide_port_scan() to do ACPI setup after initializing request queues
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-park.c
index 63d01c55f865504fa06b9562acf7021b4bb3c8ae..c875a957596c56f2b505cb272005028f57574922 100644 (file)
@@ -7,28 +7,31 @@ DECLARE_WAIT_QUEUE_HEAD(ide_park_wq);
 
 static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
 {
-       ide_hwgroup_t *hwgroup = drive->hwif->hwgroup;
+       ide_hwif_t *hwif = drive->hwif;
        struct request_queue *q = drive->queue;
        struct request *rq;
        int rc;
 
        timeout += jiffies;
-       spin_lock_irq(&hwgroup->lock);
+       spin_lock_irq(&hwif->lock);
        if (drive->dev_flags & IDE_DFLAG_PARKED) {
                int reset_timer = time_before(timeout, drive->sleep);
+               int start_queue = 0;
 
                drive->sleep = timeout;
                wake_up_all(&ide_park_wq);
-               if (reset_timer && hwgroup->sleeping &&
-                   del_timer(&hwgroup->timer)) {
-                       hwgroup->sleeping = 0;
-                       hwgroup->busy = 0;
+               if (reset_timer && del_timer(&hwif->timer))
+                       start_queue = 1;
+               spin_unlock_irq(&hwif->lock);
+
+               if (start_queue) {
+                       spin_lock_irq(q->queue_lock);
                        blk_start_queueing(q);
+                       spin_unlock_irq(q->queue_lock);
                }
-               spin_unlock_irq(&hwgroup->lock);
                return;
        }
-       spin_unlock_irq(&hwgroup->lock);
+       spin_unlock_irq(&hwif->lock);
 
        rq = blk_get_request(q, READ, __GFP_WAIT);
        rq->cmd[0] = REQ_PARK_HEADS;
@@ -61,21 +64,21 @@ ssize_t ide_park_show(struct device *dev, struct device_attribute *attr,
                      char *buf)
 {
        ide_drive_t *drive = to_ide_device(dev);
-       ide_hwgroup_t *hwgroup = drive->hwif->hwgroup;
+       ide_hwif_t *hwif = drive->hwif;
        unsigned long now;
        unsigned int msecs;
 
        if (drive->dev_flags & IDE_DFLAG_NO_UNLOAD)
                return -EOPNOTSUPP;
 
-       spin_lock_irq(&hwgroup->lock);
+       spin_lock_irq(&hwif->lock);
        now = jiffies;
        if (drive->dev_flags & IDE_DFLAG_PARKED &&
            time_after(drive->sleep, now))
                msecs = jiffies_to_msecs(drive->sleep - now);
        else
                msecs = 0;
-       spin_unlock_irq(&hwgroup->lock);
+       spin_unlock_irq(&hwif->lock);
 
        return snprintf(buf, 20, "%u\n", msecs);
 }