aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/irq.h13
-rw-r--r--kernel/irq/handle.c28
2 files changed, 37 insertions, 4 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index cbf471aee1ce..c9ffef7c3b44 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -191,10 +191,23 @@ struct irq_desc {
191} ____cacheline_internodealigned_in_smp; 191} ____cacheline_internodealigned_in_smp;
192 192
193extern struct irq_desc *irq_to_desc(unsigned int irq); 193extern struct irq_desc *irq_to_desc(unsigned int irq);
194extern struct irq_desc *__irq_to_desc(unsigned int irq);
195
196#ifndef CONFIG_HAVE_SPARSE_IRQ
197
194#ifndef CONFIG_HAVE_DYN_ARRAY 198#ifndef CONFIG_HAVE_DYN_ARRAY
195/* could be removed if we get rid of all irq_desc reference */ 199/* could be removed if we get rid of all irq_desc reference */
196extern struct irq_desc irq_desc[NR_IRQS]; 200extern struct irq_desc irq_desc[NR_IRQS];
201#else
202extern struct irq_desc *irq_desc;
197#endif 203#endif
204
205#else
206
207extern struct irq_desc *sparse_irqs;
208
209#endif
210
198#define kstat_irqs_this_cpu(DESC) \ 211#define kstat_irqs_this_cpu(DESC) \
199 ((DESC)->kstat_irqs[smp_processor_id()]) 212 ((DESC)->kstat_irqs[smp_processor_id()])
200 213
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
116static void __init init_work(void *data) 115static 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
150early_param("nr_irq_desc", parse_nr_irq_desc); 149early_param("nr_irq_desc", parse_nr_irq_desc);
151 150
152static struct irq_desc *sparse_irqs; 151struct irq_desc *sparse_irqs;
153DEFINE_DYN_ARRAY(sparse_irqs, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work); 152DEFINE_DYN_ARRAY(sparse_irqs, sizeof(struct irq_desc), nr_irq_desc, PAGE_SIZE, init_work);
154 153
154struct 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}
155struct irq_desc *irq_to_desc(unsigned int irq) 172struct 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 228struct irq_desc *irq_desc;
212static struct irq_desc *irq_desc;
213DEFINE_DYN_ARRAY(irq_desc, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work); 229DEFINE_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}
258struct irq_desc *__irq_to_desc(unsigned int irq)
259{
260 return irq_to_desc(irq);
261}
242#endif 262#endif
243 263
244/* 264/*