]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: controller: Use dev_fwnode() instead of of_fwnode_handle()
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Wed, 11 Jun 2025 10:43:44 +0000 (12:43 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 24 Jul 2025 21:00:47 +0000 (16:00 -0500)
All irq_domain functions now accept fwnode instead of of_node. But many
PCI controllers still extract dev to of_node and then of_node to fwnode.

Instead, clean this up and simply use the dev_fwnode() helper to extract
fwnode directly from dev. Internally, it still does dev => of_node =>
fwnode steps, but it's now hidden from the users.

In the case of altera, this also removes an unused 'node' variable that is
only used when CONFIG_OF is enabled:

  drivers/pci/controller/pcie-altera.c: In function 'altera_pcie_init_irq_domain':
  drivers/pci/controller/pcie-altera.c:855:29: error: unused variable 'node' [-Werror=unused-variable]
    855 |         struct device_node *node = dev->of_node;

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de> # altera
[bhelgaas: squash together, rebase to precede msi-parent]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250521163329.2137973-1-arnd@kernel.org
Link: https://patch.msgid.link/20250611104348.192092-16-jirislaby@kernel.org
Link: https://patch.msgid.link/20250723065907.1841758-1-jirislaby@kernel.org
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
drivers/pci/controller/pcie-altera-msi.c
drivers/pci/controller/pcie-altera.c
drivers/pci/controller/pcie-mediatek-gen3.c
drivers/pci/controller/pcie-mediatek.c
drivers/pci/controller/pcie-xilinx-dma-pl.c
drivers/pci/controller/pcie-xilinx-nwl.c
drivers/pci/controller/plda/pcie-plda-host.c

index 906277f9ffaf79f2c5c3c76f1941556bebdba38f..1e1291f2e2afb9455ad7c2033a42e26d4154f120 100644 (file)
@@ -227,7 +227,7 @@ static const struct irq_domain_ops dw_pcie_msi_domain_ops = {
 int dw_pcie_allocate_domains(struct dw_pcie_rp *pp)
 {
        struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
-       struct fwnode_handle *fwnode = of_fwnode_handle(pci->dev->of_node);
+       struct fwnode_handle *fwnode = dev_fwnode(pci->dev);
 
        pp->irq_domain = irq_domain_create_linear(fwnode, pp->num_vectors,
                                               &dw_pcie_msi_domain_ops, pp);
index a600f46ee3c3591ff59f3fa6df0498fe33312fd5..98e90fcbeceb503ebb3a1792f8e56d8928a224fc 100644 (file)
@@ -435,7 +435,7 @@ static const struct irq_domain_ops msi_domain_ops = {
 static int mobiveil_allocate_msi_domains(struct mobiveil_pcie *pcie)
 {
        struct device *dev = &pcie->pdev->dev;
-       struct fwnode_handle *fwnode = of_fwnode_handle(dev->of_node);
+       struct fwnode_handle *fwnode = dev_fwnode(dev);
        struct mobiveil_msi *msi = &pcie->rp.msi;
 
        mutex_init(&msi->lock);
@@ -464,9 +464,8 @@ static int mobiveil_pcie_init_irq_domain(struct mobiveil_pcie *pcie)
        struct mobiveil_root_port *rp = &pcie->rp;
 
        /* setup INTx */
-       rp->intx_domain = irq_domain_create_linear(of_fwnode_handle(dev->of_node), PCI_NUM_INTX,
-                                                  &intx_domain_ops, pcie);
-
+       rp->intx_domain = irq_domain_create_linear(dev_fwnode(dev), PCI_NUM_INTX, &intx_domain_ops,
+                                                  pcie);
        if (!rp->intx_domain) {
                dev_err(dev, "Failed to get a INTx IRQ domain\n");
                return -ENOMEM;
index a43f21eb8fbb92049e1476aea6c6dcb4ee1a4c46..08e07c81920223e025398cffe31654190fb2c14c 100644 (file)
@@ -164,7 +164,7 @@ static const struct irq_domain_ops msi_domain_ops = {
 
 static int altera_allocate_domains(struct altera_msi *msi)
 {
-       struct fwnode_handle *fwnode = of_fwnode_handle(msi->pdev->dev.of_node);
+       struct fwnode_handle *fwnode = dev_fwnode(&msi->pdev->dev);
 
        msi->inner_domain = irq_domain_create_linear(NULL, msi->num_of_vectors,
                                             &msi_domain_ops, msi);
index 0fc77176a52ed76fcbe8d1567f670c872da14d8a..3dbb7adc421c4a8e23bd6b0a441df033f1f62567 100644 (file)
@@ -852,10 +852,9 @@ static void aglx_isr(struct irq_desc *desc)
 static int altera_pcie_init_irq_domain(struct altera_pcie *pcie)
 {
        struct device *dev = &pcie->pdev->dev;
-       struct device_node *node = dev->of_node;
 
        /* Setup INTx */
-       pcie->irq_domain = irq_domain_create_linear(of_fwnode_handle(node), PCI_NUM_INTX,
+       pcie->irq_domain = irq_domain_create_linear(dev_fwnode(dev), PCI_NUM_INTX,
                                        &intx_domain_ops, pcie);
        if (!pcie->irq_domain) {
                dev_err(dev, "Failed to get a INTx IRQ domain\n");
index b55f5973414c1d4c267a749a8cbe435fc4c97b51..5464b4ae5c20c6c167b172dba598a77af70c6ad2 100644 (file)
@@ -756,8 +756,7 @@ static int mtk_pcie_init_irq_domains(struct mtk_gen3_pcie *pcie)
        /* Setup MSI */
        mutex_init(&pcie->lock);
 
-       pcie->msi_bottom_domain = irq_domain_create_linear(of_fwnode_handle(node),
-                                                          PCIE_MSI_IRQS_NUM,
+       pcie->msi_bottom_domain = irq_domain_create_linear(dev_fwnode(dev), PCIE_MSI_IRQS_NUM,
                                                           &mtk_msi_bottom_domain_ops, pcie);
        if (!pcie->msi_bottom_domain) {
                dev_err(dev, "failed to create MSI bottom domain\n");
index e1934aa06c8d579aa8d5a36e9ef4f41614891eae..594b16929fe4a495957383e2a72df83cb3890d45 100644 (file)
@@ -485,7 +485,7 @@ static struct msi_domain_info mtk_msi_domain_info = {
 
 static int mtk_pcie_allocate_msi_domains(struct mtk_pcie_port *port)
 {
-       struct fwnode_handle *fwnode = of_fwnode_handle(port->pcie->dev->of_node);
+       struct fwnode_handle *fwnode = dev_fwnode(port->pcie->dev);
 
        mutex_init(&port->lock);
 
index dc9690a535e160d1851d192801fd2e5a4bf68752..e044715b7f6ad52ee97b0a00944952649a9436de 100644 (file)
@@ -470,7 +470,7 @@ static int xilinx_pl_dma_pcie_init_msi_irq_domain(struct pl_dma_pcie *port)
        struct device *dev = port->dev;
        struct xilinx_msi *msi = &port->msi;
        int size = BITS_TO_LONGS(XILINX_NUM_MSI_IRQS) * sizeof(long);
-       struct fwnode_handle *fwnode = of_fwnode_handle(port->dev->of_node);
+       struct fwnode_handle *fwnode = dev_fwnode(port->dev);
 
        msi->dev_domain = irq_domain_create_linear(NULL, XILINX_NUM_MSI_IRQS,
                                                   &dev_msi_domain_ops, port);
index c8b05477b7198567d3ad5c51c2ce80032bba7cdd..eda87e91743063ce059c624e655da6fd76a879c0 100644 (file)
@@ -495,7 +495,7 @@ static int nwl_pcie_init_msi_irq_domain(struct nwl_pcie *pcie)
 {
 #ifdef CONFIG_PCI_MSI
        struct device *dev = pcie->dev;
-       struct fwnode_handle *fwnode = of_fwnode_handle(dev->of_node);
+       struct fwnode_handle *fwnode = dev_fwnode(dev);
        struct nwl_msi *msi = &pcie->msi;
 
        msi->dev_domain = irq_domain_create_linear(NULL, INT_PCI_MSI_NR, &dev_msi_domain_ops, pcie);
index 3abedf723215c8dad0675e0b0d3cf64a13567e7b..fdf9ec110e7a73f1d040fd6761f84caadda20861 100644 (file)
@@ -150,7 +150,7 @@ static struct msi_domain_info plda_msi_domain_info = {
 static int plda_allocate_msi_domains(struct plda_pcie_rp *port)
 {
        struct device *dev = port->dev;
-       struct fwnode_handle *fwnode = of_fwnode_handle(dev->of_node);
+       struct fwnode_handle *fwnode = dev_fwnode(dev);
        struct plda_msi *msi = &port->msi;
 
        mutex_init(&port->msi.lock);