Commit fc1e669a authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by Greg Kroah-Hartman

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: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9c5d9e57
...@@ -308,11 +308,10 @@ static struct phy *mt7621_pcie_phy_of_xlate(struct device *dev, ...@@ -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) static int mt7621_pci_phy_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct device_node *child_np; struct device_node *child_np;
struct phy_provider *provider; struct phy_provider *provider;
struct mt7621_pci_phy *phy; struct mt7621_pci_phy *phy;
struct resource res; struct resource *res;
int port, ret; int port, ret;
void __iomem *port_base; void __iomem *port_base;
...@@ -329,13 +328,13 @@ static int mt7621_pci_phy_probe(struct platform_device *pdev) ...@@ -329,13 +328,13 @@ static int mt7621_pci_phy_probe(struct platform_device *pdev)
phy->dev = dev; phy->dev = dev;
platform_set_drvdata(pdev, phy); platform_set_drvdata(pdev, phy);
ret = of_address_to_resource(np, 0, &res); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (ret) { if (!res) {
dev_err(dev, "failed to get address resource\n"); 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)) { if (IS_ERR(port_base)) {
dev_err(dev, "failed to remap phy regs\n"); dev_err(dev, "failed to remap phy regs\n");
return PTR_ERR(port_base); return PTR_ERR(port_base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment