mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-04 01:24:12 +08:00
i2c: owl: 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>
This commit is contained in:
parent
9d8b7b6102
commit
7e8e6677a8
@ -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);
|
||||
@ -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[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user