Re: [PATCH 4/9] memory: tegra: convert to devm_platform_ioremap_resource

From: Dmitry Osipenko
Date: Mon Dec 23 2019 - 10:42:44 EST


22.12.2019 21:50, Yangtao Li ÐÐÑÐÑ:
> Use devm_platform_ioremap_resource() to simplify code.
>
> Signed-off-by: Yangtao Li <tiny.windzz@xxxxxxxxx>
> ---
> drivers/memory/tegra/mc.c | 4 +---
> drivers/memory/tegra/tegra124-emc.c | 4 +---
> drivers/memory/tegra/tegra186.c | 4 +---
> drivers/memory/tegra/tegra20-emc.c | 4 +---
> 4 files changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
> index ec8403557ed4..71390d4ad809 100644
> --- a/drivers/memory/tegra/mc.c
> +++ b/drivers/memory/tegra/mc.c
> @@ -593,7 +593,6 @@ static __maybe_unused irqreturn_t tegra20_mc_irq(int irq, void *data)
>
> static int tegra_mc_probe(struct platform_device *pdev)
> {
> - struct resource *res;
> struct tegra_mc *mc;
> void *isr;
> u64 mask;
> @@ -619,8 +618,7 @@ static int tegra_mc_probe(struct platform_device *pdev)
> /* length of MC tick in nanoseconds */
> mc->tick = 30;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - mc->regs = devm_ioremap_resource(&pdev->dev, res);
> + mc->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(mc->regs))
> return PTR_ERR(mc->regs);
>
> diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c
> index 464f0ceaee63..2c73260654ba 100644
> --- a/drivers/memory/tegra/tegra124-emc.c
> +++ b/drivers/memory/tegra/tegra124-emc.c
> @@ -1085,7 +1085,6 @@ static int tegra_emc_probe(struct platform_device *pdev)
> struct platform_device *mc;
> struct device_node *np;
> struct tegra_emc *emc;
> - struct resource *res;
> u32 ram_code;
> int err;
>
> @@ -1095,8 +1094,7 @@ static int tegra_emc_probe(struct platform_device *pdev)
>
> emc->dev = &pdev->dev;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - emc->regs = devm_ioremap_resource(&pdev->dev, res);
> + emc->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(emc->regs))
> return PTR_ERR(emc->regs);
>
> diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c
> index 441213a35930..226d2b16036d 100644
> --- a/drivers/memory/tegra/tegra186.c
> +++ b/drivers/memory/tegra/tegra186.c
> @@ -534,7 +534,6 @@ static const struct tegra_mc_client tegra186_mc_clients[] = {
>
> static int tegra186_mc_probe(struct platform_device *pdev)
> {
> - struct resource *res;
> struct tegra_mc *mc;
> unsigned int i;
> int err = 0;
> @@ -543,8 +542,7 @@ static int tegra186_mc_probe(struct platform_device *pdev)
> if (!mc)
> return -ENOMEM;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - mc->regs = devm_ioremap_resource(&pdev->dev, res);
> + mc->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(mc->regs))
> return PTR_ERR(mc->regs);
>
> diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c
> index 1b23b1c34476..d2efd0c658c0 100644
> --- a/drivers/memory/tegra/tegra20-emc.c
> +++ b/drivers/memory/tegra/tegra20-emc.c
> @@ -482,7 +482,6 @@ static int tegra_emc_probe(struct platform_device *pdev)
> {
> struct device_node *np;
> struct tegra_emc *emc;
> - struct resource *res;
> int irq, err;
>
> /* driver has nothing to do in a case of memory timing absence */
> @@ -518,8 +517,7 @@ static int tegra_emc_probe(struct platform_device *pdev)
> if (err)
> return err;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - emc->regs = devm_ioremap_resource(&pdev->dev, res);
> + emc->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(emc->regs))
> return PTR_ERR(emc->regs);
>
>

Looks good, thanks!

Reviewed-by: Dmitry Osipenko <digetx@xxxxxxxxx>