]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: mdio: thunder: Use pure PCI devres API
authorPhilipp Stanner <phasta@kernel.org>
Fri, 25 Apr 2025 08:57:39 +0000 (10:57 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 28 Apr 2025 23:19:16 +0000 (16:19 -0700)
The currently used function pci_request_regions() is one of the
problematic "hybrid devres" PCI functions, which are sometimes managed
through devres, and sometimes not (depending on whether
pci_enable_device() or pcim_enable_device() has been called before).

The PCI subsystem wants to remove this behavior and, therefore, needs to
port all users to functions that don't have this problem.

Furthermore, the PCI function being managed implies that it's not
necessary to call pci_release_regions() manually.

Remove the calls to pci_release_regions().

Replace pci_request_regions() with pcim_request_all_regions().

Signed-off-by: Philipp Stanner <phasta@kernel.org>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20250425085740.65304-8-phasta@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/mdio/mdio-thunder.c

index 1e1aa72b1eff8018f6e4650af4e7d59e5f27c345..a3047f7258a7236cb1484716350a649d06094426 100644 (file)
@@ -40,16 +40,16 @@ static int thunder_mdiobus_pci_probe(struct pci_dev *pdev,
                return err;
        }
 
-       err = pci_request_regions(pdev, KBUILD_MODNAME);
+       err = pcim_request_all_regions(pdev, KBUILD_MODNAME);
        if (err) {
-               dev_err(&pdev->dev, "pci_request_regions failed\n");
+               dev_err(&pdev->dev, "pcim_request_all_regions failed\n");
                goto err_disable_device;
        }
 
        nexus->bar0 = pcim_iomap(pdev, 0, pci_resource_len(pdev, 0));
        if (!nexus->bar0) {
                err = -ENOMEM;
-               goto err_release_regions;
+               goto err_disable_device;
        }
 
        i = 0;
@@ -107,9 +107,6 @@ static int thunder_mdiobus_pci_probe(struct pci_dev *pdev,
        }
        return 0;
 
-err_release_regions:
-       pci_release_regions(pdev);
-
 err_disable_device:
        pci_set_drvdata(pdev, NULL);
        return err;
@@ -129,7 +126,6 @@ static void thunder_mdiobus_pci_remove(struct pci_dev *pdev)
                mdiobus_unregister(bus->mii_bus);
                oct_mdio_writeq(0, bus->register_base + SMI_EN);
        }
-       pci_release_regions(pdev);
        pci_set_drvdata(pdev, NULL);
 }