summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Shyti <andi.shyti@kernel.org>2023-06-12 00:57:01 +0200
committerWolfram Sang <wsa@kernel.org>2023-06-23 12:22:34 +0200
commitff896ef401866c0eb0d07c0c279b5382e2d9e3cf (patch)
tree0e0ba493b2e1782362529446f19f2f6676ce0583
parent7e8e6677a8f70deb14482b70bef59dbf094d4321 (diff)
i2c: uniphier-f: Use devm_clk_get_enabled()
Replace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled(). Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
-rw-r--r--drivers/i2c/busses/i2c-uniphier-f.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c
index 54b1624ef87e..dbc91c7c3788 100644
--- a/drivers/i2c/busses/i2c-uniphier-f.c
+++ b/drivers/i2c/busses/i2c-uniphier-f.c
@@ -540,21 +540,16 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
return -EINVAL;
}
- priv->clk = devm_clk_get(dev, NULL);
+ priv->clk = devm_clk_get_enabled(dev, NULL);
if (IS_ERR(priv->clk)) {
- dev_err(dev, "failed to get clock\n");
+ dev_err(dev, "failed to enable clock\n");
return PTR_ERR(priv->clk);
}
- ret = clk_prepare_enable(priv->clk);
- if (ret)
- return ret;
-
clk_rate = clk_get_rate(priv->clk);
if (!clk_rate) {
dev_err(dev, "input clock rate should not be zero\n");
- ret = -EINVAL;
- goto disable_clk;
+ return -EINVAL;
}
priv->clk_cycle = clk_rate / bus_speed;
@@ -575,15 +570,10 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
pdev->name, priv);
if (ret) {
dev_err(dev, "failed to request irq %d\n", irq);
- goto disable_clk;
+ return ret;
}
- ret = i2c_add_adapter(&priv->adap);
-disable_clk:
- if (ret)
- clk_disable_unprepare(priv->clk);
-
- return ret;
+ return i2c_add_adapter(&priv->adap);
}
static void uniphier_fi2c_remove(struct platform_device *pdev)
@@ -591,7 +581,6 @@ static void uniphier_fi2c_remove(struct platform_device *pdev)
struct uniphier_fi2c_priv *priv = platform_get_drvdata(pdev);
i2c_del_adapter(&priv->adap);
- clk_disable_unprepare(priv->clk);
}
static int __maybe_unused uniphier_fi2c_suspend(struct device *dev)