Skip to content

Commit

Permalink
i2c: owl: Use devm_clk_get_enabled()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andi Shyti authored and Wolfram Sang committed Jun 23, 2023
1 parent 9d8b7b6 commit 7e8e667
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions drivers/i2c/busses/i2c-owl.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,21 +461,16 @@ static int owl_i2c_probe(struct platform_device *pdev)
return -EINVAL;
}

i2c_dev->clk = devm_clk_get(dev, NULL);
i2c_dev->clk = devm_clk_get_enabled(dev, NULL);
if (IS_ERR(i2c_dev->clk)) {
dev_err(dev, "failed to get clock\n");
dev_err(dev, "failed to enable clock\n");
return PTR_ERR(i2c_dev->clk);
}

ret = clk_prepare_enable(i2c_dev->clk);
if (ret)
return ret;

i2c_dev->clk_rate = clk_get_rate(i2c_dev->clk);
if (!i2c_dev->clk_rate) {
dev_err(dev, "input clock rate should not be zero\n");
ret = -EINVAL;
goto disable_clk;
return -EINVAL;
}

init_completion(&i2c_dev->msg_complete);
Expand All @@ -496,15 +491,10 @@ static int owl_i2c_probe(struct platform_device *pdev)
i2c_dev);
if (ret) {
dev_err(dev, "failed to request irq %d\n", irq);
goto disable_clk;
return ret;
}

return i2c_add_adapter(&i2c_dev->adap);

disable_clk:
clk_disable_unprepare(i2c_dev->clk);

return ret;
}

static const struct of_device_id owl_i2c_of_match[] = {
Expand Down

0 comments on commit 7e8e667

Please sign in to comment.