genirq: fix off by one and coding style
authorIngo Molnar <mingo@elte.hu>
Tue, 21 Oct 2008 13:49:59 +0000 (15:49 +0200)
committerIngo Molnar <mingo@elte.hu>
Tue, 21 Oct 2008 13:54:40 +0000 (15:54 +0200)
Fix off-by-one in for_each_irq_desc_reverse().

Impact is near zero in practice, because nothing substantial wants to
iterate down to IRQ#0 - but fix it nevertheless.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/irq.c
include/linux/irqnr.h

index ccf6c503fc3bc48534b52f16de2c2f3217415adc..d1d4dc52f649cdd90f360d042b1055d7694f4e59 100644 (file)
@@ -36,7 +36,7 @@ void ack_bad_irq(unsigned int irq)
 }
 
 #ifdef CONFIG_X86_32
-# define irq_stats(x)          (&per_cpu(irq_stat,x))
+# define irq_stats(x)          (&per_cpu(irq_stat, x))
 #else
 # define irq_stats(x)          cpu_pda(x)
 #endif
@@ -113,7 +113,7 @@ int show_interrupts(struct seq_file *p, void *v)
        if (i == 0) {
                seq_printf(p, "           ");
                for_each_online_cpu(j)
-                       seq_printf(p, "CPU%-8d",j);
+                       seq_printf(p, "CPU%-8d", j);
                seq_putc(p, '\n');
        }
 
index 3171ddc3b39d1dc4aed7f8bfa2da210addea8c3c..452c280c8115525c2c294bebb3104bd6e06645a9 100644 (file)
@@ -13,9 +13,9 @@ extern int nr_irqs;
 # define for_each_irq_desc(irq, desc)          \
        for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++)
 
-# define for_each_irq_desc_reverse(irq, desc)                  \
-       for (irq = nr_irqs -1, desc = irq_desc + (nr_irqs -1 ); \
-            irq > 0; irq--, desc--)
+# define for_each_irq_desc_reverse(irq, desc)                          \
+       for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1);        \
+            irq >= 0; irq--, desc--)
 #endif
 
 #define for_each_irq_nr(irq)                   \