aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 11:20:48 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 11:20:48 -0500
commitae86afaee6a1c77c7a06d81dcc3bf872204d3bec (patch)
tree992b5b436de3033c23c3dc6cd7ded617a4603eed /drivers/ide/ide-io.c
parentbd53cbcce501b61921a1af2dddfa87c5b9923dfd (diff)
ide: use per-port IRQ handlers
Use hwif instead of hwgroup as {request,free}_irq()'s cookie, teach ide_intr() to return early for non-active serialized ports, modify unexpected_intr() accordingly and then use per-port IRQ handlers instead of per-hwgroup ones. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c58
1 files changed, 23 insertions, 35 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 43bf43d802c3..1fc739f44154 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -723,7 +723,7 @@ void do_ide_request(struct request_queue *q)
723 spin_unlock_irq(q->queue_lock); 723 spin_unlock_irq(q->queue_lock);
724 spin_lock_irq(&hwgroup->lock); 724 spin_lock_irq(&hwgroup->lock);
725 725
726 if (!ide_lock_hwgroup(hwgroup)) { 726 if (!ide_lock_hwgroup(hwgroup, hwif)) {
727 ide_hwif_t *prev_port; 727 ide_hwif_t *prev_port;
728repeat: 728repeat:
729 prev_port = hwif->host->cur_port; 729 prev_port = hwif->host->cur_port;
@@ -1002,44 +1002,30 @@ void ide_timer_expiry (unsigned long data)
1002 * before completing the issuance of any new drive command, so we will not 1002 * before completing the issuance of any new drive command, so we will not
1003 * be accidentally invoked as a result of any valid command completion 1003 * be accidentally invoked as a result of any valid command completion
1004 * interrupt. 1004 * interrupt.
1005 *
1006 * Note that we must walk the entire hwgroup here. We know which hwif
1007 * is doing the current command, but we don't know which hwif burped
1008 * mysteriously.
1009 */ 1005 */
1010 1006
1011static void unexpected_intr(int irq, ide_hwif_t *hwif) 1007static void unexpected_intr(int irq, ide_hwif_t *hwif)
1012{ 1008{
1013 ide_hwgroup_t *hwgroup = hwif->hwgroup; 1009 u8 stat = hwif->tp_ops->read_status(hwif);
1014 u8 stat; 1010
1015 1011 if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) {
1016 /* 1012 /* Try to not flood the console with msgs */
1017 * handle the unexpected interrupt 1013 static unsigned long last_msgtime, count;
1018 */ 1014 ++count;
1019 do { 1015
1020 if (hwif->irq == irq) { 1016 if (time_after(jiffies, last_msgtime + HZ)) {
1021 stat = hwif->tp_ops->read_status(hwif); 1017 last_msgtime = jiffies;
1022 1018 printk(KERN_ERR "%s: unexpected interrupt, "
1023 if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) { 1019 "status=0x%02x, count=%ld\n",
1024 /* Try to not flood the console with msgs */ 1020 hwif->name, stat, count);
1025 static unsigned long last_msgtime, count;
1026 ++count;
1027 if (time_after(jiffies, last_msgtime + HZ)) {
1028 last_msgtime = jiffies;
1029 printk(KERN_ERR "%s%s: unexpected interrupt, "
1030 "status=0x%02x, count=%ld\n",
1031 hwif->name,
1032 (hwif->next==hwgroup->hwif) ? "" : "(?)", stat, count);
1033 }
1034 }
1035 } 1021 }
1036 } while ((hwif = hwif->next) != hwgroup->hwif); 1022 }
1037} 1023}
1038 1024
1039/** 1025/**
1040 * ide_intr - default IDE interrupt handler 1026 * ide_intr - default IDE interrupt handler
1041 * @irq: interrupt number 1027 * @irq: interrupt number
1042 * @dev_id: hwif group 1028 * @dev_id: hwif
1043 * @regs: unused weirdness from the kernel irq layer 1029 * @regs: unused weirdness from the kernel irq layer
1044 * 1030 *
1045 * This is the default IRQ handler for the IDE layer. You should 1031 * This is the default IRQ handler for the IDE layer. You should
@@ -1063,17 +1049,19 @@ static void unexpected_intr(int irq, ide_hwif_t *hwif)
1063 1049
1064irqreturn_t ide_intr (int irq, void *dev_id) 1050irqreturn_t ide_intr (int irq, void *dev_id)
1065{ 1051{
1066 unsigned long flags; 1052 ide_hwif_t *hwif = (ide_hwif_t *)dev_id;
1067 ide_hwgroup_t *hwgroup = (ide_hwgroup_t *)dev_id; 1053 ide_hwgroup_t *hwgroup = hwif->hwgroup;
1068 ide_hwif_t *hwif = hwgroup->hwif;
1069 ide_drive_t *uninitialized_var(drive); 1054 ide_drive_t *uninitialized_var(drive);
1070 ide_handler_t *handler; 1055 ide_handler_t *handler;
1056 unsigned long flags;
1071 ide_startstop_t startstop; 1057 ide_startstop_t startstop;
1072 irqreturn_t irq_ret = IRQ_NONE; 1058 irqreturn_t irq_ret = IRQ_NONE;
1073 int plug_device = 0; 1059 int plug_device = 0;
1074 1060
1075 if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) 1061 if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) {
1076 hwif = hwif->host->cur_port; 1062 if (hwif != hwif->host->cur_port)
1063 goto out_early;
1064 }
1077 1065
1078 spin_lock_irqsave(&hwgroup->lock, flags); 1066 spin_lock_irqsave(&hwgroup->lock, flags);
1079 1067
@@ -1172,7 +1160,7 @@ out_handled:
1172 irq_ret = IRQ_HANDLED; 1160 irq_ret = IRQ_HANDLED;
1173out: 1161out:
1174 spin_unlock_irqrestore(&hwgroup->lock, flags); 1162 spin_unlock_irqrestore(&hwgroup->lock, flags);
1175 1163out_early:
1176 if (plug_device) 1164 if (plug_device)
1177 ide_plug_device(drive); 1165 ide_plug_device(drive);
1178 1166