mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 10:01:39 -05:00
irqchip/mvebu: Convert to msi_create_parent_irq_domain() helper
Switch the MVEBU family of interrupt chip drivers over to the common helper function to create the interrupt domains. [ tglx: Moved the struct out of the function call argument and fix up the of_node_to_fwnode() instances ] Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250513172819.2216709-5-maz@kernel.org
This commit is contained in:
committed by
Thomas Gleixner
parent
c6b7782234
commit
b35961ce0a
@@ -170,9 +170,12 @@ static const struct msi_parent_ops gicp_msi_parent_ops = {
|
||||
|
||||
static int mvebu_gicp_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct irq_domain *inner_domain, *parent_domain;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct device_node *irq_parent_dn;
|
||||
struct irq_domain_info info = {
|
||||
.fwnode = of_fwnode_handle(node),
|
||||
.ops = &gicp_domain_ops,
|
||||
};
|
||||
struct mvebu_gicp *gicp;
|
||||
int ret, i;
|
||||
|
||||
@@ -217,30 +220,23 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
|
||||
if (!gicp->spi_bitmap)
|
||||
return -ENOMEM;
|
||||
|
||||
info.size = gicp->spi_cnt;
|
||||
info.host_data = gicp;
|
||||
|
||||
irq_parent_dn = of_irq_find_parent(node);
|
||||
if (!irq_parent_dn) {
|
||||
dev_err(&pdev->dev, "failed to find parent IRQ node\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
parent_domain = irq_find_host(irq_parent_dn);
|
||||
info.parent = irq_find_host(irq_parent_dn);
|
||||
of_node_put(irq_parent_dn);
|
||||
if (!parent_domain) {
|
||||
if (!info.parent) {
|
||||
dev_err(&pdev->dev, "failed to find parent IRQ domain\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
inner_domain = irq_domain_create_hierarchy(parent_domain, 0,
|
||||
gicp->spi_cnt,
|
||||
of_node_to_fwnode(node),
|
||||
&gicp_domain_ops, gicp);
|
||||
if (!inner_domain)
|
||||
return -ENOMEM;
|
||||
|
||||
irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI);
|
||||
inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
|
||||
inner_domain->msi_parent_ops = &gicp_msi_parent_ops;
|
||||
return 0;
|
||||
return msi_create_parent_irq_domain(&info, &gicp_msi_parent_ops) ? 0 : -ENOMEM;
|
||||
}
|
||||
|
||||
static const struct of_device_id mvebu_gicp_of_match[] = {
|
||||
|
||||
@@ -167,7 +167,12 @@ static const struct msi_parent_ops odmi_msi_parent_ops = {
|
||||
static int __init mvebu_odmi_init(struct device_node *node,
|
||||
struct device_node *parent)
|
||||
{
|
||||
struct irq_domain *parent_domain, *inner_domain;
|
||||
struct irq_domain_info info = {
|
||||
.fwnode = of_fwnode_handle(node),
|
||||
.ops = &odmi_domain_ops,
|
||||
.size = odmis_count * NODMIS_PER_FRAME,
|
||||
.parent = irq_find_host(parent),
|
||||
};
|
||||
int ret, i;
|
||||
|
||||
if (of_property_read_u32(node, "marvell,odmi-frames", &odmis_count))
|
||||
@@ -203,22 +208,10 @@ static int __init mvebu_odmi_init(struct device_node *node,
|
||||
}
|
||||
}
|
||||
|
||||
parent_domain = irq_find_host(parent);
|
||||
if (msi_create_parent_irq_domain(&info, &odmi_msi_parent_ops))
|
||||
return 0;
|
||||
|
||||
inner_domain = irq_domain_create_hierarchy(parent_domain, 0,
|
||||
odmis_count * NODMIS_PER_FRAME,
|
||||
of_node_to_fwnode(node),
|
||||
&odmi_domain_ops, NULL);
|
||||
if (!inner_domain) {
|
||||
ret = -ENOMEM;
|
||||
goto err_unmap;
|
||||
}
|
||||
|
||||
irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI);
|
||||
inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
|
||||
inner_domain->msi_parent_ops = &odmi_msi_parent_ops;
|
||||
|
||||
return 0;
|
||||
ret = -ENOMEM;
|
||||
|
||||
err_unmap:
|
||||
for (i = 0; i < odmis_count; i++) {
|
||||
|
||||
@@ -366,6 +366,10 @@ static const struct msi_parent_ops sei_msi_parent_ops = {
|
||||
static int mvebu_sei_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct irq_domain_info info = {
|
||||
.fwnode = of_fwnode_handle(node),
|
||||
.ops = &mvebu_sei_cp_domain_ops,
|
||||
};
|
||||
struct mvebu_sei *sei;
|
||||
u32 parent_irq;
|
||||
int ret;
|
||||
@@ -402,7 +406,7 @@ static int mvebu_sei_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/* Create the root SEI domain */
|
||||
sei->sei_domain = irq_domain_create_linear(of_node_to_fwnode(node),
|
||||
sei->sei_domain = irq_domain_create_linear(of_fwnode_handle(node),
|
||||
(sei->caps->ap_range.size +
|
||||
sei->caps->cp_range.size),
|
||||
&mvebu_sei_domain_ops,
|
||||
@@ -418,7 +422,7 @@ static int mvebu_sei_probe(struct platform_device *pdev)
|
||||
/* Create the 'wired' domain */
|
||||
sei->ap_domain = irq_domain_create_hierarchy(sei->sei_domain, 0,
|
||||
sei->caps->ap_range.size,
|
||||
of_node_to_fwnode(node),
|
||||
of_fwnode_handle(node),
|
||||
&mvebu_sei_ap_domain_ops,
|
||||
sei);
|
||||
if (!sei->ap_domain) {
|
||||
@@ -430,21 +434,17 @@ static int mvebu_sei_probe(struct platform_device *pdev)
|
||||
irq_domain_update_bus_token(sei->ap_domain, DOMAIN_BUS_WIRED);
|
||||
|
||||
/* Create the 'MSI' domain */
|
||||
sei->cp_domain = irq_domain_create_hierarchy(sei->sei_domain, 0,
|
||||
sei->caps->cp_range.size,
|
||||
of_node_to_fwnode(node),
|
||||
&mvebu_sei_cp_domain_ops,
|
||||
sei);
|
||||
info.size = sei->caps->cp_range.size;
|
||||
info.host_data = sei;
|
||||
info.parent = sei->sei_domain;
|
||||
|
||||
sei->cp_domain = msi_create_parent_irq_domain(&info, &sei_msi_parent_ops);
|
||||
if (!sei->cp_domain) {
|
||||
pr_err("Failed to create CPs IRQ domain\n");
|
||||
ret = -ENOMEM;
|
||||
goto remove_ap_domain;
|
||||
}
|
||||
|
||||
irq_domain_update_bus_token(sei->cp_domain, DOMAIN_BUS_GENERIC_MSI);
|
||||
sei->cp_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
|
||||
sei->cp_domain->msi_parent_ops = &sei_msi_parent_ops;
|
||||
|
||||
mvebu_sei_reset(sei);
|
||||
|
||||
irq_set_chained_handler_and_data(parent_irq, mvebu_sei_handle_cascade_irq, sei);
|
||||
|
||||
Reference in New Issue
Block a user