summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2022-12-31 12:14:30 +0100
committerWim Van Sebroeck <wim@linux-watchdog.org>2023-04-22 12:53:57 +0200
commit07d41160b3b65c621f9352196c3791fdc7d2380d (patch)
treebd8d1774509ec8c8e2333f2811988fe2774692a3 /drivers/watchdog
parentwatchdog: ixp4xx: Use devm_clk_get_enabled() helper (diff)
downloadlinux-07d41160b3b65c621f9352196c3791fdc7d2380d.tar.xz
linux-07d41160b3b65c621f9352196c3791fdc7d2380d.zip
watchdog: loongson1: Use devm_clk_get_enabled() helper
The devm_clk_get_enabled() helper: - calls devm_clk_get() - calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the need of a dedicated function used with devm_add_action_or_reset(). Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/624106aa86ef7e49f16b11b229528eabd63de8f7.1672485257.git.christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/loongson1_wdt.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/drivers/watchdog/loongson1_wdt.c b/drivers/watchdog/loongson1_wdt.c
index bb3d075c0633..c55656cfb403 100644
--- a/drivers/watchdog/loongson1_wdt.c
+++ b/drivers/watchdog/loongson1_wdt.c
@@ -79,11 +79,6 @@ static const struct watchdog_ops ls1x_wdt_ops = {
.set_timeout = ls1x_wdt_set_timeout,
};
-static void ls1x_clk_disable_unprepare(void *data)
-{
- clk_disable_unprepare(data);
-}
-
static int ls1x_wdt_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -100,20 +95,10 @@ static int ls1x_wdt_probe(struct platform_device *pdev)
if (IS_ERR(drvdata->base))
return PTR_ERR(drvdata->base);
- drvdata->clk = devm_clk_get(dev, pdev->name);
+ drvdata->clk = devm_clk_get_enabled(dev, pdev->name);
if (IS_ERR(drvdata->clk))
return PTR_ERR(drvdata->clk);
- err = clk_prepare_enable(drvdata->clk);
- if (err) {
- dev_err(dev, "clk enable failed\n");
- return err;
- }
- err = devm_add_action_or_reset(dev, ls1x_clk_disable_unprepare,
- drvdata->clk);
- if (err)
- return err;
-
clk_rate = clk_get_rate(drvdata->clk);
if (!clk_rate)
return -EINVAL;