genirq: Introduce helper irq_domain_set_info() to reduce duplicated code
authorJiang Liu <jiang.liu@linux.intel.com>
Sun, 9 Nov 2014 15:10:24 +0000 (23:10 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Sun, 23 Nov 2014 12:01:46 +0000 (13:01 +0100)
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
Cc: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/irqdomain.h
kernel/irq/irqdomain.c

index f8563dcfd254623c67a718a96431c661b45cf1c7..7aca1adb68a17dcba44d83d856e685d0b3d3eaf9 100644 (file)
@@ -33,6 +33,7 @@
 #define _LINUX_IRQDOMAIN_H
 
 #include <linux/types.h>
+#include <linux/irqhandler.h>
 #include <linux/radix-tree.h>
 
 struct device_node;
@@ -273,6 +274,10 @@ extern int irq_domain_set_hwirq_and_chip(struct irq_domain *domain,
                                         irq_hw_number_t hwirq,
                                         struct irq_chip *chip,
                                         void *chip_data);
+extern void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
+                               irq_hw_number_t hwirq, struct irq_chip *chip,
+                               void *chip_data, irq_flow_handler_t handler,
+                               void *handler_data, const char *handler_name);
 extern void irq_domain_reset_irq_data(struct irq_data *irq_data);
 extern void irq_domain_free_irqs_common(struct irq_domain *domain,
                                        unsigned int virq,
index 9a61de21933a9778d3f6a6b4cd87eb036a1843ea..4e62832ace82946a7b840ca3cff6f9a9d957c71a 100644 (file)
@@ -890,6 +890,27 @@ int irq_domain_set_hwirq_and_chip(struct irq_domain *domain, unsigned int virq,
        return 0;
 }
 
+/**
+ * irq_domain_set_info - Set the complete data for a @virq in @domain
+ * @domain:            Interrupt domain to match
+ * @virq:              IRQ number
+ * @hwirq:             The hardware interrupt number
+ * @chip:              The associated interrupt chip
+ * @chip_data:         The associated interrupt chip data
+ * @handler:           The interrupt flow handler
+ * @handler_data:      The interrupt flow handler data
+ * @handler_name:      The interrupt handler name
+ */
+void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
+                        irq_hw_number_t hwirq, struct irq_chip *chip,
+                        void *chip_data, irq_flow_handler_t handler,
+                        void *handler_data, const char *handler_name)
+{
+       irq_domain_set_hwirq_and_chip(domain, virq, hwirq, chip, chip_data);
+       __irq_set_handler(virq, handler, 0, handler_name);
+       irq_set_handler_data(virq, handler_data);
+}
+
 /**
  * irq_domain_reset_irq_data - Clear hwirq, chip and chip_data in @irq_data
  * @irq_data:  The pointer to irq_data