Commit 181e9d4e authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Marc Zyngier

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200520164927.39090-1-andriy.shevchenko@linux.intel.com
parent 128516e4
...@@ -132,14 +132,13 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, ...@@ -132,14 +132,13 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
const struct irq_domain_ops *ops, const struct irq_domain_ops *ops,
void *host_data) void *host_data)
{ {
struct device_node *of_node = to_of_node(fwnode);
struct irqchip_fwid *fwid; struct irqchip_fwid *fwid;
struct irq_domain *domain; struct irq_domain *domain;
static atomic_t unknown_domains; static atomic_t unknown_domains;
domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size), domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
GFP_KERNEL, of_node_to_nid(of_node)); GFP_KERNEL, of_node_to_nid(to_of_node(fwnode)));
if (!domain) if (!domain)
return NULL; return NULL;
...@@ -177,15 +176,15 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, ...@@ -177,15 +176,15 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
domain->fwnode = fwnode; domain->fwnode = fwnode;
#endif #endif
} else if (of_node) { } else if (is_of_node(fwnode)) {
char *name; char *name;
/* /*
* DT paths contain '/', which debugfs is legitimately * fwnode paths contain '/', which debugfs is legitimately
* unhappy about. Replace them with ':', which does * unhappy about. Replace them with ':', which does
* the trick and is not as offensive as '\'... * the trick and is not as offensive as '\'...
*/ */
name = kasprintf(GFP_KERNEL, "%pOF", of_node); name = kasprintf(GFP_KERNEL, "%pfw", fwnode);
if (!name) { if (!name) {
kfree(domain); kfree(domain);
return NULL; return NULL;
...@@ -210,7 +209,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, ...@@ -210,7 +209,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
domain->flags |= IRQ_DOMAIN_NAME_ALLOCATED; domain->flags |= IRQ_DOMAIN_NAME_ALLOCATED;
} }
of_node_get(of_node); fwnode_handle_get(fwnode);
/* Fill structure */ /* Fill structure */
INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL); INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL);
...@@ -259,7 +258,7 @@ void irq_domain_remove(struct irq_domain *domain) ...@@ -259,7 +258,7 @@ void irq_domain_remove(struct irq_domain *domain)
pr_debug("Removed domain %s\n", domain->name); pr_debug("Removed domain %s\n", domain->name);
of_node_put(irq_domain_get_of_node(domain)); fwnode_handle_put(domain->fwnode);
if (domain->flags & IRQ_DOMAIN_NAME_ALLOCATED) if (domain->flags & IRQ_DOMAIN_NAME_ALLOCATED)
kfree(domain->name); kfree(domain->name);
kfree(domain); kfree(domain);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment