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

PCI: Switch to irq_domain_create_linear()

irq_domain_add_linear() is going away as being obsolete now. Switch to
the preferred irq_domain_create_linear(). That differs in the first
parameter: It takes more generic struct fwnode_handle instead of struct
device_node. Therefore, of_fwnode_handle() is added around the
parameter.

Note some of the users can likely use dev->fwnode directly instead of
indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not
guaranteed to be set for all, so this has to be investigated on case to
case basis (by people who can actually test with the HW).

[ tglx: Fix up subject prefix and convert the new instance in
dwc/pcie-amd-mdb.c ]

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250319092951.37667-30-jirislaby@kernel.org



authored by

Jiri Slaby (SUSE) and committed by
Thomas Gleixner
4b5e1d97 e9bf2256

+59 -71
+2 -2
drivers/pci/controller/dwc/pci-dra7xx.c
··· 359 359 360 360 irq_set_chained_handler_and_data(pp->irq, dra7xx_pcie_msi_irq_handler, 361 361 pp); 362 - dra7xx->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, 363 - &intx_domain_ops, pp); 362 + dra7xx->irq_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), 363 + PCI_NUM_INTX, &intx_domain_ops, pp); 364 364 of_node_put(pcie_intc_node); 365 365 if (!dra7xx->irq_domain) { 366 366 dev_err(dev, "Failed to get a INTx IRQ domain\n");
+1 -1
drivers/pci/controller/dwc/pci-keystone.c
··· 761 761 ks_pcie); 762 762 } 763 763 764 - intx_irq_domain = irq_domain_add_linear(intc_np, PCI_NUM_INTX, 764 + intx_irq_domain = irq_domain_create_linear(of_fwnode_handle(intc_np), PCI_NUM_INTX, 765 765 &ks_pcie_intx_irq_domain_ops, NULL); 766 766 if (!intx_irq_domain) { 767 767 dev_err(dev, "Failed to add irq domain for INTX irqs\n");
+4 -4
drivers/pci/controller/dwc/pcie-amd-mdb.c
··· 290 290 return -ENODEV; 291 291 } 292 292 293 - pcie->mdb_domain = irq_domain_add_linear(pcie_intc_node, 32, 294 - &event_domain_ops, pcie); 293 + pcie->mdb_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), 32, 294 + &event_domain_ops, pcie); 295 295 if (!pcie->mdb_domain) { 296 296 err = -ENOMEM; 297 297 dev_err(dev, "Failed to add MDB domain\n"); ··· 300 300 301 301 irq_domain_update_bus_token(pcie->mdb_domain, DOMAIN_BUS_NEXUS); 302 302 303 - pcie->intx_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, 304 - &amd_intx_domain_ops, pcie); 303 + pcie->intx_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), 304 + PCI_NUM_INTX, &amd_intx_domain_ops, pcie); 305 305 if (!pcie->intx_domain) { 306 306 err = -ENOMEM; 307 307 dev_err(dev, "Failed to add INTx domain\n");
+2 -2
drivers/pci/controller/dwc/pcie-dw-rockchip.c
··· 144 144 return -EINVAL; 145 145 } 146 146 147 - rockchip->irq_domain = irq_domain_add_linear(intc, PCI_NUM_INTX, 148 - &intx_domain_ops, rockchip); 147 + rockchip->irq_domain = irq_domain_create_linear(of_fwnode_handle(intc), PCI_NUM_INTX, 148 + &intx_domain_ops, rockchip); 149 149 of_node_put(intc); 150 150 if (!rockchip->irq_domain) { 151 151 dev_err(dev, "failed to get a INTx IRQ domain\n");
+1 -1
drivers/pci/controller/dwc/pcie-uniphier.c
··· 279 279 goto out_put_node; 280 280 } 281 281 282 - pcie->intx_irq_domain = irq_domain_add_linear(np_intc, PCI_NUM_INTX, 282 + pcie->intx_irq_domain = irq_domain_create_linear(of_fwnode_handle(np_intc), PCI_NUM_INTX, 283 283 &uniphier_intx_domain_ops, pp); 284 284 if (!pcie->intx_irq_domain) { 285 285 dev_err(pci->dev, "Failed to get INTx domain\n");
+4 -5
drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
··· 439 439 struct mobiveil_msi *msi = &pcie->rp.msi; 440 440 441 441 mutex_init(&msi->lock); 442 - msi->dev_domain = irq_domain_add_linear(NULL, msi->num_of_vectors, 443 - &msi_domain_ops, pcie); 442 + msi->dev_domain = irq_domain_create_linear(NULL, msi->num_of_vectors, 443 + &msi_domain_ops, pcie); 444 444 if (!msi->dev_domain) { 445 445 dev_err(dev, "failed to create IRQ domain\n"); 446 446 return -ENOMEM; ··· 461 461 static int mobiveil_pcie_init_irq_domain(struct mobiveil_pcie *pcie) 462 462 { 463 463 struct device *dev = &pcie->pdev->dev; 464 - struct device_node *node = dev->of_node; 465 464 struct mobiveil_root_port *rp = &pcie->rp; 466 465 467 466 /* setup INTx */ 468 - rp->intx_domain = irq_domain_add_linear(node, PCI_NUM_INTX, 469 - &intx_domain_ops, pcie); 467 + rp->intx_domain = irq_domain_create_linear(of_fwnode_handle(dev->of_node), PCI_NUM_INTX, 468 + &intx_domain_ops, pcie); 470 469 471 470 if (!rp->intx_domain) { 472 471 dev_err(dev, "Failed to get a INTx IRQ domain\n");
+5 -9
drivers/pci/controller/pci-aardvark.c
··· 1456 1456 raw_spin_lock_init(&pcie->msi_irq_lock); 1457 1457 mutex_init(&pcie->msi_used_lock); 1458 1458 1459 - pcie->msi_inner_domain = 1460 - irq_domain_add_linear(NULL, MSI_IRQ_NUM, 1461 - &advk_msi_domain_ops, pcie); 1459 + pcie->msi_inner_domain = irq_domain_create_linear(NULL, MSI_IRQ_NUM, 1460 + &advk_msi_domain_ops, pcie); 1462 1461 if (!pcie->msi_inner_domain) 1463 1462 return -ENOMEM; 1464 1463 ··· 1507 1508 irq_chip->irq_mask = advk_pcie_irq_mask; 1508 1509 irq_chip->irq_unmask = advk_pcie_irq_unmask; 1509 1510 1510 - pcie->irq_domain = 1511 - irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, 1512 - &advk_pcie_irq_domain_ops, pcie); 1511 + pcie->irq_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), PCI_NUM_INTX, 1512 + &advk_pcie_irq_domain_ops, pcie); 1513 1513 if (!pcie->irq_domain) { 1514 1514 dev_err(dev, "Failed to get a INTx IRQ domain\n"); 1515 1515 ret = -ENOMEM; ··· 1547 1549 1548 1550 static int advk_pcie_init_rp_irq_domain(struct advk_pcie *pcie) 1549 1551 { 1550 - pcie->rp_irq_domain = irq_domain_add_linear(NULL, 1, 1551 - &advk_pcie_rp_irq_domain_ops, 1552 - pcie); 1552 + pcie->rp_irq_domain = irq_domain_create_linear(NULL, 1, &advk_pcie_rp_irq_domain_ops, pcie); 1553 1553 if (!pcie->rp_irq_domain) { 1554 1554 dev_err(&pcie->pdev->dev, "Failed to add Root Port IRQ domain\n"); 1555 1555 return -ENOMEM;
+2 -2
drivers/pci/controller/pci-ftpci100.c
··· 345 345 return irq ?: -EINVAL; 346 346 } 347 347 348 - p->irqdomain = irq_domain_add_linear(intc, PCI_NUM_INTX, 349 - &faraday_pci_irqdomain_ops, p); 348 + p->irqdomain = irq_domain_create_linear(of_fwnode_handle(intc), PCI_NUM_INTX, 349 + &faraday_pci_irqdomain_ops, p); 350 350 of_node_put(intc); 351 351 if (!p->irqdomain) { 352 352 dev_err(p->dev, "failed to create Gemini PCI IRQ domain\n");
+3 -3
drivers/pci/controller/pci-mvebu.c
··· 1078 1078 return -ENODEV; 1079 1079 } 1080 1080 1081 - port->intx_irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, 1082 - &mvebu_pcie_intx_irq_domain_ops, 1083 - port); 1081 + port->intx_irq_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), 1082 + PCI_NUM_INTX, 1083 + &mvebu_pcie_intx_irq_domain_ops, port); 1084 1084 of_node_put(pcie_intc_node); 1085 1085 if (!port->intx_irq_domain) { 1086 1086 dev_err(dev, "Failed to get INTx IRQ domain for %s\n", port->name);
+1 -1
drivers/pci/controller/pcie-altera-msi.c
··· 166 166 { 167 167 struct fwnode_handle *fwnode = of_fwnode_handle(msi->pdev->dev.of_node); 168 168 169 - msi->inner_domain = irq_domain_add_linear(NULL, msi->num_of_vectors, 169 + msi->inner_domain = irq_domain_create_linear(NULL, msi->num_of_vectors, 170 170 &msi_domain_ops, msi); 171 171 if (!msi->inner_domain) { 172 172 dev_err(&msi->pdev->dev, "failed to create IRQ domain\n");
+1 -1
drivers/pci/controller/pcie-altera.c
··· 855 855 struct device_node *node = dev->of_node; 856 856 857 857 /* Setup INTx */ 858 - pcie->irq_domain = irq_domain_add_linear(node, PCI_NUM_INTX, 858 + pcie->irq_domain = irq_domain_create_linear(of_fwnode_handle(node), PCI_NUM_INTX, 859 859 &intx_domain_ops, pcie); 860 860 if (!pcie->irq_domain) { 861 861 dev_err(dev, "Failed to get a INTx IRQ domain\n");
+1 -1
drivers/pci/controller/pcie-brcmstb.c
··· 584 584 struct fwnode_handle *fwnode = of_fwnode_handle(msi->np); 585 585 struct device *dev = msi->dev; 586 586 587 - msi->inner_domain = irq_domain_add_linear(NULL, msi->nr, &msi_domain_ops, msi); 587 + msi->inner_domain = irq_domain_create_linear(NULL, msi->nr, &msi_domain_ops, msi); 588 588 if (!msi->inner_domain) { 589 589 dev_err(dev, "failed to create IRQ domain\n"); 590 590 return -ENOMEM;
+2 -2
drivers/pci/controller/pcie-iproc-msi.c
··· 446 446 static int iproc_msi_alloc_domains(struct device_node *node, 447 447 struct iproc_msi *msi) 448 448 { 449 - msi->inner_domain = irq_domain_add_linear(NULL, msi->nr_msi_vecs, 450 - &msi_domain_ops, msi); 449 + msi->inner_domain = irq_domain_create_linear(NULL, msi->nr_msi_vecs, 450 + &msi_domain_ops, msi); 451 451 if (!msi->inner_domain) 452 452 return -ENOMEM; 453 453
+5 -4
drivers/pci/controller/pcie-mediatek-gen3.c
··· 745 745 return -ENODEV; 746 746 } 747 747 748 - pcie->intx_domain = irq_domain_add_linear(intc_node, PCI_NUM_INTX, 749 - &intx_domain_ops, pcie); 748 + pcie->intx_domain = irq_domain_create_linear(of_fwnode_handle(intc_node), PCI_NUM_INTX, 749 + &intx_domain_ops, pcie); 750 750 if (!pcie->intx_domain) { 751 751 dev_err(dev, "failed to create INTx IRQ domain\n"); 752 752 ret = -ENODEV; ··· 756 756 /* Setup MSI */ 757 757 mutex_init(&pcie->lock); 758 758 759 - pcie->msi_bottom_domain = irq_domain_add_linear(node, PCIE_MSI_IRQS_NUM, 760 - &mtk_msi_bottom_domain_ops, pcie); 759 + pcie->msi_bottom_domain = irq_domain_create_linear(of_fwnode_handle(node), 760 + PCIE_MSI_IRQS_NUM, 761 + &mtk_msi_bottom_domain_ops, pcie); 761 762 if (!pcie->msi_bottom_domain) { 762 763 dev_err(dev, "failed to create MSI bottom domain\n"); 763 764 ret = -ENODEV;
+2 -2
drivers/pci/controller/pcie-mediatek.c
··· 569 569 return -ENODEV; 570 570 } 571 571 572 - port->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, 573 - &intx_domain_ops, port); 572 + port->irq_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), PCI_NUM_INTX, 573 + &intx_domain_ops, port); 574 574 of_node_put(pcie_intc_node); 575 575 if (!port->irq_domain) { 576 576 dev_err(dev, "failed to get INTx IRQ domain\n");
+2 -2
drivers/pci/controller/pcie-rockchip-host.c
··· 693 693 return -EINVAL; 694 694 } 695 695 696 - rockchip->irq_domain = irq_domain_add_linear(intc, PCI_NUM_INTX, 697 - &intx_domain_ops, rockchip); 696 + rockchip->irq_domain = irq_domain_create_linear(of_fwnode_handle(intc), PCI_NUM_INTX, 697 + &intx_domain_ops, rockchip); 698 698 of_node_put(intc); 699 699 if (!rockchip->irq_domain) { 700 700 dev_err(dev, "failed to get a INTx IRQ domain\n");
+4 -6
drivers/pci/controller/pcie-xilinx-cpm.c
··· 395 395 return -EINVAL; 396 396 } 397 397 398 - port->cpm_domain = irq_domain_add_linear(pcie_intc_node, 32, 399 - &event_domain_ops, 400 - port); 398 + port->cpm_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), 32, 399 + &event_domain_ops, port); 401 400 if (!port->cpm_domain) 402 401 goto out; 403 402 404 403 irq_domain_update_bus_token(port->cpm_domain, DOMAIN_BUS_NEXUS); 405 404 406 - port->intx_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, 407 - &intx_domain_ops, 408 - port); 405 + port->intx_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), PCI_NUM_INTX, 406 + &intx_domain_ops, port); 409 407 if (!port->intx_domain) 410 408 goto out; 411 409
+6 -6
drivers/pci/controller/pcie-xilinx-dma-pl.c
··· 472 472 int size = BITS_TO_LONGS(XILINX_NUM_MSI_IRQS) * sizeof(long); 473 473 struct fwnode_handle *fwnode = of_fwnode_handle(port->dev->of_node); 474 474 475 - msi->dev_domain = irq_domain_add_linear(NULL, XILINX_NUM_MSI_IRQS, 476 - &dev_msi_domain_ops, port); 475 + msi->dev_domain = irq_domain_create_linear(NULL, XILINX_NUM_MSI_IRQS, 476 + &dev_msi_domain_ops, port); 477 477 if (!msi->dev_domain) 478 478 goto out; 479 479 ··· 585 585 return -EINVAL; 586 586 } 587 587 588 - port->pldma_domain = irq_domain_add_linear(pcie_intc_node, 32, 589 - &event_domain_ops, port); 588 + port->pldma_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), 32, 589 + &event_domain_ops, port); 590 590 if (!port->pldma_domain) 591 591 return -ENOMEM; 592 592 593 593 irq_domain_update_bus_token(port->pldma_domain, DOMAIN_BUS_NEXUS); 594 594 595 - port->intx_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, 596 - &intx_domain_ops, port); 595 + port->intx_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), PCI_NUM_INTX, 596 + &intx_domain_ops, port); 597 597 if (!port->intx_domain) { 598 598 dev_err(dev, "Failed to get a INTx IRQ domain\n"); 599 599 return -ENOMEM;
+3 -6
drivers/pci/controller/pcie-xilinx-nwl.c
··· 498 498 struct fwnode_handle *fwnode = of_fwnode_handle(dev->of_node); 499 499 struct nwl_msi *msi = &pcie->msi; 500 500 501 - msi->dev_domain = irq_domain_add_linear(NULL, INT_PCI_MSI_NR, 502 - &dev_msi_domain_ops, pcie); 501 + msi->dev_domain = irq_domain_create_linear(NULL, INT_PCI_MSI_NR, &dev_msi_domain_ops, pcie); 503 502 if (!msi->dev_domain) { 504 503 dev_err(dev, "failed to create dev IRQ domain\n"); 505 504 return -ENOMEM; ··· 581 582 return -EINVAL; 582 583 } 583 584 584 - pcie->intx_irq_domain = irq_domain_add_linear(intc_node, 585 - PCI_NUM_INTX, 586 - &intx_domain_ops, 587 - pcie); 585 + pcie->intx_irq_domain = irq_domain_create_linear(of_fwnode_handle(intc_node), PCI_NUM_INTX, 586 + &intx_domain_ops, pcie); 588 587 of_node_put(intc_node); 589 588 if (!pcie->intx_irq_domain) { 590 589 dev_err(dev, "failed to create IRQ domain\n");
+2 -3
drivers/pci/controller/pcie-xilinx.c
··· 461 461 return -ENODEV; 462 462 } 463 463 464 - pcie->leg_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, 465 - &intx_domain_ops, 466 - pcie); 464 + pcie->leg_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), PCI_NUM_INTX, 465 + &intx_domain_ops, pcie); 467 466 of_node_put(pcie_intc_node); 468 467 if (!pcie->leg_domain) { 469 468 dev_err(dev, "Failed to get a INTx IRQ domain\n");
+6 -8
drivers/pci/controller/plda/pcie-plda-host.c
··· 155 155 156 156 mutex_init(&port->msi.lock); 157 157 158 - msi->dev_domain = irq_domain_add_linear(NULL, msi->num_vectors, 159 - &msi_domain_ops, port); 158 + msi->dev_domain = irq_domain_create_linear(NULL, msi->num_vectors, &msi_domain_ops, port); 160 159 if (!msi->dev_domain) { 161 160 dev_err(dev, "failed to create IRQ domain\n"); 162 161 return -ENOMEM; ··· 392 393 return -EINVAL; 393 394 } 394 395 395 - port->event_domain = irq_domain_add_linear(pcie_intc_node, 396 - port->num_events, 397 - &plda_event_domain_ops, 398 - port); 396 + port->event_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), 397 + port->num_events, &plda_event_domain_ops, 398 + port); 399 399 if (!port->event_domain) { 400 400 dev_err(dev, "failed to get event domain\n"); 401 401 of_node_put(pcie_intc_node); ··· 403 405 404 406 irq_domain_update_bus_token(port->event_domain, DOMAIN_BUS_NEXUS); 405 407 406 - port->intx_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, 407 - &intx_domain_ops, port); 408 + port->intx_domain = irq_domain_create_linear(of_fwnode_handle(pcie_intc_node), PCI_NUM_INTX, 409 + &intx_domain_ops, port); 408 410 if (!port->intx_domain) { 409 411 dev_err(dev, "failed to get an INTx IRQ domain\n"); 410 412 of_node_put(pcie_intc_node);