]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-io.c
ide: use per-port IRQ handlers
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-io.c
index 1c36a8e83d36000b1585080093e40a28b6681963..1fc739f4415485d2894b7981a8fb5c94ca8236af 100644 (file)
@@ -723,8 +723,10 @@ void do_ide_request(struct request_queue *q)
        spin_unlock_irq(q->queue_lock);
        spin_lock_irq(&hwgroup->lock);
 
-       if (!ide_lock_hwgroup(hwgroup)) {
+       if (!ide_lock_hwgroup(hwgroup, hwif)) {
+               ide_hwif_t *prev_port;
 repeat:
+               prev_port = hwif->host->cur_port;
                hwgroup->rq = NULL;
 
                if (drive->dev_flags & IDE_DFLAG_SLEEPING) {
@@ -734,15 +736,17 @@ repeat:
                        }
                }
 
-               if (hwif != hwgroup->hwif) {
+               if ((hwif->host->host_flags & IDE_HFLAG_SERIALIZE) &&
+                   hwif != prev_port) {
                        /*
-                        * set nIEN for previous hwif, drives in the
+                        * set nIEN for previous port, drives in the
                         * quirk_list may not like intr setups/cleanups
                         */
-                       if (drive->quirk_list == 0)
-                               hwif->tp_ops->set_irq(hwif, 0);
+                       if (prev_port && hwgroup->drive->quirk_list == 0)
+                               prev_port->tp_ops->set_irq(prev_port, 0);
+
+                       hwif->host->cur_port = hwif;
                }
-               hwgroup->hwif = hwif;
                hwgroup->drive = drive;
                drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED);
 
@@ -974,7 +978,7 @@ void ide_timer_expiry (unsigned long data)
 /**
  *     unexpected_intr         -       handle an unexpected IDE interrupt
  *     @irq: interrupt line
- *     @hwgroup: hwgroup being processed
+ *     @hwif: port being processed
  *
  *     There's nothing really useful we can do with an unexpected interrupt,
  *     other than reading the status register (to clear it), and logging it.
@@ -998,51 +1002,37 @@ void ide_timer_expiry (unsigned long data)
  *     before completing the issuance of any new drive command, so we will not
  *     be accidentally invoked as a result of any valid command completion
  *     interrupt.
- *
- *     Note that we must walk the entire hwgroup here. We know which hwif
- *     is doing the current command, but we don't know which hwif burped
- *     mysteriously.
  */
-static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
-{
-       u8 stat;
-       ide_hwif_t *hwif = hwgroup->hwif;
 
-       /*
-        * handle the unexpected interrupt
-        */
-       do {
-               if (hwif->irq == irq) {
-                       stat = hwif->tp_ops->read_status(hwif);
-
-                       if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) {
-                               /* Try to not flood the console with msgs */
-                               static unsigned long last_msgtime, count;
-                               ++count;
-                               if (time_after(jiffies, last_msgtime + HZ)) {
-                                       last_msgtime = jiffies;
-                                       printk(KERN_ERR "%s%s: unexpected interrupt, "
-                                               "status=0x%02x, count=%ld\n",
-                                               hwif->name,
-                                               (hwif->next==hwgroup->hwif) ? "" : "(?)", stat, count);
-                               }
-                       }
+static void unexpected_intr(int irq, ide_hwif_t *hwif)
+{
+       u8 stat = hwif->tp_ops->read_status(hwif);
+
+       if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) {
+               /* Try to not flood the console with msgs */
+               static unsigned long last_msgtime, count;
+               ++count;
+
+               if (time_after(jiffies, last_msgtime + HZ)) {
+                       last_msgtime = jiffies;
+                       printk(KERN_ERR "%s: unexpected interrupt, "
+                               "status=0x%02x, count=%ld\n",
+                               hwif->name, stat, count);
                }
-       } while ((hwif = hwif->next) != hwgroup->hwif);
+       }
 }
 
 /**
  *     ide_intr        -       default IDE interrupt handler
  *     @irq: interrupt number
- *     @dev_id: hwif group
+ *     @dev_id: hwif
  *     @regs: unused weirdness from the kernel irq layer
  *
  *     This is the default IRQ handler for the IDE layer. You should
  *     not need to override it. If you do be aware it is subtle in
  *     places
  *
- *     hwgroup->hwif is the interface in the group currently performing
+ *     hwif is the interface in the group currently performing
  *     a command. hwgroup->drive is the drive and hwgroup->handler is
  *     the IRQ handler to call. As we issue a command the handlers
  *     step through multiple states, reassigning the handler to the
@@ -1059,15 +1049,20 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
  
 irqreturn_t ide_intr (int irq, void *dev_id)
 {
-       unsigned long flags;
-       ide_hwgroup_t *hwgroup = (ide_hwgroup_t *)dev_id;
-       ide_hwif_t *hwif = hwgroup->hwif;
+       ide_hwif_t *hwif = (ide_hwif_t *)dev_id;
+       ide_hwgroup_t *hwgroup = hwif->hwgroup;
        ide_drive_t *uninitialized_var(drive);
        ide_handler_t *handler;
+       unsigned long flags;
        ide_startstop_t startstop;
        irqreturn_t irq_ret = IRQ_NONE;
        int plug_device = 0;
 
+       if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) {
+               if (hwif != hwif->host->cur_port)
+                       goto out_early;
+       }
+
        spin_lock_irqsave(&hwgroup->lock, flags);
 
        if (!ide_ack_intr(hwif))
@@ -1097,7 +1092,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
                         * Probably not a shared PCI interrupt,
                         * so we can safely try to do something about it:
                         */
-                       unexpected_intr(irq, hwgroup);
+                       unexpected_intr(irq, hwif);
 #ifdef CONFIG_BLK_DEV_IDEPCI
                } else {
                        /*
@@ -1165,7 +1160,7 @@ out_handled:
        irq_ret = IRQ_HANDLED;
 out:
        spin_unlock_irqrestore(&hwgroup->lock, flags);
-
+out_early:
        if (plug_device)
                ide_plug_device(drive);
 
@@ -1197,7 +1192,6 @@ void ide_do_drive_cmd(ide_drive_t *drive, struct request *rq)
 
        spin_lock_irqsave(q->queue_lock, flags);
        __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0);
-       blk_start_queueing(q);
        spin_unlock_irqrestore(q->queue_lock, flags);
 }
 EXPORT_SYMBOL(ide_do_drive_cmd);