]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'irq-fixes-for-linus-4' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 31 Dec 2008 17:00:59 +0000 (09:00 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 31 Dec 2008 17:00:59 +0000 (09:00 -0800)
* 'irq-fixes-for-linus-4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  sparseirq: move __weak symbols into separate compilation unit
  sparseirq: work around __weak alias bug
  sparseirq: fix hang with !SPARSE_IRQ
  sparseirq: set lock_class for legacy irq when sparse_irq is selected
  sparseirq: work around compiler optimizing away __weak functions
  sparseirq: fix desc->lock init
  sparseirq: do not printk when migrating IRQ descriptors
  sparseirq: remove duplicated arch_early_irq_init()
  irq: simplify for_each_irq_desc() usage
  proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
  irq: for_each_irq_desc() move to irqnr.h
  hrtimer: remove #include <linux/irq.h>

13 files changed:
arch/x86/kernel/io_apic.c
drivers/xen/events.c
fs/proc/stat.c
include/linux/interrupt.h
include/linux/irq.h
include/linux/irqnr.h
init/main.c
kernel/hrtimer.c
kernel/irq/autoprobe.c
kernel/irq/handle.c
kernel/irq/numa_migrate.c
kernel/irq/spurious.c
kernel/softirq.c

index f6ea94b74da146072cca138aa824ed5a3d5eeec7..74917658b004aea2eb08dca5c5c9ba8a775eb81e 100644 (file)
@@ -170,7 +170,7 @@ static struct irq_cfg irq_cfgx[NR_IRQS] = {
        [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, },
 };
 
-void __init arch_early_irq_init(void)
+int __init arch_early_irq_init(void)
 {
        struct irq_cfg *cfg;
        struct irq_desc *desc;
@@ -184,6 +184,8 @@ void __init arch_early_irq_init(void)
                desc = irq_to_desc(i);
                desc->chip_data = &cfg[i];
        }
+
+       return 0;
 }
 
 #ifdef CONFIG_SPARSE_IRQ
@@ -212,7 +214,7 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu)
        return cfg;
 }
 
-void arch_init_chip_data(struct irq_desc *desc, int cpu)
+int arch_init_chip_data(struct irq_desc *desc, int cpu)
 {
        struct irq_cfg *cfg;
 
@@ -224,6 +226,8 @@ void arch_init_chip_data(struct irq_desc *desc, int cpu)
                        BUG_ON(1);
                }
        }
+
+       return 0;
 }
 
 #ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
