aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irq.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-10-15 08:31:29 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:53:14 -0400
commitc6b7674f323622d86316bf7951ad9cae1ce24642 (patch)
tree00ff8c061f9c0822c56e46bc59c46dced278f9a9 /include/linux/irq.h
parent70dd4d992ab324a59cdcd6bedc3f4e729863d514 (diff)
genirq: use inline function for irq_to_desc
For the non sparse irq case an inline function is perfectly fine. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/irq.h')
-rw-r--r--include/linux/irq.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index dbe8734ae86c..7d1adacaadb4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -204,8 +204,6 @@ struct irq_desc {
204 const char *name; 204 const char *name;
205} ____cacheline_internodealigned_in_smp; 205} ____cacheline_internodealigned_in_smp;
206 206
207extern struct irq_desc *irq_to_desc(unsigned int irq);
208extern struct irq_desc *irq_to_desc_alloc(unsigned int irq);
209 207
210#ifndef CONFIG_HAVE_SPARSE_IRQ 208#ifndef CONFIG_HAVE_SPARSE_IRQ
211 209
@@ -216,8 +214,21 @@ extern struct irq_desc irq_desc[NR_IRQS];
216extern struct irq_desc *irq_desc; 214extern struct irq_desc *irq_desc;
217#endif 215#endif
218 216
217static inline struct irq_desc *irq_to_desc(unsigned int irq)
218{
219 return (irq < nr_irqs) ? irq_desc + irq : NULL;
220}
221
222static inline struct irq_desc *irq_to_desc_alloc(unsigned int irq)
223{
224 return irq_to_desc(irq);
225}
226
219#else 227#else
220 228
229extern struct irq_desc *irq_to_desc(unsigned int irq);
230extern struct irq_desc *irq_to_desc_alloc(unsigned int irq);
231
221extern struct irq_desc *sparse_irqs; 232extern struct irq_desc *sparse_irqs;
222#define for_each_irq_desc(irqX, desc) \ 233#define for_each_irq_desc(irqX, desc) \
223 for (desc = sparse_irqs, irqX = desc->irq; desc; desc = desc->next, irqX = desc ? desc->irq : -1U) 234 for (desc = sparse_irqs, irqX = desc->irq; desc; desc = desc->next, irqX = desc ? desc->irq : -1U)