summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorDong Aisheng <b29396@freescale.com>2014-08-27 15:55:59 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2016-01-19 16:38:24 +0800
commitd057f9e73073bad28e2be6c0013194ba8de95df0 (patch)
tree9377edf0ca8f47ae25962b8395f01c64c4f6a50a /drivers/base
parent700dd42d305e5bd8dd3e53f63291eb7583ea309a (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.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 04a329a377e9..ea4651783f97 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -273,19 +273,15 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev,
ctx->pad_bytes = config->pad_bits / 8;
ctx->clk = ERR_PTR(-ENODEV);
- 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;