mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
gpio: zynq: Simplify using devm_clk_get_enabled()
Use devm_clk_get_enabled() simplify zynq_gpio_probe() and zynq_gpio_remove(). Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Rong Qianfeng <rongqianfeng@vivo.com> Link: https://lore.kernel.org/r/20240820121651.29706-3-rongqianfeng@vivo.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
e9482dc50a
commit
8d2aaf4382
1 changed files with 1 additions and 9 deletions
|
@ -940,16 +940,10 @@ static int zynq_gpio_probe(struct platform_device *pdev)
|
||||||
chip->ngpio = gpio->p_data->ngpio;
|
chip->ngpio = gpio->p_data->ngpio;
|
||||||
|
|
||||||
/* Retrieve GPIO clock */
|
/* 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))
|
if (IS_ERR(gpio->clk))
|
||||||
return dev_err_probe(&pdev->dev, PTR_ERR(gpio->clk), "input clock not found.\n");
|
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);
|
spin_lock_init(&gpio->dirlock);
|
||||||
|
|
||||||
pm_runtime_set_active(&pdev->dev);
|
pm_runtime_set_active(&pdev->dev);
|
||||||
|
@ -999,7 +993,6 @@ err_pm_put:
|
||||||
pm_runtime_put(&pdev->dev);
|
pm_runtime_put(&pdev->dev);
|
||||||
err_pm_dis:
|
err_pm_dis:
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
clk_disable_unprepare(gpio->clk);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1019,7 +1012,6 @@ static void zynq_gpio_remove(struct platform_device *pdev)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
dev_warn(&pdev->dev, "pm_runtime_get_sync() Failed\n");
|
dev_warn(&pdev->dev, "pm_runtime_get_sync() Failed\n");
|
||||||
gpiochip_remove(&gpio->chip);
|
gpiochip_remove(&gpio->chip);
|
||||||
clk_disable_unprepare(gpio->clk);
|
|
||||||
device_set_wakeup_capable(&pdev->dev, 0);
|
device_set_wakeup_capable(&pdev->dev, 0);
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue