diff options
author | Dong Aisheng <b29396@freescale.com> | 2014-08-27 15:55:59 +0800 |
---|---|---|
committer | Octavian Purdila <octavian.purdila@nxp.com> | 2017-02-23 14:21:42 +0200 |
commit | f08f7d7fa6a2332938c47f1e006861d2d87bd073 (patch) | |
tree | bd90245b753ee189a10574d8102301c1932cfc3b /drivers/base | |
parent | 6f9939bd4fa077bd0f4c2ed5b35928c66a239b51 (diff) |
MLK-12284-1 regmap: regmap-mmio: make clk_id optionally when getting clock
According to clock framework, the clk_id could be NULL when getting clock.
But current code relies on a non null clk_id to get clock.
Changing the code to allow a null clk_id to get clock to make it more
reasonable to use.
And the regmap_mmio_gen_context will try to get clock by default but ignore
error if not finding the clock in case some regmap access not reply on
a specific clock.
Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit a60a38a5285ab27814f261ed39653c55a0a6e24b)
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/regmap-mmio.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index 5189fd6182f6..400a297d2490 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c @@ -305,19 +305,15 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, goto err_free; } - if (clk_id == NULL) - return ctx; - ctx->clk = clk_get(dev, clk_id); - if (IS_ERR(ctx->clk)) { - ret = PTR_ERR(ctx->clk); - goto err_free; - } - - ret = clk_prepare(ctx->clk); - if (ret < 0) { - clk_put(ctx->clk); - goto err_free; + if (!IS_ERR(ctx->clk)) { + ret = clk_prepare(ctx->clk); + if (ret < 0) { + clk_put(ctx->clk); + goto err_free; + } + } else { + ctx->clk = NULL; } return ctx; |