@@ -1345,8 +1349,6 @@ void __setup_vector_irq(int cpu)
 
        /* Mark the inuse vectors */
        for_each_irq_desc(irq, desc) {
-               if (!desc)
-                       continue;
                cfg = desc->chip_data;
                if (!cpu_isset(cpu, cfg->domain))
                        continue;
@@ -1730,8 +1732,6 @@ __apicdebuginit(void) print_IO_APIC(void)
        for_each_irq_desc(irq, desc) {
                struct irq_pin_list *entry;
 
-               if (!desc)
-                       continue;
                cfg = desc->chip_data;
                entry = cfg->irq_2_pin;
                if (!entry)
@@ -2378,9 +2378,6 @@ static void ir_irq_migration(struct work_struct *work)
        struct irq_desc *desc;
 
        for_each_irq_desc(irq, desc) {
-               if (!desc)
-                       continue;
-
                if (desc->status & IRQ_MOVE_PENDING) {
                        unsigned long flags;
 
@@ -2670,9 +2667,6 @@ static inline void init_IO_APIC_traps(void)
         * 0x80, because int 0x80 is hm, kind of importantish. ;)
         */
        for_each_irq_desc(irq, desc) {
-               if (!desc)
-                       continue;
-
                cfg = desc->chip_data;
                if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) {
                        /*
index 46625cd38743c2506e1fc024c8e1c4d434a4fa26..e26733a9df21d5ca583ad09bea26dfea909873da 100644 (file)
@@ -142,9 +142,6 @@ static void init_evtchn_cpu_bindings(void)
 
        /* By default all event channels notify CPU#0. */
        for_each_irq_desc(i, desc) {
-               if (!desc)
-                       continue;
-
                desc->affinity = cpumask_of_cpu(0);
        }
 #endif
index 3bb1cf1e742552ad2f97b6b6206474937ffb0f07..f75efa22df5ee39eba1e23f4998ed01567e35b8f 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/seq_file.h>
 #include <linux/slab.h>
 #include <linux/time.h>
+#include <linux/irqnr.h>
 #include <asm/cputime.h>
 
 #ifndef arch_irq_stat_cpu
@@ -45,10 +46,6 @@ static int show_stat(struct seq_file *p, void *v)
                steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
                guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
                for_each_irq_nr(j) {
-#ifdef CONFIG_SPARSE_IRQ
-                       if (!irq_to_desc(j))
-                               continue;
-#endif
                        sum += kstat_irqs_cpu(j, i);
                }
                sum += arch_irq_stat_cpu(i);
@@ -95,12 +92,6 @@ static int show_stat(struct seq_file *p, void *v)
        /* sum again ? it could be updated? */
        for_each_irq_nr(j) {
                per_irq_sum = 0;
-#ifdef CONFIG_SPARSE_IRQ
-               if (!irq_to_desc(j)) {
-                       seq_printf(p, " %u", per_irq_sum);
-                       continue;
-               }
-#endif
                for_each_possible_cpu(i)
                        per_irq_sum += kstat_irqs_cpu(j, i);
 
index be3c484b5242555082763718f4818eacdb37f020..8cc8ef47f5b63ac3f7460214bdebe346a9b0de7d 100644 (file)
@@ -464,4 +464,10 @@ static inline void init_irq_proc(void)
 
 int show_interrupts(struct seq_file *p, void *v);
 
+struct irq_desc;
+
+extern int early_irq_init(void);
+extern int arch_early_irq_init(void);
+extern int arch_init_chip_data(struct irq_desc *desc, int cpu);
+
 #endif
index 98564dc6447627f0d6c25033e3ba601db819daf1..d64a6d49bdef0c9d194db7bb555d6718de4a4157 100644 (file)
@@ -193,42 +193,23 @@ struct irq_desc {
        const char              *name;
 } ____cacheline_internodealigned_in_smp;
 
-extern void early_irq_init(void);
-extern void arch_early_irq_init(void);
-extern void arch_init_chip_data(struct irq_desc *desc, int cpu);
 extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
                                        struct irq_desc *desc, int cpu);
 extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);
 
 #ifndef CONFIG_SPARSE_IRQ
 extern struct irq_desc irq_desc[NR_IRQS];
-
-static inline struct irq_desc *irq_to_desc(unsigned int irq)
-{
-       return (irq < NR_IRQS) ? irq_desc + irq : NULL;
-}
-static inline struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
-{
-       return irq_to_desc(irq);
-}
-
-#else
-
-extern struct irq_desc *irq_to_desc(unsigned int irq);
-extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
+#else /* CONFIG_SPARSE_IRQ */
 extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);
 
-# define for_each_irq_desc(irq, desc)          \
-       for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq))
-# define for_each_irq_desc_reverse(irq, desc)                          \
-       for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq))
-
 #define kstat_irqs_this_cpu(DESC) \
        ((DESC)->kstat_irqs[smp_processor_id()])
 #define kstat_incr_irqs_this_cpu(irqno, DESC) \
        ((DESC)->kstat_irqs[smp_processor_id()]++)
 
-#endif
+#endif /* CONFIG_SPARSE_IRQ */
+
+extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
 
 static inline struct irq_desc *
 irq_remap_to_desc(unsigned int irq, struct irq_desc *desc)
index 95d2b74641f5dbe2ecb90bb68d430ab600d61b74..5504a5c97836d9fb4f1fb191cd6a11cdc131c22e 100644 (file)
 
 # define for_each_irq_desc_reverse(irq, desc)                          \
        for (irq = nr_irqs - 1; irq >= 0; irq--)
-#else
+#else /* CONFIG_GENERIC_HARDIRQS */
 
 extern int nr_irqs;
+extern struct irq_desc *irq_to_desc(unsigned int irq);
 
-#ifndef CONFIG_SPARSE_IRQ
+# define for_each_irq_desc(irq, desc)                                  \
+       for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs;           \
+            irq++, desc = irq_to_desc(irq))                            \
+               if (desc)
 
-struct irq_desc;
-# 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--)
-#endif
-#endif
+
+# define for_each_irq_desc_reverse(irq, desc)                          \
+       for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0;      \
+            irq--, desc = irq_to_desc(irq))                            \
+               if (desc)
+
+#endif /* CONFIG_GENERIC_HARDIRQS */
 
 #define for_each_irq_nr(irq)                   \
        for (irq = 0; irq < nr_irqs; irq++)
