Message ID | 20240820121651.29706-3-rongqianfeng@vivo.com |
---|---|
State | New |
Headers | show |
Series | gpio: Simplify using devm_clk_get_enabled() | expand |
On Tue, Aug 20, 2024 at 2:17 PM Rong Qianfeng <rongqianfeng@vivo.com> wrote: > > Use devm_clk_get_enabled() simplify zynq_gpio_probe() and zynq_gpio_remove(). > > Signed-off-by: Rong Qianfeng <rongqianfeng@vivo.com> > --- Michal, This changes the order of operations in remove(), could you test it or at least give your Ack here? Bart
Hi Bart, On 9/2/24 12:32, Bartosz Golaszewski wrote: > On Tue, Aug 20, 2024 at 2:17 PM Rong Qianfeng <rongqianfeng@vivo.com> wrote: >> >> Use devm_clk_get_enabled() simplify zynq_gpio_probe() and zynq_gpio_remove(). >> >> Signed-off-by: Rong Qianfeng <rongqianfeng@vivo.com> >> --- > > Michal, > > This changes the order of operations in remove(), could you test it or > at least give your Ack here? Changes look good to me. Acked-by: Michal Simek <michal.simek@amd.com> Thanks, Michal
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> On Tue, 20 Aug 2024 20:16:51 +0800, Rong Qianfeng wrote: > Use devm_clk_get_enabled() simplify zynq_gpio_probe() and zynq_gpio_remove(). > > Applied, thanks! [2/2] gpio: zynq: Simplify using devm_clk_get_enabled() commit: 8d2aaf4382b7c2ae4eae17c3eb71474eddbb5c4b Best regards,
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c index 466e23031afc..1a42336dfc1d 100644 --- a/drivers/gpio/gpio-zynq.c +++ b/drivers/gpio/gpio-zynq.c @@ -940,16 +940,10 @@ static int zynq_gpio_probe(struct platform_device *pdev) chip->ngpio = gpio->p_data->ngpio; /* Retrieve GPIO clock */ - gpio->clk = devm_clk_get(&pdev->dev, NULL); + gpio->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(gpio->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(gpio->clk), "input clock not found.\n"); - ret = clk_prepare_enable(gpio->clk); - if (ret) { - dev_err(&pdev->dev, "Unable to enable clock.\n"); - return ret; - } - spin_lock_init(&gpio->dirlock); pm_runtime_set_active(&pdev->dev); @@ -999,7 +993,6 @@ static int zynq_gpio_probe(struct platform_device *pdev) pm_runtime_put(&pdev->dev); err_pm_dis: pm_runtime_disable(&pdev->dev); - clk_disable_unprepare(gpio->clk); return ret; } @@ -1019,7 +1012,6 @@ static void zynq_gpio_remove(struct platform_device *pdev) if (ret < 0) dev_warn(&pdev->dev, "pm_runtime_get_sync() Failed\n"); gpiochip_remove(&gpio->chip); - clk_disable_unprepare(gpio->clk); device_set_wakeup_capable(&pdev->dev, 0); pm_runtime_disable(&pdev->dev); }
Use devm_clk_get_enabled() simplify zynq_gpio_probe() and zynq_gpio_remove(). Signed-off-by: Rong Qianfeng <rongqianfeng@vivo.com> --- drivers/gpio/gpio-zynq.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)