Message ID | 20191017122640.22976-11-yuehaibing@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | pinctrl: use devm_platform_ioremap_resource() to simplify code | expand |
On Thu, Oct 17, 2019 at 08:26:20PM +0800, YueHaibing wrote: > Use devm_platform_ioremap_resource() to simplify the code a bit. > This is detected by coccinelle. > > Signed-off-by: YueHaibing <yuehaibing@huawei.com> > --- > drivers/pinctrl/tegra/pinctrl-tegra-xusb.c | 4 +--- > drivers/pinctrl/tegra/pinctrl-tegra.c | 3 +-- > 2 files changed, 2 insertions(+), 5 deletions(-) Acked-by: Thierry Reding <treding@nvidia.com> > diff --git a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c > index f2fa1f7..6f7b376 100644 > --- a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c > +++ b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c > @@ -873,7 +873,6 @@ int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev) > { > struct tegra_xusb_padctl *padctl; > const struct of_device_id *match; > - struct resource *res; > struct phy *phy; > int err; > > @@ -894,8 +893,7 @@ int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev) > match = of_match_node(tegra_xusb_padctl_of_match, pdev->dev.of_node); > padctl->soc = match->data; > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - padctl->regs = devm_ioremap_resource(&pdev->dev, res); > + padctl->regs = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(padctl->regs)) > return PTR_ERR(padctl->regs); > > diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c > index e9a7cbb..692d8b3 100644 > --- a/drivers/pinctrl/tegra/pinctrl-tegra.c > +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c > @@ -781,8 +781,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev, > return -ENOMEM; > > for (i = 0; i < pmx->nbanks; i++) { > - res = platform_get_resource(pdev, IORESOURCE_MEM, i); > - pmx->regs[i] = devm_ioremap_resource(&pdev->dev, res); > + pmx->regs[i] = devm_platform_ioremap_resource(pdev, i); > if (IS_ERR(pmx->regs[i])) > return PTR_ERR(pmx->regs[i]); > } > -- > 2.7.4 > >
diff --git a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c index f2fa1f7..6f7b376 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c @@ -873,7 +873,6 @@ int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev) { struct tegra_xusb_padctl *padctl; const struct of_device_id *match; - struct resource *res; struct phy *phy; int err; @@ -894,8 +893,7 @@ int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev) match = of_match_node(tegra_xusb_padctl_of_match, pdev->dev.of_node); padctl->soc = match->data; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - padctl->regs = devm_ioremap_resource(&pdev->dev, res); + padctl->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(padctl->regs)) return PTR_ERR(padctl->regs); diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c index e9a7cbb..692d8b3 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c @@ -781,8 +781,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev, return -ENOMEM; for (i = 0; i < pmx->nbanks; i++) { - res = platform_get_resource(pdev, IORESOURCE_MEM, i); - pmx->regs[i] = devm_ioremap_resource(&pdev->dev, res); + pmx->regs[i] = devm_platform_ioremap_resource(pdev, i); if (IS_ERR(pmx->regs[i])) return PTR_ERR(pmx->regs[i]); }
Use devm_platform_ioremap_resource() to simplify the code a bit. This is detected by coccinelle. Signed-off-by: YueHaibing <yuehaibing@huawei.com> --- drivers/pinctrl/tegra/pinctrl-tegra-xusb.c | 4 +--- drivers/pinctrl/tegra/pinctrl-tegra.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-)