Commit 08d4deda authored by Chunfeng Yun's avatar Chunfeng Yun Committed by Vinod Koul

phy: allwinner: convert to devm_platform_ioremap_resource(_byname)

Use devm_platform_ioremap_resource(_byname) to simplify code
Signed-off-by: default avatarChunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1604642930-29019-1-git-send-email-chunfeng.yun@mediatek.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 6edf7700
...@@ -686,7 +686,6 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -686,7 +686,6 @@ static int sun4i_usb_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 *np = dev->of_node;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct resource *res;
int i, ret; int i, ret;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
...@@ -700,8 +699,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -700,8 +699,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
if (!data->cfg) if (!data->cfg)
return -EINVAL; return -EINVAL;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy_ctrl"); data->base = devm_platform_ioremap_resource_byname(pdev, "phy_ctrl");
data->base = devm_ioremap_resource(dev, res);
if (IS_ERR(data->base)) if (IS_ERR(data->base))
return PTR_ERR(data->base); return PTR_ERR(data->base);
...@@ -796,9 +794,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -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 */ if (i || data->cfg->phy0_dual_route) { /* No pmu for musb */
snprintf(name, sizeof(name), "pmu%d", i); snprintf(name, sizeof(name), "pmu%d", i);
res = platform_get_resource_byname(pdev, phy->pmu = devm_platform_ioremap_resource_byname(pdev, name);
IORESOURCE_MEM, name);
phy->pmu = devm_ioremap_resource(dev, res);
if (IS_ERR(phy->pmu)) if (IS_ERR(phy->pmu))
return PTR_ERR(phy->pmu); return PTR_ERR(phy->pmu);
} }
......
...@@ -134,7 +134,6 @@ static int sun50i_usb3_phy_probe(struct platform_device *pdev) ...@@ -134,7 +134,6 @@ static int sun50i_usb3_phy_probe(struct platform_device *pdev)
struct sun50i_usb3_phy *phy; struct sun50i_usb3_phy *phy;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct resource *res;
phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
if (!phy) if (!phy)
...@@ -153,8 +152,7 @@ static int sun50i_usb3_phy_probe(struct platform_device *pdev) ...@@ -153,8 +152,7 @@ static int sun50i_usb3_phy_probe(struct platform_device *pdev)
return PTR_ERR(phy->reset); return PTR_ERR(phy->reset);
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); phy->regs = devm_platform_ioremap_resource(pdev, 0);
phy->regs = devm_ioremap_resource(dev, res);
if (IS_ERR(phy->regs)) if (IS_ERR(phy->regs))
return PTR_ERR(phy->regs); return PTR_ERR(phy->regs);
......
...@@ -253,15 +253,13 @@ static int sun6i_dphy_probe(struct platform_device *pdev) ...@@ -253,15 +253,13 @@ static int sun6i_dphy_probe(struct platform_device *pdev)
{ {
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct sun6i_dphy *dphy; struct sun6i_dphy *dphy;
struct resource *res;
void __iomem *regs; void __iomem *regs;
dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL);
if (!dphy) if (!dphy)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_platform_ioremap_resource(pdev, 0);
regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(regs)) { if (IS_ERR(regs)) {
dev_err(&pdev->dev, "Couldn't map the DPHY encoder registers\n"); dev_err(&pdev->dev, "Couldn't map the DPHY encoder registers\n");
return PTR_ERR(regs); return PTR_ERR(regs);
......
...@@ -117,7 +117,6 @@ static int sun9i_usb_phy_probe(struct platform_device *pdev) ...@@ -117,7 +117,6 @@ static int sun9i_usb_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 *np = dev->of_node;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct resource *res;
phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
if (!phy) if (!phy)
...@@ -156,8 +155,7 @@ static int sun9i_usb_phy_probe(struct platform_device *pdev) ...@@ -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_platform_ioremap_resource(pdev, 0);
phy->pmu = devm_ioremap_resource(dev, res);
if (IS_ERR(phy->pmu)) if (IS_ERR(phy->pmu))
return PTR_ERR(phy->pmu); return PTR_ERR(phy->pmu);
......
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