[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMz4kuKbw+HHbALGEJaoYvV435-RS7gMzWbmwZekLWdKT=GV7A@mail.gmail.com>
Date: Wed, 22 May 2019 10:07:33 +0800
From: Baolin Wang <baolin.wang@...aro.org>
To: Chunyan Zhang <zhang.chunyan@...aro.org>
Cc: Stephen Boyd <sboyd@...nel.org>, linux-clk@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Orson Zhai <orsonzhai@...il.com>,
Chunyan Zhang <zhang.lyra@...il.com>
Subject: Re: [PATCH v2 1/3] clk: sprd: Switch from of_iomap() to devm_ioremap_resource()
On Wed, 22 May 2019 at 09:15, Chunyan Zhang <zhang.chunyan@...aro.org> wrote:
>
> devm_ioremap_resources() automatically requests resources and devm_ wrappers
> do better error handling and unmapping of the I/O region when needed,
> that would make drivers more clean and simple.
>
> Signed-off-by: Chunyan Zhang <zhang.chunyan@...aro.org>
Reviewed-by: Baolin Wang <baolin.wang@...aro.org>
> ---
> drivers/clk/sprd/common.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c
> index e038b0447206..9ce690999eaa 100644
> --- a/drivers/clk/sprd/common.c
> +++ b/drivers/clk/sprd/common.c
> @@ -42,6 +42,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
> void __iomem *base;
> struct device_node *node = pdev->dev.of_node;
> struct regmap *regmap;
> + struct resource *res;
>
> if (of_find_property(node, "sprd,syscon", NULL)) {
> regmap = syscon_regmap_lookup_by_phandle(node, "sprd,syscon");
> @@ -50,7 +51,11 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
> return PTR_ERR(regmap);
> }
> } else {
> - base = of_iomap(node, 0);
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(base))
> + return PTR_ERR(base);
> +
> regmap = devm_regmap_init_mmio(&pdev->dev, base,
> &sprdclk_regmap_config);
> if (IS_ERR_OR_NULL(regmap)) {
> --
> 2.17.1
>
--
Baolin Wang
Best Regards
Powered by blists - more mailing lists