diff options
author | Dong Aisheng <b29396@freescale.com> | 2014-08-27 15:55:59 +0800 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 92586a6a5ffebbb8708a99ebcaf358ba3e92e85e (patch) | |
tree | 906ce6540f2a34885449bdf0722276f818054e14 /drivers/base | |
parent | d121545e8d821c155518fea22edcee8195a5624f (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; |