phy: allwinner: convert to devm_platform_ioremap_resource(_byname)
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Fri, 6 Nov 2020 06:08:34 +0000 (14:08 +0800)
committerVinod Koul <vkoul@kernel.org>
Mon, 16 Nov 2020 07:17:46 +0000 (12:47 +0530)
Use devm_platform_ioremap_resource(_byname) to simplify code

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1604642930-29019-1-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/allwinner/phy-sun4i-usb.c
drivers/phy/allwinner/phy-sun50i-usb3.c
drivers/phy/allwinner/phy-sun6i-mipi-dphy.c
drivers/phy/allwinner/phy-sun9i-usb.c

index 651d5e2..406d594 100644 (file)
@@ -686,7 +686,6 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct device_node *np = dev->of_node;
        struct phy_provider *phy_provider;
-       struct resource *res;
        int i, ret;
 
        data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
@@ -700,8 +699,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
        if (!data->cfg)
                return -EINVAL;
 
-       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy_ctrl");
-       data->base = devm_ioremap_resource(dev, res);
+       data->base = devm_platform_ioremap_resource_byname(pdev, "phy_ctrl");
        if (IS_ERR(data->base))
                return PTR_ERR(data->base);
 
@@ -796,9 +794,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 
                if (i || data->cfg->phy0_dual_route) { /* No pmu for musb */
                        snprintf(name, sizeof(name), "pmu%d", i);
-                       res = platform_get_resource_byname(pdev,
-                                                       IORESOURCE_MEM, name);
-                       phy->pmu = devm_ioremap_resource(dev, res);
+                       phy->pmu = devm_platform_ioremap_resource_byname(pdev, name);
                        if (IS_ERR(phy->pmu))
                                return PTR_ERR(phy->pmu);
                }
index b1c04f7..84055b7 100644 (file)
@@ -134,7 +134,6 @@ static int sun50i_usb3_phy_probe(struct platform_device *pdev)
        struct sun50i_usb3_phy *phy;
        struct device *dev = &pdev->dev;
        struct phy_provider *phy_provider;
-       struct resource *res;
 
        phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
        if (!phy)
@@ -153,8 +152,7 @@ static int sun50i_usb3_phy_probe(struct platform_device *pdev)
                return PTR_ERR(phy->reset);
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       phy->regs = devm_ioremap_resource(dev, res);
+       phy->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(phy->regs))
                return PTR_ERR(phy->regs);
 
index 1fa761b..f0bc87d 100644 (file)
@@ -253,15 +253,13 @@ static int sun6i_dphy_probe(struct platform_device *pdev)
 {
        struct phy_provider *phy_provider;
        struct sun6i_dphy *dphy;
-       struct resource *res;
        void __iomem *regs;
 
        dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL);
        if (!dphy)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       regs = devm_ioremap_resource(&pdev->dev, res);
+       regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(regs)) {
                dev_err(&pdev->dev, "Couldn't map the DPHY encoder registers\n");
                return PTR_ERR(regs);
index fc6784d..2f9e60c 100644 (file)
@@ -117,7 +117,6 @@ static int sun9i_usb_phy_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct device_node *np = dev->of_node;
        struct phy_provider *phy_provider;
-       struct resource *res;
 
        phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
        if (!phy)
@@ -156,8 +155,7 @@ static int sun9i_usb_phy_probe(struct platform_device *pdev)
                }
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       phy->pmu = devm_ioremap_resource(dev, res);
+       phy->pmu = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(phy->pmu))
                return PTR_ERR(phy->pmu);