diff options
author | Sergio Paracuellos <sergio.paracuellos@gmail.com> | 2019-04-17 13:58:35 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-19 15:01:33 +0200 |
commit | fc1e669ad15aff8d1cd14aa661279f2119471d0b (patch) | |
tree | 658a402676918c04a0eb57a9ea90892cd627a4f9 /drivers/staging/mt7621-pci-phy | |
parent | 9c5d9e572e0e59c83a3683dff73be9120f0f1acc (diff) | |
download | linux-fc1e669ad15aff8d1cd14aa661279f2119471d0b.tar.gz linux-fc1e669ad15aff8d1cd14aa661279f2119471d0b.tar.bz2 linux-fc1e669ad15aff8d1cd14aa661279f2119471d0b.zip |
staging: mt7621-pci-phy: use 'platform_get_resource'
Driver is using 'of_address_to_resource' to get memory resources.
Make use of 'platform_get_resource' instead which is more accurate
for a platform driver. This also makes possible to delete a local
variable which is not needed anymore.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/mt7621-pci-phy')
-rw-r--r-- | drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c b/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c index aa3ae7777632..bac188f00f4e 100644 --- a/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c +++ b/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c @@ -308,11 +308,10 @@ static struct phy *mt7621_pcie_phy_of_xlate(struct device *dev, static int mt7621_pci_phy_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np = dev->of_node; struct device_node *child_np; struct phy_provider *provider; struct mt7621_pci_phy *phy; - struct resource res; + struct resource *res; int port, ret; void __iomem *port_base; @@ -329,13 +328,13 @@ static int mt7621_pci_phy_probe(struct platform_device *pdev) phy->dev = dev; platform_set_drvdata(pdev, phy); - ret = of_address_to_resource(np, 0, &res); - if (ret) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { dev_err(dev, "failed to get address resource\n"); - return ret; + return -ENXIO; } - port_base = devm_ioremap_resource(dev, &res); + port_base = devm_ioremap_resource(dev, res); if (IS_ERR(port_base)) { dev_err(dev, "failed to remap phy regs\n"); return PTR_ERR(port_base); |