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: visconti: 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/13e8cdf17556da111d1d98a8fe0b1dc1c78007e2.1672417940.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
8c5210db a42912ac

+1 -16
+1 -16
drivers/watchdog/visconti_wdt.c
··· 112 112 .set_timeout = visconti_wdt_set_timeout, 113 113 }; 114 114 115 - static void visconti_clk_disable_unprepare(void *data) 116 - { 117 - clk_disable_unprepare(data); 118 - } 119 - 120 115 static int visconti_wdt_probe(struct platform_device *pdev) 121 116 { 122 117 struct watchdog_device *wdev; ··· 129 134 if (IS_ERR(priv->base)) 130 135 return PTR_ERR(priv->base); 131 136 132 - clk = devm_clk_get(dev, NULL); 137 + clk = devm_clk_get_enabled(dev, NULL); 133 138 if (IS_ERR(clk)) 134 139 return dev_err_probe(dev, PTR_ERR(clk), "Could not get clock\n"); 135 - 136 - ret = clk_prepare_enable(clk); 137 - if (ret) { 138 - dev_err(dev, "Could not enable clock\n"); 139 - return ret; 140 - } 141 - 142 - ret = devm_add_action_or_reset(dev, visconti_clk_disable_unprepare, clk); 143 - if (ret) 144 - return ret; 145 140 146 141 clk_freq = clk_get_rate(clk); 147 142 if (!clk_freq)