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: ixp4xx: 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/5d04e453a4da5cfafb56695a17157fa3ea296511.1672484831.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
8fd15ace e0e0ee02

+3 -15
+3 -15
drivers/watchdog/ixp4xx_wdt.c
··· 112 112 .identity = KBUILD_MODNAME, 113 113 }; 114 114 115 - /* Devres-handled clock disablement */ 116 - static void ixp4xx_clock_action(void *d) 117 - { 118 - clk_disable_unprepare(d); 119 - } 120 - 121 115 static int ixp4xx_wdt_probe(struct platform_device *pdev) 122 116 { 123 117 struct device *dev = &pdev->dev; ··· 133 139 * Retrieve rate from a fixed clock from the device tree if 134 140 * the parent has that, else use the default clock rate. 135 141 */ 136 - clk = devm_clk_get(dev->parent, NULL); 137 - if (!IS_ERR(clk)) { 138 - ret = clk_prepare_enable(clk); 139 - if (ret) 140 - return ret; 141 - ret = devm_add_action_or_reset(dev, ixp4xx_clock_action, clk); 142 - if (ret) 143 - return ret; 142 + clk = devm_clk_get_enabled(dev->parent, NULL); 143 + if (!IS_ERR(clk)) 144 144 iwdt->rate = clk_get_rate(clk); 145 - } 145 + 146 146 if (!iwdt->rate) 147 147 iwdt->rate = IXP4XX_TIMER_FREQ; 148 148