diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-08-19 23:50:10 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:52:32 -0400 |
commit | 9059d8fa4a3a9153da53da890039f7f956cc9d19 (patch) | |
tree | 142f12d7843a4000eb9be7dd8a4a933ce2955f72 /kernel/irq | |
parent | 7f95ec9e4c12fd067febfd57532da1166d75d858 (diff) |
irq: add irq_desc_without_new
add an irq_desc accessor that will not allocate any sparse entry
but returns failure if there's no entry present.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/irq')
-rw-r--r-- | kernel/irq/handle.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 1f346990f3f8..8e55dbe50afc 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -112,7 +112,6 @@ static void init_kstat_irqs(struct irq_desc *desc, int nr_desc, int nr) | |||
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | |||
116 | static void __init init_work(void *data) | 115 | static void __init init_work(void *data) |
117 | { | 116 | { |
118 | struct dyn_array *da = data; | 117 | struct dyn_array *da = data; |
@@ -149,9 +148,27 @@ static int __init parse_nr_irq_desc(char *arg) | |||
149 | 148 | ||
150 | early_param("nr_irq_desc", parse_nr_irq_desc); | 149 | early_param("nr_irq_desc", parse_nr_irq_desc); |
151 | 150 | ||
152 | static struct irq_desc *sparse_irqs; | 151 | struct irq_desc *sparse_irqs; |
153 | DEFINE_DYN_ARRAY(sparse_irqs, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work); | 152 | DEFINE_DYN_ARRAY(sparse_irqs, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work); |
154 | 153 | ||
154 | struct irq_desc *__irq_to_desc(unsigned int irq) | ||
155 | { | ||
156 | struct irq_desc *desc; | ||
157 | |||
158 | BUG_ON(irq == -1U); | ||
159 | |||
160 | desc = &sparse_irqs[0]; | ||
161 | while (desc) { | ||
162 | if (desc->irq == irq) | ||
163 | return desc; | ||
164 | |||
165 | if (desc->irq == -1U) | ||
166 | return NULL; | ||
167 | |||
168 | desc = desc->next; | ||
169 | } | ||
170 | return NULL; | ||
171 | } | ||
155 | struct irq_desc *irq_to_desc(unsigned int irq) | 172 | struct irq_desc *irq_to_desc(unsigned int irq) |
156 | { | 173 | { |
157 | struct irq_desc *desc, *desc_pri; | 174 | struct irq_desc *desc, *desc_pri; |
@@ -208,8 +225,7 @@ struct irq_desc *irq_to_desc(unsigned int irq) | |||
208 | return desc; | 225 | return desc; |
209 | } | 226 | } |
210 | #else | 227 | #else |
211 | 228 | struct irq_desc *irq_desc; | |
212 | static struct irq_desc *irq_desc; | ||
213 | DEFINE_DYN_ARRAY(irq_desc, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work); | 229 | DEFINE_DYN_ARRAY(irq_desc, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work); |
214 | 230 | ||
215 | #endif | 231 | #endif |
@@ -239,6 +255,10 @@ struct irq_desc *irq_to_desc(unsigned int irq) | |||
239 | 255 | ||
240 | return NULL; | 256 | return NULL; |
241 | } | 257 | } |
258 | struct irq_desc *__irq_to_desc(unsigned int irq) | ||
259 | { | ||
260 | return irq_to_desc(irq); | ||
261 | } | ||
242 | #endif | 262 | #endif |
243 | 263 | ||
244 | /* | 264 | /* |