Commit 1b5377087cb4e68d719a875120894fddfbcbf0f9

Authored by Jiang Liu
Committed by Thomas Gleixner
1 parent 75ffc00750

genirq: Introduce helper irq_domain_set_info() to reduce duplicated code

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>

Showing 2 changed files with 26 additions and 0 deletions Side-by-side Diff

include/linux/irqdomain.h
... ... @@ -33,6 +33,7 @@
33 33 #define _LINUX_IRQDOMAIN_H
34 34  
35 35 #include <linux/types.h>
  36 +#include <linux/irqhandler.h>
36 37 #include <linux/radix-tree.h>
37 38  
38 39 struct device_node;
... ... @@ -273,6 +274,10 @@
273 274 irq_hw_number_t hwirq,
274 275 struct irq_chip *chip,
275 276 void *chip_data);
  277 +extern void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
  278 + irq_hw_number_t hwirq, struct irq_chip *chip,
  279 + void *chip_data, irq_flow_handler_t handler,
  280 + void *handler_data, const char *handler_name);
276 281 extern void irq_domain_reset_irq_data(struct irq_data *irq_data);
277 282 extern void irq_domain_free_irqs_common(struct irq_domain *domain,
278 283 unsigned int virq,
kernel/irq/irqdomain.c
... ... @@ -891,6 +891,27 @@
891 891 }
892 892  
893 893 /**
  894 + * irq_domain_set_info - Set the complete data for a @virq in @domain
  895 + * @domain: Interrupt domain to match
  896 + * @virq: IRQ number
  897 + * @hwirq: The hardware interrupt number
  898 + * @chip: The associated interrupt chip
  899 + * @chip_data: The associated interrupt chip data
  900 + * @handler: The interrupt flow handler
  901 + * @handler_data: The interrupt flow handler data
  902 + * @handler_name: The interrupt handler name
  903 + */
  904 +void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
  905 + irq_hw_number_t hwirq, struct irq_chip *chip,
  906 + void *chip_data, irq_flow_handler_t handler,
  907 + void *handler_data, const char *handler_name)
  908 +{
  909 + irq_domain_set_hwirq_and_chip(domain, virq, hwirq, chip, chip_data);
  910 + __irq_set_handler(virq, handler, 0, handler_name);
  911 + irq_set_handler_data(virq, handler_data);
  912 +}
  913 +
  914 +/**
894 915 * irq_domain_reset_irq_data - Clear hwirq, chip and chip_data in @irq_data
895 916 * @irq_data: The pointer to irq_data
896 917 */