From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 8DF2D1C162E for ; Wed, 17 Apr 2019 09:53:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 00FC723453 for ; Wed, 17 Apr 2019 09:53:03 +0000 (UTC) Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yTDeBiQ054F7 for ; Wed, 17 Apr 2019 09:53:02 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by silver.osuosl.org (Postfix) with ESMTPS id 8F5B4236B5 for ; Wed, 17 Apr 2019 09:53:00 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id o25so2592715wmf.5 for ; Wed, 17 Apr 2019 02:53:00 -0700 (PDT) From: Sergio Paracuellos Subject: [PATCH 1/3] staging: mt7621-pci-phy: use 'platform_get_resource' Date: Wed, 17 Apr 2019 11:52:54 +0200 Message-Id: <20190417095256.6146-2-sergio.paracuellos@gmail.com> In-Reply-To: <20190417095256.6146-1-sergio.paracuellos@gmail.com> References: <20190417095256.6146-1-sergio.paracuellos@gmail.com> MIME-Version: 1.0 List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: gregkh@linuxfoundation.org Cc: neil@brown.name, driverdev-devel@linuxdriverproject.org 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 --- drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c | 11 +++++------ 1 file 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); -- 2.19.1 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel