[PATCH v5 1/3] irqdomain: export of_phandle_args_to_fwspec

From: Masahiro Yamada
Date: Wed Sep 13 2017 - 04:57:59 EST


This helper will be useful for irqchip drivers that need to convert
DT binding into IRQ fwspec.

Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
---

This patch is necessary for my GPIO driver.
Since it is trivial enough, I hope Marc will allow this to go
though the GPIO subsystem.

If this patch is rejected, I can copy this function into my GPIO
driver, but I'd like to avoid code duplication.


include/linux/irqdomain.h | 2 ++
kernel/irq/irqdomain.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 81e4889..440772c 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -259,6 +259,8 @@ extern void irq_set_default_host(struct irq_domain *host);
extern int irq_domain_alloc_descs(int virq, unsigned int nr_irqs,
irq_hw_number_t hwirq, int node,
const struct cpumask *affinity);
+extern void of_phandle_args_to_fwspec(struct of_phandle_args *irq_data,
+ struct irq_fwspec *fwspec);

static inline struct fwnode_handle *of_node_to_fwnode(struct device_node *node)
{
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index e84b705..e34cd63 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -727,8 +727,8 @@ static int irq_domain_translate(struct irq_domain *d,
return 0;
}

-static void of_phandle_args_to_fwspec(struct of_phandle_args *irq_data,
- struct irq_fwspec *fwspec)
+void of_phandle_args_to_fwspec(struct of_phandle_args *irq_data,
+ struct irq_fwspec *fwspec)
{
int i;

@@ -738,6 +738,7 @@ static void of_phandle_args_to_fwspec(struct of_phandle_args *irq_data,
for (i = 0; i < irq_data->args_count; i++)
fwspec->param[i] = irq_data->args[i];
}
+EXPORT_SYMBOL_GPL(of_phandle_args_to_fwspec);

unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
{
--
2.7.4