Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Christophe JAILLET and committed by
Wim Van Sebroeck
07d41160 8fd15ace

+1 -16
+1 -16
drivers/watchdog/loongson1_wdt.c
··· 79 79 .set_timeout = ls1x_wdt_set_timeout, 80 80 }; 81 81 82 - static void ls1x_clk_disable_unprepare(void *data) 83 - { 84 - clk_disable_unprepare(data); 85 - } 86 - 87 82 static int ls1x_wdt_probe(struct platform_device *pdev) 88 83 { 89 84 struct device *dev = &pdev->dev; ··· 95 100 if (IS_ERR(drvdata->base)) 96 101 return PTR_ERR(drvdata->base); 97 102 98 - drvdata->clk = devm_clk_get(dev, pdev->name); 103 + drvdata->clk = devm_clk_get_enabled(dev, pdev->name); 99 104 if (IS_ERR(drvdata->clk)) 100 105 return PTR_ERR(drvdata->clk); 101 - 102 - err = clk_prepare_enable(drvdata->clk); 103 - if (err) { 104 - dev_err(dev, "clk enable failed\n"); 105 - return err; 106 - } 107 - err = devm_add_action_or_reset(dev, ls1x_clk_disable_unprepare, 108 - drvdata->clk); 109 - if (err) 110 - return err; 111 106 112 107 clk_rate = clk_get_rate(drvdata->clk); 113 108 if (!clk_rate)