genirq: export handle_edge_irq() and irq_to_desc()
[linux-flexiantxendom0-3.2.10.git] / kernel / irq / irqdesc.c
index 039b889..192a302 100644 (file)
@@ -9,7 +9,7 @@
  */
 #include <linux/irq.h>
 #include <linux/slab.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
 #include <linux/radix-tree.h>
@@ -112,6 +112,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
 {
        return radix_tree_lookup(&irq_desc_tree, irq);
 }
+EXPORT_SYMBOL(irq_to_desc);
 
 static void delete_irq_desc(unsigned int irq)
 {
@@ -424,11 +425,22 @@ unsigned int irq_get_next_irq(unsigned int offset)
 }
 
 struct irq_desc *
-__irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus)
+__irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus,
+                   unsigned int check)
 {
        struct irq_desc *desc = irq_to_desc(irq);
 
        if (desc) {
+               if (check & _IRQ_DESC_CHECK) {
+                       if ((check & _IRQ_DESC_PERCPU) &&
+                           !irq_settings_is_per_cpu_devid(desc))
+                               return NULL;
+
+                       if (!(check & _IRQ_DESC_PERCPU) &&
+                           irq_settings_is_per_cpu_devid(desc))
+                               return NULL;
+               }
+
                if (bus)
                        chip_bus_lock(desc);
                raw_spin_lock_irqsave(&desc->lock, *flags);
@@ -443,6 +455,25 @@ void __irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags, bool bus)
                chip_bus_sync_unlock(desc);
 }
 
+int irq_set_percpu_devid(unsigned int irq)
+{
+       struct irq_desc *desc = irq_to_desc(irq);
+
+       if (!desc)
+               return -EINVAL;
+
+       if (desc->percpu_enabled)
+               return -EINVAL;
+
+       desc->percpu_enabled = kzalloc(sizeof(*desc->percpu_enabled), GFP_KERNEL);
+
+       if (!desc->percpu_enabled)
+               return -ENOMEM;
+
+       irq_set_percpu_devid_flags(irq);
+       return 0;
+}
+
 /**
  * dynamic_irq_cleanup - cleanup a dynamically allocated irq
  * @irq:       irq number to initialize