Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Marc Zyngier and committed by
Thomas Gleixner
b35961ce c6b77822

+30 -41
+10 -14
drivers/irqchip/irq-mvebu-gicp.c
··· 170 170 171 171 static int mvebu_gicp_probe(struct platform_device *pdev) 172 172 { 173 - struct irq_domain *inner_domain, *parent_domain; 174 173 struct device_node *node = pdev->dev.of_node; 175 174 struct device_node *irq_parent_dn; 175 + struct irq_domain_info info = { 176 + .fwnode = of_fwnode_handle(node), 177 + .ops = &gicp_domain_ops, 178 + }; 176 179 struct mvebu_gicp *gicp; 177 180 int ret, i; 178 181 ··· 220 217 if (!gicp->spi_bitmap) 221 218 return -ENOMEM; 222 219 220 + info.size = gicp->spi_cnt; 221 + info.host_data = gicp; 222 + 223 223 irq_parent_dn = of_irq_find_parent(node); 224 224 if (!irq_parent_dn) { 225 225 dev_err(&pdev->dev, "failed to find parent IRQ node\n"); 226 226 return -ENODEV; 227 227 } 228 228 229 - parent_domain = irq_find_host(irq_parent_dn); 229 + info.parent = irq_find_host(irq_parent_dn); 230 230 of_node_put(irq_parent_dn); 231 - if (!parent_domain) { 231 + if (!info.parent) { 232 232 dev_err(&pdev->dev, "failed to find parent IRQ domain\n"); 233 233 return -ENODEV; 234 234 } 235 235 236 - inner_domain = irq_domain_create_hierarchy(parent_domain, 0, 237 - gicp->spi_cnt, 238 - of_node_to_fwnode(node), 239 - &gicp_domain_ops, gicp); 240 - if (!inner_domain) 241 - return -ENOMEM; 242 - 243 - irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI); 244 - inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; 245 - inner_domain->msi_parent_ops = &gicp_msi_parent_ops; 246 - return 0; 236 + return msi_create_parent_irq_domain(&info, &gicp_msi_parent_ops) ? 0 : -ENOMEM; 247 237 } 248 238 249 239 static const struct of_device_id mvebu_gicp_of_match[] = {
+9 -16
drivers/irqchip/irq-mvebu-odmi.c
··· 167 167 static int __init mvebu_odmi_init(struct device_node *node, 168 168 struct device_node *parent) 169 169 { 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 + }; 171 176 int ret, i; 172 177 173 178 if (of_property_read_u32(node, "marvell,odmi-frames", &odmis_count)) ··· 208 203 } 209 204 } 210 205 211 - parent_domain = irq_find_host(parent); 206 + if (msi_create_parent_irq_domain(&info, &odmi_msi_parent_ops)) 207 + return 0; 212 208 213 - inner_domain = irq_domain_create_hierarchy(parent_domain, 0, 214 - odmis_count * NODMIS_PER_FRAME, 215 - of_node_to_fwnode(node), 216 - &odmi_domain_ops, NULL); 217 - if (!inner_domain) { 218 - ret = -ENOMEM; 219 - goto err_unmap; 220 - } 221 - 222 - irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI); 223 - inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; 224 - inner_domain->msi_parent_ops = &odmi_msi_parent_ops; 225 - 226 - return 0; 209 + ret = -ENOMEM; 227 210 228 211 err_unmap: 229 212 for (i = 0; i < odmis_count; i++) {
+11 -11
drivers/irqchip/irq-mvebu-sei.c
··· 366 366 static int mvebu_sei_probe(struct platform_device *pdev) 367 367 { 368 368 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 + }; 369 373 struct mvebu_sei *sei; 370 374 u32 parent_irq; 371 375 int ret; ··· 406 402 } 407 403 408 404 /* Create the root SEI domain */ 409 - sei->sei_domain = irq_domain_create_linear(of_node_to_fwnode(node), 405 + sei->sei_domain = irq_domain_create_linear(of_fwnode_handle(node), 410 406 (sei->caps->ap_range.size + 411 407 sei->caps->cp_range.size), 412 408 &mvebu_sei_domain_ops, ··· 422 418 /* Create the 'wired' domain */ 423 419 sei->ap_domain = irq_domain_create_hierarchy(sei->sei_domain, 0, 424 420 sei->caps->ap_range.size, 425 - of_node_to_fwnode(node), 421 + of_fwnode_handle(node), 426 422 &mvebu_sei_ap_domain_ops, 427 423 sei); 428 424 if (!sei->ap_domain) { ··· 434 430 irq_domain_update_bus_token(sei->ap_domain, DOMAIN_BUS_WIRED); 435 431 436 432 /* Create the 'MSI' domain */ 437 - sei->cp_domain = irq_domain_create_hierarchy(sei->sei_domain, 0, 438 - sei->caps->cp_range.size, 439 - of_node_to_fwnode(node), 440 - &mvebu_sei_cp_domain_ops, 441 - sei); 433 + info.size = sei->caps->cp_range.size; 434 + info.host_data = sei; 435 + info.parent = sei->sei_domain; 436 + 437 + sei->cp_domain = msi_create_parent_irq_domain(&info, &sei_msi_parent_ops); 442 438 if (!sei->cp_domain) { 443 439 pr_err("Failed to create CPs IRQ domain\n"); 444 440 ret = -ENOMEM; 445 441 goto remove_ap_domain; 446 442 } 447 - 448 - irq_domain_update_bus_token(sei->cp_domain, DOMAIN_BUS_GENERIC_MSI); 449 - sei->cp_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; 450 - sei->cp_domain->msi_parent_ops = &sei_msi_parent_ops; 451 443 452 444 mvebu_sei_reset(sei); 453 445