Commit e00585bb authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

irq: fix irqpoll && sparseirq

Steven Noonan reported a boot hang when using irqpoll and
CONFIG_HAVE_SPARSE_IRQ=y.

The irqpoll loop needs to be updated to not iterate from 1 to nr_irqs
but to iterate via for_each_irq_desc(). (in the former case desc can
be NULL which crashes the box)
Reported-by: default avatarSteven Noonan <steven@uplinklabs.net>
Tested-by: default avatarSteven Noonan <steven@uplinklabs.net>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 56ffa1a0
...@@ -90,14 +90,15 @@ static int misrouted_irq(int irq) ...@@ -90,14 +90,15 @@ static int misrouted_irq(int irq)
{ {
int i; int i;
int ok = 0; int ok = 0;
struct irq_desc *desc;
for (i = 1; i < nr_irqs; i++) { for_each_irq_desc(i, desc) {
struct irq_desc *desc; if (!i)
continue;
if (i == irq) /* Already tried */ if (i == irq) /* Already tried */
continue; continue;
desc = irq_to_desc(i);
if (try_one_irq(i, desc)) if (try_one_irq(i, desc))
ok = 1; ok = 1;
} }
...@@ -108,10 +109,14 @@ static int misrouted_irq(int irq) ...@@ -108,10 +109,14 @@ static int misrouted_irq(int irq)
static void poll_spurious_irqs(unsigned long dummy) static void poll_spurious_irqs(unsigned long dummy)
{ {
int i; int i;
for (i = 1; i < nr_irqs; i++) { struct irq_desc *desc;
struct irq_desc *desc = irq_to_desc(i);
for_each_irq_desc(i, desc) {
unsigned int status; unsigned int status;
if (!i)
continue;
/* Racy but it doesn't matter */ /* Racy but it doesn't matter */
status = desc->status; status = desc->status;
barrier(); barrier();
...@@ -278,7 +283,7 @@ static int __init irqfixup_setup(char *str) ...@@ -278,7 +283,7 @@ static int __init irqfixup_setup(char *str)
__setup("irqfixup", irqfixup_setup); __setup("irqfixup", irqfixup_setup);
module_param(irqfixup, int, 0644); module_param(irqfixup, int, 0644);
MODULE_PARM_DESC("irqfixup", "0: No fixup, 1: irqfixup mode 2: irqpoll mode"); MODULE_PARM_DESC("irqfixup", "0: No fixup, 1: irqfixup mode, 2: irqpoll mode");
static int __init irqpoll_setup(char *str) static int __init irqpoll_setup(char *str)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment