Skip to content

Commit 8fd15ac

Browse files
tititiou36Wim Van Sebroeck
authored andcommitted
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>
1 parent e0e0ee0 commit 8fd15ac

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

drivers/watchdog/ixp4xx_wdt.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ static const struct watchdog_info ixp4xx_wdt_info = {
112112
.identity = KBUILD_MODNAME,
113113
};
114114

115-
/* Devres-handled clock disablement */
116-
static void ixp4xx_clock_action(void *d)
117-
{
118-
clk_disable_unprepare(d);
119-
}
120-
121115
static int ixp4xx_wdt_probe(struct platform_device *pdev)
122116
{
123117
struct device *dev = &pdev->dev;
@@ -139,16 +133,10 @@ static int ixp4xx_wdt_probe(struct platform_device *pdev)
139133
* Retrieve rate from a fixed clock from the device tree if
140134
* the parent has that, else use the default clock rate.
141135
*/
142-
clk = devm_clk_get(dev->parent, NULL);
143-
if (!IS_ERR(clk)) {
144-
ret = clk_prepare_enable(clk);
145-
if (ret)
146-
return ret;
147-
ret = devm_add_action_or_reset(dev, ixp4xx_clock_action, clk);
148-
if (ret)
149-
return ret;
136+
clk = devm_clk_get_enabled(dev->parent, NULL);
137+
if (!IS_ERR(clk))
150138
iwdt->rate = clk_get_rate(clk);
151-
}
139+
152140
if (!iwdt->rate)
153141
iwdt->rate = IXP4XX_TIMER_FREQ;
154142

0 commit comments

Comments
 (0)