Skip to content

Commit 181e9d4

Browse files
andy-shevMarc Zyngier
authored andcommitted
irqdomain: Make __irq_domain_add() less OF-dependent
__irq_domain_add() relies in some places on the fact that the fwnode can be only of type OF. This prevents refactoring of the code to support other types of fwnode. Make it less OF-dependent by switching it to use the fwnode directly where it makes sense. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 128516e commit 181e9d4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

kernel/irq/irqdomain.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,13 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
132132
const struct irq_domain_ops *ops,
133133
void *host_data)
134134
{
135-
struct device_node *of_node = to_of_node(fwnode);
136135
struct irqchip_fwid *fwid;
137136
struct irq_domain *domain;
138137

139138
static atomic_t unknown_domains;
140139

141140
domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
142-
GFP_KERNEL, of_node_to_nid(of_node));
141+
GFP_KERNEL, of_node_to_nid(to_of_node(fwnode)));
143142
if (!domain)
144143
return NULL;
145144

@@ -177,15 +176,15 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
177176

178177
domain->fwnode = fwnode;
179178
#endif
180-
} else if (of_node) {
179+
} else if (is_of_node(fwnode)) {
181180
char *name;
182181

183182
/*
184-
* DT paths contain '/', which debugfs is legitimately
183+
* fwnode paths contain '/', which debugfs is legitimately
185184
* unhappy about. Replace them with ':', which does
186185
* the trick and is not as offensive as '\'...
187186
*/
188-
name = kasprintf(GFP_KERNEL, "%pOF", of_node);
187+
name = kasprintf(GFP_KERNEL, "%pfw", fwnode);
189188
if (!name) {
190189
kfree(domain);
191190
return NULL;
@@ -210,7 +209,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
210209
domain->flags |= IRQ_DOMAIN_NAME_ALLOCATED;
211210
}
212211

213-
of_node_get(of_node);
212+
fwnode_handle_get(fwnode);
214213

215214
/* Fill structure */
216215
INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL);
@@ -259,7 +258,7 @@ void irq_domain_remove(struct irq_domain *domain)
259258

260259
pr_debug("Removed domain %s\n", domain->name);
261260

262-
of_node_put(irq_domain_get_of_node(domain));
261+
fwnode_handle_put(domain->fwnode);
263262
if (domain->flags & IRQ_DOMAIN_NAME_ALLOCATED)
264263
kfree(domain->name);
265264
kfree(domain);

0 commit comments

Comments
 (0)