index 2a7ce0f8e45353af2204c017c1921afdd0ba5c91..f5e64f20d2b0f40bef664d3ffc2c1c11e384bdeb 100644 (file)
@@ -540,15 +540,6 @@ void __init __weak thread_info_cache_init(void)
 {
 }
 
-void __init __weak arch_early_irq_init(void)
-{
-}
-
-void __init __weak early_irq_init(void)
-{
-       arch_early_irq_init();
-}
-
 asmlinkage void __init start_kernel(void)
 {
        char * command_line;
index bda9cb92427673a4c2e47676596e854d57d7dca3..eb2bfefa6dcc5ac4f332b60af2e7d76f1f7de543 100644 (file)
@@ -32,7 +32,6 @@
  */
 
 #include <linux/cpu.h>
-#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/percpu.h>
 #include <linux/hrtimer.h>
index 650ce4102a6333d9ddf097692583e55659a25333..cc0f7321b8cede4192a4ceb9ffc97311ec9cc7d0 100644 (file)
@@ -40,9 +40,6 @@ unsigned long probe_irq_on(void)
         * flush such a longstanding irq before considering it as spurious.
         */
        for_each_irq_desc_reverse(i, desc) {
-               if (!desc)
-                       continue;
-
                spin_lock_irq(&desc->lock);
                if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
                        /*
@@ -71,9 +68,6 @@ unsigned long probe_irq_on(void)
         * happened in the previous stage, it may have masked itself)
         */
        for_each_irq_desc_reverse(i, desc) {
-               if (!desc)
-                       continue;
-
                spin_lock_irq(&desc->lock);
                if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
                        desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
@@ -92,9 +86,6 @@ unsigned long probe_irq_on(void)
         * Now filter out any obviously spurious interrupts
         */
        for_each_irq_desc(i, desc) {
-               if (!desc)
-                       continue;
-
                spin_lock_irq(&desc->lock);
                status = desc->status;
 
@@ -133,9 +124,6 @@ unsigned int probe_irq_mask(unsigned long val)
        int i;
 
        for_each_irq_desc(i, desc) {
-               if (!desc)
-                       continue;
-
                spin_lock_irq(&desc->lock);
                status = desc->status;
 
@@ -178,9 +166,6 @@ int probe_irq_off(unsigned long val)
        unsigned int status;
 
        for_each_irq_desc(i, desc) {
-               if (!desc)
-                       continue;
-
                spin_lock_irq(&desc->lock);
                status = desc->status;
 
index 6492400cb50dfb0659a9627dcc342485a5a21021..c20db0be9173969a52c7ab75341cc8171db63d46 100644 (file)
@@ -56,10 +56,6 @@ void handle_bad_irq(unsigned int irq, struct irq_desc *desc)
 int nr_irqs = NR_IRQS;
 EXPORT_SYMBOL_GPL(nr_irqs);
 
-void __init __attribute__((weak)) arch_early_irq_init(void)
-{
-}
-
 #ifdef CONFIG_SPARSE_IRQ
 static struct irq_desc irq_desc_init = {
        .irq        = -1,
@@ -90,13 +86,11 @@ void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr)
                desc->kstat_irqs = (unsigned int *)ptr;
 }
 
-void __attribute__((weak)) arch_init_chip_data(struct irq_desc *desc, int cpu)
-{
-}
-
 static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu)
 {
        memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
+
+       spin_lock_init(&desc->lock);
        desc->irq = irq;
 #ifdef CONFIG_SMP
        desc->cpu = cpu;
@@ -134,7 +128,7 @@ static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_sm
 /* FIXME: use bootmem alloc ...*/
 static unsigned int kstat_irqs_legacy[NR_IRQS_LEGACY][NR_CPUS];
 
-void __init early_irq_init(void)
+int __init early_irq_init(void)
 {
        struct irq_desc *desc;
        int legacy_count;
@@ -146,6 +140,7 @@ void __init early_irq_init(void)
        for (i = 0; i < legacy_count; i++) {
                desc[i].irq = i;
                desc[i].kstat_irqs = kstat_irqs_legacy[i];
+               lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
 
                irq_desc_ptrs[i] = desc + i;
        }
@@ -153,7 +148,7 @@ void __init early_irq_init(void)
        for (i = legacy_count; i < NR_IRQS; i++)
                irq_desc_ptrs[i] = NULL;
 
-       arch_early_irq_init();
+       return arch_early_irq_init();
 }
 
 struct irq_desc *irq_to_desc(unsigned int irq)
@@ -203,7 +198,7 @@ out_unlock:
        return desc;
 }
 
-#else
+#else /* !CONFIG_SPARSE_IRQ */
 
 struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
        [0 ... NR_IRQS-1] = {
@@ -218,7 +213,31 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
        }
 };
 
-#endif
+int __init early_irq_init(void)
+{
+       struct irq_desc *desc;
+       int count;
+       int i;
+
+       desc = irq_desc;
+       count = ARRAY_SIZE(irq_desc);
+
+       for (i = 0; i < count; i++)
+               desc[i].irq = i;
+
+       return arch_early_irq_init();
+}
+
+struct irq_desc *irq_to_desc(unsigned int irq)
+{
+       return (irq < NR_IRQS) ? irq_desc + irq : NULL;
+}
+
+struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
+{
+       return irq_to_desc(irq);
+}
+#endif /* !CONFIG_SPARSE_IRQ */
 
 /*
  * What should we do if we get a hw irq event on an illegal vector?
@@ -428,9 +447,6 @@ void early_init_irq_lock_class(void)
        int i;
 
        for_each_irq_desc(i, desc) {
-               if (!desc)
-                       continue;
-
                lockdep_set_class(&desc->lock, &irq_desc_lock_class);
        }
 }
@@ -439,7 +455,7 @@ void early_init_irq_lock_class(void)
 unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
 {
        struct irq_desc *desc = irq_to_desc(irq);
-       return desc->kstat_irqs[cpu];
+       return desc ? desc->kstat_irqs[cpu] : 0;
 }
 #endif
 EXPORT_SYMBOL(kstat_irqs_cpu);
index 089c3746358a1cb39c01863ce8ba095c34c88973..ecf765c6a77ac8276b73cc551af07de1c4302f23 100644 (file)
@@ -42,6 +42,7 @@ static void init_copy_one_irq_desc(int irq, struct irq_desc *old_desc,
                 struct irq_desc *desc, int cpu)
 {
        memcpy(desc, old_desc, sizeof(struct irq_desc));
+       spin_lock_init(&desc->lock);
        desc->cpu = cpu;
        lockdep_set_class(&desc->lock, &irq_desc_lock_class);
        init_copy_kstat_irqs(old_desc, desc, cpu, nr_cpu_ids);
@@ -74,10 +75,8 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,
 
        node = cpu_to_node(cpu);
        desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node);
-       printk(KERN_DEBUG "  move irq_desc for %d to cpu %d node %d\n",
-                irq, cpu, node);
        if (!desc) {
-               printk(KERN_ERR "can not get new irq_desc for moving\n");
+               printk(KERN_ERR "irq %d: can not get new irq_desc for migration.\n", irq);
                /* still use old one */
                desc = old_desc;
                goto out_unlock;
@@ -106,8 +105,6 @@ struct irq_desc *move_irq_desc(struct irq_desc *desc, int cpu)
                return desc;
 
        old_cpu = desc->cpu;
-       printk(KERN_DEBUG
-                "try to move irq_desc from cpu %d to %d\n", old_cpu, cpu);
        if (old_cpu != cpu) {
                node = cpu_to_node(cpu);
                old_node = cpu_to_node(old_cpu);
index 3738107531fd29190b62e628d4d7da8f1081ec96..dd364c11e56e0f82e0e923fcc3b60d17524e991d 100644 (file)
@@ -91,9 +91,6 @@ static int misrouted_irq(int irq)
        int i, ok = 0;
 
        for_each_irq_desc(i, desc) {
-               if (!desc)
-                       continue;
-
                if (!i)
                         continue;
 
@@ -115,8 +112,6 @@ static void poll_spurious_irqs(unsigned long dummy)
        for_each_irq_desc(i, desc) {
                unsigned int status;
 
-               if (!desc)
-                       continue;
                if (!i)
                         continue;
 
index 466e75ce271aa0795ac50266d9d3bc2acdde7261..670c1eca47ec9964e2a8bef73dc3aa4840c427b4 100644 (file)
@@ -784,3 +784,23 @@ int on_each_cpu(void (*func) (void *info), void *info, int wait)
 }
 EXPORT_SYMBOL(on_each_cpu);
 #endif
+
+/*
+ * [ These __weak aliases are kept in a separate compilation unit, so that
+ *   GCC does not inline them incorrectly. ]
+ */
+
+int __init __weak early_irq_init(void)
+{
+       return 0;
+}
+
+int __init __weak arch_early_irq_init(void)
+{
+       return 0;
+}
+
+int __weak arch_init_chip_data(struct irq_desc *desc, int cpu)
+{
+       return 0;
+}