diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-08-19 23:50:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:52:07 -0400 |
commit | d60458b224d6b997a582a05cb8c4b9bed9e17a1d (patch) | |
tree | 122710312c443069cb8e25a27032f09572550c45 | |
parent | 5aeecaf4908499b1fd006d313ccbacde6a6bac43 (diff) |
irq: make irq_desc to use dyn_array
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/irq.h | 4 | ||||
-rw-r--r-- | kernel/irq/handle.c | 31 |
2 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index 1d73d1abb834..5f4b013624dc 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -179,7 +179,11 @@ struct irq_desc { | |||
179 | const char *name; | 179 | const char *name; |
180 | } ____cacheline_internodealigned_in_smp; | 180 | } ____cacheline_internodealigned_in_smp; |
181 | 181 | ||
182 | #ifdef CONFIG_HAVE_DYN_ARRAY | ||
183 | extern struct irq_desc *irq_desc; | ||
184 | #else | ||
182 | extern struct irq_desc irq_desc[NR_IRQS]; | 185 | extern struct irq_desc irq_desc[NR_IRQS]; |
186 | #endif | ||
183 | 187 | ||
184 | /* | 188 | /* |
185 | * Migration helpers for obsolete names, they will go away: | 189 | * Migration helpers for obsolete names, they will go away: |
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index e9d022cf593e..e94eeca09ea9 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -48,6 +48,36 @@ handle_bad_irq(unsigned int irq, struct irq_desc *desc) | |||
48 | * Controller mappings for all interrupt sources: | 48 | * Controller mappings for all interrupt sources: |
49 | */ | 49 | */ |
50 | int nr_irqs = NR_IRQS; | 50 | int nr_irqs = NR_IRQS; |
51 | |||
52 | #ifdef CONFIG_HAVE_DYN_ARRAY | ||
53 | static struct irq_desc irq_desc_init __initdata = { | ||
54 | .status = IRQ_DISABLED, | ||
55 | .chip = &no_irq_chip, | ||
56 | .handle_irq = handle_bad_irq, | ||
57 | .depth = 1, | ||
58 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), | ||
59 | #ifdef CONFIG_SMP | ||
60 | .affinity = CPU_MASK_ALL | ||
61 | #endif | ||
62 | }; | ||
63 | |||
64 | static void __init init_work(void *data) | ||
65 | { | ||
66 | struct dyn_array *da = data; | ||
67 | int i; | ||
68 | struct irq_desc *desc; | ||
69 | |||
70 | desc = *da->name; | ||
71 | |||
72 | for (i = 0; i < *da->nr; i++) | ||
73 | memcpy(&desc[i], &irq_desc_init, sizeof(struct irq_desc)); | ||
74 | } | ||
75 | |||
76 | struct irq_desc *irq_desc; | ||
77 | DEFINE_DYN_ARRAY(irq_desc, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work); | ||
78 | |||
79 | #else | ||
80 | |||
51 | struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | 81 | struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { |
52 | [0 ... NR_IRQS-1] = { | 82 | [0 ... NR_IRQS-1] = { |
53 | .status = IRQ_DISABLED, | 83 | .status = IRQ_DISABLED, |
@@ -60,6 +90,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | |||
60 | #endif | 90 | #endif |
61 | } | 91 | } |
62 | }; | 92 | }; |
93 | #endif | ||
63 | 94 | ||
64 | /* | 95 | /* |
65 | * What should we do if we get a hw irq event on an illegal vector? | 96 | * What should we do if we get a hw irq event on an illegal vector? |