Skip to content

Commit b35961c

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent c6b7782 commit b35961c

File tree

3 files changed

+30
-41
lines changed

3 files changed

+30
-41
lines changed

drivers/irqchip/irq-mvebu-gicp.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,12 @@ static const struct msi_parent_ops gicp_msi_parent_ops = {
170170

171171
static int mvebu_gicp_probe(struct platform_device *pdev)
172172
{
173-
struct irq_domain *inner_domain, *parent_domain;
174173
struct device_node *node = pdev->dev.of_node;
175174
struct device_node *irq_parent_dn;
175+
struct irq_domain_info info = {
176+
.fwnode = of_fwnode_handle(node),
177+
.ops = &gicp_domain_ops,
178+
};
176179
struct mvebu_gicp *gicp;
177180
int ret, i;
178181

@@ -217,30 +220,23 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
217220
if (!gicp->spi_bitmap)
218221
return -ENOMEM;
219222

223+
info.size = gicp->spi_cnt;
224+
info.host_data = gicp;
225+
220226
irq_parent_dn = of_irq_find_parent(node);
221227
if (!irq_parent_dn) {
222228
dev_err(&pdev->dev, "failed to find parent IRQ node\n");
223229
return -ENODEV;
224230
}
225231

226-
parent_domain = irq_find_host(irq_parent_dn);
232+
info.parent = irq_find_host(irq_parent_dn);
227233
of_node_put(irq_parent_dn);
228-
if (!parent_domain) {
234+
if (!info.parent) {
229235
dev_err(&pdev->dev, "failed to find parent IRQ domain\n");
230236
return -ENODEV;
231237
}
232238

233-
inner_domain = irq_domain_create_hierarchy(parent_domain, 0,
234-
gicp->spi_cnt,
235-
of_node_to_fwnode(node),
236-
&gicp_domain_ops, gicp);
237-
if (!inner_domain)
238-
return -ENOMEM;
239-
240-
irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI);
241-
inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
242-
inner_domain->msi_parent_ops = &gicp_msi_parent_ops;
243-
return 0;
239+
return msi_create_parent_irq_domain(&info, &gicp_msi_parent_ops) ? 0 : -ENOMEM;
244240
}
245241

246242
static const struct of_device_id mvebu_gicp_of_match[] = {

drivers/irqchip/irq-mvebu-odmi.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ static const struct msi_parent_ops odmi_msi_parent_ops = {
167167
static int __init mvebu_odmi_init(struct device_node *node,
168168
struct device_node *parent)
169169
{
170-
struct irq_domain *parent_domain, *inner_domain;
170+
struct irq_domain_info info = {
171+
.fwnode = of_fwnode_handle(node),
172+
.ops = &odmi_domain_ops,
173+
.size = odmis_count * NODMIS_PER_FRAME,
174+
.parent = irq_find_host(parent),
175+
};
171176
int ret, i;
172177

173178
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,
203208
}
204209
}
205210

206-
parent_domain = irq_find_host(parent);
211+
if (msi_create_parent_irq_domain(&info, &odmi_msi_parent_ops))
212+
return 0;
207213

208-
inner_domain = irq_domain_create_hierarchy(parent_domain, 0,
209-
odmis_count * NODMIS_PER_FRAME,
210-
of_node_to_fwnode(node),
211-
&odmi_domain_ops, NULL);
212-
if (!inner_domain) {
213-
ret = -ENOMEM;
214-
goto err_unmap;
215-
}
216-
217-
irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI);
218-
inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
219-
inner_domain->msi_parent_ops = &odmi_msi_parent_ops;
220-
221-
return 0;
214+
ret = -ENOMEM;
222215

223216
err_unmap:
224217
for (i = 0; i < odmis_count; i++) {

drivers/irqchip/irq-mvebu-sei.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ static const struct msi_parent_ops sei_msi_parent_ops = {
366366
static int mvebu_sei_probe(struct platform_device *pdev)
367367
{
368368
struct device_node *node = pdev->dev.of_node;
369+
struct irq_domain_info info = {
370+
.fwnode = of_fwnode_handle(node),
371+
.ops = &mvebu_sei_cp_domain_ops,
372+
};
369373
struct mvebu_sei *sei;
370374
u32 parent_irq;
371375
int ret;
@@ -402,7 +406,7 @@ static int mvebu_sei_probe(struct platform_device *pdev)
402406
}
403407

404408
/* Create the root SEI domain */
405-
sei->sei_domain = irq_domain_create_linear(of_node_to_fwnode(node),
409+
sei->sei_domain = irq_domain_create_linear(of_fwnode_handle(node),
406410
(sei->caps->ap_range.size +
407411
sei->caps->cp_range.size),
408412
&mvebu_sei_domain_ops,
@@ -418,7 +422,7 @@ static int mvebu_sei_probe(struct platform_device *pdev)
418422
/* Create the 'wired' domain */
419423
sei->ap_domain = irq_domain_create_hierarchy(sei->sei_domain, 0,
420424
sei->caps->ap_range.size,
421-
of_node_to_fwnode(node),
425+
of_fwnode_handle(node),
422426
&mvebu_sei_ap_domain_ops,
423427
sei);
424428
if (!sei->ap_domain) {
@@ -430,21 +434,17 @@ static int mvebu_sei_probe(struct platform_device *pdev)
430434
irq_domain_update_bus_token(sei->ap_domain, DOMAIN_BUS_WIRED);
431435

432436
/* Create the 'MSI' domain */
433-
sei->cp_domain = irq_domain_create_hierarchy(sei->sei_domain, 0,
434-
sei->caps->cp_range.size,
435-
of_node_to_fwnode(node),
436-
&mvebu_sei_cp_domain_ops,
437-
sei);
437+
info.size = sei->caps->cp_range.size;
438+
info.host_data = sei;
439+
info.parent = sei->sei_domain;
440+
441+
sei->cp_domain = msi_create_parent_irq_domain(&info, &sei_msi_parent_ops);
438442
if (!sei->cp_domain) {
439443
pr_err("Failed to create CPs IRQ domain\n");
440444
ret = -ENOMEM;
441445
goto remove_ap_domain;
442446
}
443447

444-
irq_domain_update_bus_token(sei->cp_domain, DOMAIN_BUS_GENERIC_MSI);
445-
sei->cp_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
446-
sei->cp_domain->msi_parent_ops = &sei_msi_parent_ops;
447-
448448
mvebu_sei_reset(sei);
449449

450450
irq_set_chained_handler_and_data(parent_irq, mvebu_sei_handle_cascade_irq, sei);

0 commit comments

Comments
 (0)