Message ID | 20230818093018.1051434-9-lizetao1@huawei.com |
---|---|
State | New |
Headers | show |
Series | gpio: Use devm_clk_get_*() helper function to simplify the drivers. | expand |
On Fri, Aug 18, 2023 at 05:30:15PM +0800, Li Zetao wrote: > Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for > prepared and enabled clocks"), devm_clk_get() and clk_prepare() can now be > replaced by devm_clk_get_prepared() when the driver enables (and possibly > prepares) the clocks for the whole lifetime of the device. Moreover, it is > no longer necessary to unprepare and disable the clocks explicitly. The commit message isn't correct. Seems you copied'n'pasted from other cases. Please, revisit. Code wise looks legit to me. With the commit message fixed Reviewed-by: Andy Shevchenko <andy@kernel.org>
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index a927680c66f8..c0131ee0f90c 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1450,13 +1450,11 @@ static int omap_gpio_probe(struct platform_device *pdev) } if (bank->dbck_flag) { - bank->dbck = devm_clk_get(dev, "dbclk"); + bank->dbck = devm_clk_get_prepared(dev, "dbclk"); if (IS_ERR(bank->dbck)) { dev_err(dev, "Could not get gpio dbck. Disable debounce\n"); bank->dbck_flag = false; - } else { - clk_prepare(bank->dbck); } } @@ -1474,8 +1472,6 @@ static int omap_gpio_probe(struct platform_device *pdev) if (ret) { pm_runtime_put_sync(dev); pm_runtime_disable(dev); - if (bank->dbck_flag) - clk_unprepare(bank->dbck); return ret; } @@ -1496,8 +1492,6 @@ static int omap_gpio_remove(struct platform_device *pdev) cpu_pm_unregister_notifier(&bank->nb); gpiochip_remove(&bank->chip); pm_runtime_disable(&pdev->dev); - if (bank->dbck_flag) - clk_unprepare(bank->dbck); return 0; }
Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare() can now be replaced by devm_clk_get_prepared() when the driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Signed-off-by: Li Zetao <lizetao1@huawei.com> --- drivers/gpio/gpio-omap.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)