Commit 99558f0bbe68cb09799ec38adbaa3f3b2dc7ba63
Committed by
H. Peter Anvin
1 parent
773e3eb7b8
Exists in
master
and in
20 other branches
sparseirq: Change irq_desc_ptrs to static
Add replace_irq_desc() instead of poking at the array directly. -v2: remove unneeded boundary check in replace_irq_desc Signed-off-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <1265793639-15071-31-git-send-email-yinghai@kernel.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Showing 3 changed files with 9 additions and 8 deletions Side-by-side Diff
kernel/irq/handle.c
... | ... | @@ -127,7 +127,7 @@ |
127 | 127 | */ |
128 | 128 | DEFINE_RAW_SPINLOCK(sparse_irq_lock); |
129 | 129 | |
130 | -struct irq_desc **irq_desc_ptrs __read_mostly; | |
130 | +static struct irq_desc **irq_desc_ptrs __read_mostly; | |
131 | 131 | |
132 | 132 | static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = { |
133 | 133 | [0 ... NR_IRQS_LEGACY-1] = { |
... | ... | @@ -190,6 +190,11 @@ |
190 | 190 | return irq_desc_ptrs[irq]; |
191 | 191 | |
192 | 192 | return NULL; |
193 | +} | |
194 | + | |
195 | +void replace_irq_desc(unsigned int irq, struct irq_desc *desc) | |
196 | +{ | |
197 | + irq_desc_ptrs[irq] = desc; | |
193 | 198 | } |
194 | 199 | |
195 | 200 | struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node) |
kernel/irq/internals.h
... | ... | @@ -21,11 +21,7 @@ |
21 | 21 | extern raw_spinlock_t sparse_irq_lock; |
22 | 22 | |
23 | 23 | #ifdef CONFIG_SPARSE_IRQ |
24 | -/* irq_desc_ptrs allocated at boot time */ | |
25 | -extern struct irq_desc **irq_desc_ptrs; | |
26 | -#else | |
27 | -/* irq_desc_ptrs is a fixed size array */ | |
28 | -extern struct irq_desc *irq_desc_ptrs[NR_IRQS]; | |
24 | +void replace_irq_desc(unsigned int irq, struct irq_desc *desc); | |
29 | 25 | #endif |
30 | 26 | |
31 | 27 | #ifdef CONFIG_PROC_FS |
kernel/irq/numa_migrate.c
... | ... | @@ -70,7 +70,7 @@ |
70 | 70 | raw_spin_lock_irqsave(&sparse_irq_lock, flags); |
71 | 71 | |
72 | 72 | /* We have to check it to avoid races with another CPU */ |
73 | - desc = irq_desc_ptrs[irq]; | |
73 | + desc = irq_to_desc(irq); | |
74 | 74 | |
75 | 75 | if (desc && old_desc != desc) |
76 | 76 | goto out_unlock; |
... | ... | @@ -90,7 +90,7 @@ |
90 | 90 | goto out_unlock; |
91 | 91 | } |
92 | 92 | |
93 | - irq_desc_ptrs[irq] = desc; | |
93 | + replace_irq_desc(irq, desc); | |
94 | 94 | raw_spin_unlock_irqrestore(&sparse_irq_lock, flags); |
95 | 95 | |
96 | 96 | /* free the old one */ |