diff options
author | Andi Shyti <andi.shyti@kernel.org> | 2023-06-12 00:56:54 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2023-06-23 12:16:21 +0200 |
commit | 9d8b7b6102d9cefb9e95c7ba764121182f696943 (patch) | |
tree | 6c5e5d33a7c532ff73f58e55f15d76ed1c314c6d /drivers/i2c | |
parent | i2c: hix5hd2: Use devm_clk_get_enabled() (diff) | |
download | linux-9d8b7b6102d9cefb9e95c7ba764121182f696943.tar.xz linux-9d8b7b6102d9cefb9e95c7ba764121182f696943.zip |
i2c: lpc2k: 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>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-lpc2k.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c index 469fe907723e..5c6d96554753 100644 --- a/drivers/i2c/busses/i2c-lpc2k.c +++ b/drivers/i2c/busses/i2c-lpc2k.c @@ -365,23 +365,17 @@ static int i2c_lpc2k_probe(struct platform_device *pdev) init_waitqueue_head(&i2c->wait); - i2c->clk = devm_clk_get(&pdev->dev, NULL); + i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(i2c->clk)) { - dev_err(&pdev->dev, "error getting clock\n"); + dev_err(&pdev->dev, "failed to enable clock.\n"); return PTR_ERR(i2c->clk); } - ret = clk_prepare_enable(i2c->clk); - if (ret) { - dev_err(&pdev->dev, "unable to enable clock.\n"); - return ret; - } - ret = devm_request_irq(&pdev->dev, i2c->irq, i2c_lpc2k_handler, 0, dev_name(&pdev->dev), i2c); if (ret < 0) { dev_err(&pdev->dev, "can't request interrupt.\n"); - goto fail_clk; + return ret; } disable_irq_nosync(i2c->irq); @@ -397,8 +391,7 @@ static int i2c_lpc2k_probe(struct platform_device *pdev) clkrate = clk_get_rate(i2c->clk); if (clkrate == 0) { dev_err(&pdev->dev, "can't get I2C base clock\n"); - ret = -EINVAL; - goto fail_clk; + return -EINVAL; } /* Setup I2C dividers to generate clock with proper duty cycle */ @@ -424,15 +417,11 @@ static int i2c_lpc2k_probe(struct platform_device *pdev) ret = i2c_add_adapter(&i2c->adap); if (ret < 0) - goto fail_clk; + return ret; dev_info(&pdev->dev, "LPC2K I2C adapter\n"); return 0; - -fail_clk: - clk_disable_unprepare(i2c->clk); - return ret; } static void i2c_lpc2k_remove(struct platform_device *dev) @@ -440,7 +429,6 @@ static void i2c_lpc2k_remove(struct platform_device *dev) struct lpc2k_i2c *i2c = platform_get_drvdata(dev); i2c_del_adapter(&i2c->adap); - clk_disable_unprepare(i2c->clk); } #ifdef CONFIG_PM |