[tip: irq/cleanups] irqdomain: Drop of_node_to_fwnode()

tip-bot2 for Jiri Slaby (SUSE)
2025-05-07T07:58:18Z

Commit-ID: 64e4d65310656fac554ebfdeac14fa198605206f
Gitweb: https://git.kernel.org/tip/64e4d65310656fac554ebfdeac14fa198605206f
Author: Jiri Slaby (SUSE) <jirislaby@kernel.org>
AuthorDate: Wed, 19 Mar 2025 10:29:04 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 07 May 2025 09:53:21 +02:00

irqdomain: Drop of_node_to_fwnode()

All uses of of_node_to_fwnode() in non-irqdomain code were changed to
"officially" defined of_fwnode_handle(). Therefore, the former can be
dropped along with the last uses in the irqdomain code.

Due to merge logistics the inline cannot be dropped immediately. Move it to
a deprecated section, which will be removed during the merge window.

[ tglx: Handle merge logistics ]

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250319092951.37667-12-jirislaby@kernel.org

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

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index df7e927..91ed86f 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -358,11 +358,6 @@ int irq_domain_alloc_descs(int virq, unsigned int nr_irqs,
irq_hw_number_t hwirq, int node,
const struct irq_affinity_desc *affinity);

-static inline struct fwnode_handle *of_node_to_fwnode(struct device_node *node)
-{
- return node ? &node->fwnode : NULL;
-}
-
extern const struct fwnode_operations irqchip_fwnode_ops;

static inline bool is_fwnode_irqchip(const struct fwnode_handle *fwnode)
@@ -387,7 +382,7 @@ struct irq_domain *irq_find_matching_fwnode(struct fwnode_handle *fwnode,
static inline struct irq_domain *irq_find_matching_host(struct device_node *node,
enum irq_domain_bus_token bus_token)
{
- return irq_find_matching_fwnode(of_node_to_fwnode(node), bus_token);
+ return irq_find_matching_fwnode(of_fwnode_handle(node), bus_token);
}

static inline struct irq_domain *irq_find_host(struct device_node *node)
@@ -407,7 +402,7 @@ static inline struct irq_domain *irq_domain_add_simple(struct device_node *of_no
const struct irq_domain_ops *ops,
void *host_data)
{
- return irq_domain_create_simple(of_node_to_fwnode(of_node), size, first_irq, ops, host_data);
+ return irq_domain_create_simple(of_fwnode_handle(of_node), size, first_irq, ops, host_data);
}

/**
@@ -423,7 +418,7 @@ static inline struct irq_domain *irq_domain_add_linear(struct device_node *of_no
void *host_data)
{
struct irq_domain_info info = {
- .fwnode = of_node_to_fwnode(of_node),
+ .fwnode = of_fwnode_handle(of_node),
.size = size,
.hwirq_max = size,
.ops = ops,
@@ -442,7 +437,7 @@ static inline struct irq_domain *irq_domain_add_nomap(struct device_node *of_nod
void *host_data)
{
struct irq_domain_info info = {
- .fwnode = of_node_to_fwnode(of_node),
+ .fwnode = of_fwnode_handle(of_node),
.hwirq_max = max_irq,
.direct_max = max_irq,
.ops = ops,
@@ -462,7 +457,7 @@ static inline struct irq_domain *irq_domain_add_tree(struct device_node *of_node
void *host_data)
{
struct irq_domain_info info = {
- .fwnode = of_node_to_fwnode(of_node),
+ .fwnode = of_fwnode_handle(of_node),
.hwirq_max = ~0U,
.ops = ops,
.host_data = host_data,
@@ -611,7 +606,7 @@ static inline struct irq_domain *irq_domain_add_hierarchy(struct irq_domain *par
void *host_data)
{
return irq_domain_create_hierarchy(parent, flags, size,
- of_node_to_fwnode(node),
+ of_fwnode_handle(node),
ops, host_data);
}

@@ -755,6 +750,12 @@ static inline void msi_device_domain_free_wired(struct irq_domain *domain, unsig
}
#endif

+/* Deprecated functions. Will be removed in the merge window */
+static inline struct fwnode_handle *of_node_to_fwnode(struct device_node *node)
+{
+ return node ? &node->fwnode : NULL;
+}
+
#else /* CONFIG_IRQ_DOMAIN */
static inline void irq_dispose_mapping(unsigned int virq) { }
static inline struct irq_domain *irq_find_matching_fwnode(
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index b294c3f..0eb99d2 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -502,7 +502,7 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
const struct irq_domain_ops *ops,
void *host_data)
{
- return irq_domain_create_legacy(of_node_to_fwnode(of_node), size,
+ return irq_domain_create_legacy(of_fwnode_handle(of_node), size,
first_irq, first_hwirq, ops, host_data);
}
EXPORT_SYMBOL_GPL(irq_domain_add_legacy);
@@ -885,7 +885,7 @@ void of_phandle_args_to_fwspec(struct device_node *np, const u32 *args,
{
int i;

- fwspec->fwnode = of_node_to_fwnode(np);
+ fwspec->fwnode = of_fwnode_handle(np);
fwspec->param_count = count;

for (i = 0; i < count; i++)