irq: make irq_desc to use dyn_array
authorYinghai Lu <yhlu.kernel@gmail.com>
Wed, 20 Aug 2008 03:50:00 +0000 (20:50 -0700)
committerIngo Molnar <mingo@elte.hu>
Thu, 16 Oct 2008 14:52:07 +0000 (16:52 +0200)
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/irq.h
kernel/irq/handle.c

index 1d73d1abb8349f6928cd6971ffa9ea98f78a7f5f..5f4b013624dc9a46831dd1ebacc4d4db06373e67 100644 (file)
@@ -179,7 +179,11 @@ struct irq_desc {
        const char              *name;
 } ____cacheline_internodealigned_in_smp;
 
+#ifdef CONFIG_HAVE_DYN_ARRAY
+extern struct irq_desc *irq_desc;
+#else
 extern struct irq_desc irq_desc[NR_IRQS];
+#endif
 
 /*
  * Migration helpers for obsolete names, they will go away:
index e9d022cf593ef6384e9b2cd26f1ae50e4df57584..e94eeca09ea9fa7f251cd32ed7f11d0a2595e9d1 100644 (file)
@@ -48,6 +48,36 @@ handle_bad_irq(unsigned int irq, struct irq_desc *desc)
  * Controller mappings for all interrupt sources:
  */
 int nr_irqs = NR_IRQS;
+
+#ifdef CONFIG_HAVE_DYN_ARRAY
+static struct irq_desc irq_desc_init __initdata = {
+       .status = IRQ_DISABLED,
+       .chip = &no_irq_chip,
+       .handle_irq = handle_bad_irq,
+       .depth = 1,
+       .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock),
+#ifdef CONFIG_SMP
+       .affinity = CPU_MASK_ALL
+#endif
+};
+
+static void __init init_work(void *data)
+{
+       struct dyn_array *da = data;
+       int i;
+       struct  irq_desc *desc;
+
+       desc = *da->name;
+
+       for (i = 0; i < *da->nr; i++)
+               memcpy(&desc[i], &irq_desc_init, sizeof(struct irq_desc));
+}
+
+struct irq_desc *irq_desc;
+DEFINE_DYN_ARRAY(irq_desc, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work);
+
+#else
+
 struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
        [0 ... NR_IRQS-1] = {
                .status = IRQ_DISABLED,
@@ -60,6 +90,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
 #endif
        }
 };
+#endif
 
 /*
  * What should we do if we get a hw irq event on an illegal vector?