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: apple: 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>
Reviewed-by: Sven Peter <sven@svenpeter.dev>
Link: https://lore.kernel.org/r/6f312af6160d1e10b616c9adbd1fd8f822db964d.1672473415.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
98b7a161 8c5210db

+1 -17
+1 -17
drivers/watchdog/apple_wdt.c
··· 136 136 return 0; 137 137 } 138 138 139 - static void apple_wdt_clk_disable_unprepare(void *data) 140 - { 141 - clk_disable_unprepare(data); 142 - } 143 - 144 139 static struct watchdog_ops apple_wdt_ops = { 145 140 .owner = THIS_MODULE, 146 141 .start = apple_wdt_start, ··· 157 162 struct apple_wdt *wdt; 158 163 struct clk *clk; 159 164 u32 wdt_ctrl; 160 - int ret; 161 165 162 166 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); 163 167 if (!wdt) ··· 166 172 if (IS_ERR(wdt->regs)) 167 173 return PTR_ERR(wdt->regs); 168 174 169 - clk = devm_clk_get(dev, NULL); 175 + clk = devm_clk_get_enabled(dev, NULL); 170 176 if (IS_ERR(clk)) 171 177 return PTR_ERR(clk); 172 - 173 - ret = clk_prepare_enable(clk); 174 - if (ret) 175 - return ret; 176 - 177 - ret = devm_add_action_or_reset(dev, apple_wdt_clk_disable_unprepare, 178 - clk); 179 - if (ret) 180 - return ret; 181 - 182 178 wdt->clk_rate = clk_get_rate(clk); 183 179 if (!wdt->clk_rate) 184 180 return -EINVAL;