]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
genirq: use inline function for irq_to_desc
authorThomas Gleixner <tglx@linutronix.de>
Wed, 15 Oct 2008 12:31:29 +0000 (14:31 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 16 Oct 2008 14:53:14 +0000 (16:53 +0200)
For the non sparse irq case an inline function is perfectly fine.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/irq.h
kernel/irq/handle.c

index dbe8734ae86ceb421a284793c8b4515ff894476f..7d1adacaadb4a92ba7235d2dc0a99f13914bb07f 100644 (file)
@@ -204,8 +204,6 @@ struct irq_desc {
        const char              *name;
 } ____cacheline_internodealigned_in_smp;
 
-extern struct irq_desc *irq_to_desc(unsigned int irq);
-extern struct irq_desc *irq_to_desc_alloc(unsigned int irq);
 
 #ifndef CONFIG_HAVE_SPARSE_IRQ
 
@@ -216,8 +214,21 @@ extern struct irq_desc irq_desc[NR_IRQS];
 extern struct irq_desc *irq_desc;
 #endif
 
+static inline struct irq_desc *irq_to_desc(unsigned int irq)
+{
+       return (irq < nr_irqs) ? irq_desc + irq : NULL;
+}
+
+static inline struct irq_desc *irq_to_desc_alloc(unsigned int irq)
+{
+       return irq_to_desc(irq);
+}
+
 #else
 
+extern struct irq_desc *irq_to_desc(unsigned int irq);
+extern struct irq_desc *irq_to_desc_alloc(unsigned int irq);
+
 extern struct irq_desc *sparse_irqs;
 #define for_each_irq_desc(irqX, desc)          \
        for (desc = sparse_irqs, irqX = desc->irq; desc; desc = desc->next, irqX = desc ? desc->irq : -1U)
index fb6bdb602a935a858c7943688443efe4227a8d8e..c19896f895f96e255290ebc2e87461800df55b95 100644 (file)
@@ -262,20 +262,6 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
 
 #endif
 
-#ifndef CONFIG_HAVE_SPARSE_IRQ
-struct irq_desc *irq_to_desc(unsigned int irq)
-{
-       if (irq < nr_irqs)
-               return &irq_desc[irq];
-
-       return NULL;
-}
-struct irq_desc *irq_to_desc_alloc(unsigned int irq)
-{
-       return irq_to_desc(irq);
-}
-#endif
-
 /*
  * What should we do if we get a hw irq event on an illegal vector?
  * Each architecture has to answer this themself.