diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-02-02 16:41:27 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-03-28 10:55:11 -0400 |
commit | 6829310548a76d343205029bb41c14e75bf6a7fb (patch) | |
tree | a12c2f6d6fb9b25e6c289e463fa690d6bdbcb501 /arch/arm | |
parent | f9ba4475f95b135e6f68e74d59bba92fd35ca835 (diff) |
arm: Ns9xxx: Remove private irq flow handler
handle_prio_irq is almost identical with handle_fasteoi_irq. The
subtle differences are
1) The handler checks for IRQ_DISABLED after the device handler has
been called. In case it's set it masks the interrupt.
2) When the handler sees IRQ_DISABLED on entry it masks the interupt
in the same way as handle_fastoei_irq, but does not set the
IRQ_PENDING flag.
3) Instead of gracefully handling a recursive interrupt it crashes the
kernel.
#1 is just relevant when a device handler calls disable_irq_nosync()
and it does not matter whether we mask the interrupt right away or
not. We handle lazy masking for disable_irq anyway, so there is no
real reason to have this extra mask in place.
#2 will prevent the resend of a pending interrupt, which can result in
lost interrupts for edge type interrupts. For level type interrupts
the resend is a noop in the generic code. According to the
datasheet all interrupts are level type, so marking them as such
will result in the exact same behaviour as the private
handle_prio_irq implementation.
#3 is just stupid. Crashing the kernel instead of handling a problem
gracefully is just wrong. With the current semantics- all handlers
run with interrupts disabled - this is even more wrong.
Rename ack to eoi, remove the unused mask_ack, switch to
handle_fasteoi_irq and remove the private function.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Acked-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Cc: linux-arm-kernel@lists.infradead.org
LKML-Reference: <20110202212552.299898447@linutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-ns9xxx/irq.c | 58 |
1 files changed, 4 insertions, 54 deletions
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c index 389fa5c669de..bf0fd48cbd80 100644 --- a/arch/arm/mach-ns9xxx/irq.c +++ b/arch/arm/mach-ns9xxx/irq.c | |||
@@ -31,17 +31,11 @@ static void ns9xxx_mask_irq(struct irq_data *d) | |||
31 | __raw_writel(ic, SYS_IC(prio / 4)); | 31 | __raw_writel(ic, SYS_IC(prio / 4)); |
32 | } | 32 | } |
33 | 33 | ||
34 | static void ns9xxx_ack_irq(struct irq_data *d) | 34 | static void ns9xxx_eoi_irq(struct irq_data *d) |
35 | { | 35 | { |
36 | __raw_writel(0, SYS_ISRADDR); | 36 | __raw_writel(0, SYS_ISRADDR); |
37 | } | 37 | } |
38 | 38 | ||
39 | static void ns9xxx_maskack_irq(struct irq_data *d) | ||
40 | { | ||
41 | ns9xxx_mask_irq(d); | ||
42 | ns9xxx_ack_irq(d); | ||
43 | } | ||
44 | |||
45 | static void ns9xxx_unmask_irq(struct irq_data *d) | 39 | static void ns9xxx_unmask_irq(struct irq_data *d) |
46 | { | 40 | { |
47 | /* XXX: better use cpp symbols */ | 41 | /* XXX: better use cpp symbols */ |
@@ -52,56 +46,11 @@ static void ns9xxx_unmask_irq(struct irq_data *d) | |||
52 | } | 46 | } |
53 | 47 | ||
54 | static struct irq_chip ns9xxx_chip = { | 48 | static struct irq_chip ns9xxx_chip = { |
55 | .irq_ack = ns9xxx_ack_irq, | 49 | .irq_eoi = ns9xxx_eoi_irq, |
56 | .irq_mask = ns9xxx_mask_irq, | 50 | .irq_mask = ns9xxx_mask_irq, |
57 | .irq_mask_ack = ns9xxx_maskack_irq, | ||
58 | .irq_unmask = ns9xxx_unmask_irq, | 51 | .irq_unmask = ns9xxx_unmask_irq, |
59 | }; | 52 | }; |
60 | 53 | ||
61 | #if 0 | ||
62 | #define handle_irq handle_level_irq | ||
63 | #else | ||
64 | static void handle_prio_irq(unsigned int irq, struct irq_desc *desc) | ||
65 | { | ||
66 | struct irqaction *action; | ||
67 | irqreturn_t action_ret; | ||
68 | |||
69 | raw_spin_lock(&desc->lock); | ||
70 | |||
71 | BUG_ON(desc->status & IRQ_INPROGRESS); | ||
72 | |||
73 | desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); | ||
74 | kstat_incr_irqs_this_cpu(irq, desc); | ||
75 | |||
76 | action = desc->action; | ||
77 | if (unlikely(!action || (desc->status & IRQ_DISABLED))) | ||
78 | goto out_mask; | ||
79 | |||
80 | desc->status |= IRQ_INPROGRESS; | ||
81 | raw_spin_unlock(&desc->lock); | ||
82 | |||
83 | action_ret = handle_IRQ_event(irq, action); | ||
84 | |||
85 | /* XXX: There is no direct way to access noirqdebug, so check | ||
86 | * unconditionally for spurious irqs... | ||
87 | * Maybe this function should go to kernel/irq/chip.c? */ | ||
88 | note_interrupt(irq, desc, action_ret); | ||
89 | |||
90 | raw_spin_lock(&desc->lock); | ||
91 | desc->status &= ~IRQ_INPROGRESS; | ||
92 | |||
93 | if (desc->status & IRQ_DISABLED) | ||
94 | out_mask: | ||
95 | desc->irq_data.chip->irq_mask(&desc->irq_data); | ||
96 | |||
97 | /* ack unconditionally to unmask lower prio irqs */ | ||
98 | desc->irq_data.chip->irq_ack(&desc->irq_data); | ||
99 | |||
100 | raw_spin_unlock(&desc->lock); | ||
101 | } | ||
102 | #define handle_irq handle_prio_irq | ||
103 | #endif | ||
104 | |||
105 | void __init ns9xxx_init_irq(void) | 54 | void __init ns9xxx_init_irq(void) |
106 | { | 55 | { |
107 | int i; | 56 | int i; |
@@ -119,7 +68,8 @@ void __init ns9xxx_init_irq(void) | |||
119 | 68 | ||
120 | for (i = 0; i <= 31; ++i) { | 69 | for (i = 0; i <= 31; ++i) { |
121 | set_irq_chip(i, &ns9xxx_chip); | 70 | set_irq_chip(i, &ns9xxx_chip); |
122 | set_irq_handler(i, handle_irq); | 71 | set_irq_handler(i, handle_fasteoi_irq); |
123 | set_irq_flags(i, IRQF_VALID); | 72 | set_irq_flags(i, IRQF_VALID); |
73 | irq_set_status_flags(i, IRQ_LEVEL); | ||
124 | } | 74 | } |
125 | } | 75 | } |