diff mbox series

[2/2] gpio: omap: save two lines by using devm_clk_get_prepared()

Message ID 20241203164143.29852-2-brgl@bgdev.pl
State Superseded
Headers show
Series [1/2] gpio: omap: allow building the module with COMPILE_TEST=y | expand

Commit Message

Bartosz Golaszewski Dec. 3, 2024, 4:41 p.m. UTC
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

We can drop the else branch if we get the clock already prepared using
the relevant helper.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-omap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

A. Sverdlin Dec. 3, 2024, 6:19 p.m. UTC | #1
On Tue, 2024-12-03 at 17:41 +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> We can drop the else branch if we get the clock already prepared using
> the relevant helper.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>

> ---
>  drivers/gpio/gpio-omap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index 54c4bfdccf568..57d299d5d0b16 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1449,13 +1449,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);
>  		}
>  	}
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 54c4bfdccf568..57d299d5d0b16 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1449,13 +1449,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);
 		}
 	}