2019-04-01 05:14:17

by Anson Huang

[permalink] [raw]
Subject: [PATCH] clk: imx: use devm_platform_ioremap_resource() to simplify code

Use the new helper devm_platform_ioremap_resource() which wraps the
platform_get_resource() and devm_ioremap_resource() together, to
simplify the code.

Signed-off-by: Anson Huang <[email protected]>
---
drivers/clk/imx/clk-imx8qxp-lpcg.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
index fb6edf1..c711654 100644
--- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
+++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
@@ -159,7 +159,6 @@ static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev)
struct clk_hw_onecell_data *clk_data;
const struct imx8qxp_ss_lpcg *ss_lpcg;
const struct imx8qxp_lpcg_data *lpcg;
- struct resource *res;
struct clk_hw **clks;
void __iomem *base;
int i;
@@ -168,10 +167,7 @@ static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev)
if (!ss_lpcg)
return -ENODEV;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -EINVAL;
- base = devm_ioremap(dev, res->start, resource_size(res));
+ base = devm_platform_ioremap_resource(pdev, 0);
if (!base)
return -ENOMEM;

--
2.7.4


2019-04-01 08:06:20

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH] clk: imx: use devm_platform_ioremap_resource() to simplify code


On 4/1/2019 10:43 AM, Anson Huang wrote:
> Use the new helper devm_platform_ioremap_resource() which wraps the
> platform_get_resource() and devm_ioremap_resource() together, to
> simplify the code.
>
> Signed-off-by: Anson Huang <[email protected]>
Reviewed-by: Mukesh Ojha <[email protected]>

Cheers,
-Mukesh

> ---
> drivers/clk/imx/clk-imx8qxp-lpcg.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> index fb6edf1..c711654 100644
> --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> @@ -159,7 +159,6 @@ static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev)
> struct clk_hw_onecell_data *clk_data;
> const struct imx8qxp_ss_lpcg *ss_lpcg;
> const struct imx8qxp_lpcg_data *lpcg;
> - struct resource *res;
> struct clk_hw **clks;
> void __iomem *base;
> int i;
> @@ -168,10 +167,7 @@ static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev)
> if (!ss_lpcg)
> return -ENODEV;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -EINVAL;
> - base = devm_ioremap(dev, res->start, resource_size(res));
> + base = devm_platform_ioremap_resource(pdev, 0);
> if (!base)
> return -ENOMEM;
>

2019-04-11 05:13:07

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH] clk: imx: use devm_platform_ioremap_resource() to simplify code

On Mon, Apr 01, 2019 at 05:13:02AM +0000, Anson Huang wrote:
> Use the new helper devm_platform_ioremap_resource() which wraps the
> platform_get_resource() and devm_ioremap_resource() together, to
> simplify the code.
>
> Signed-off-by: Anson Huang <[email protected]>

Applied, thanks.