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

hwmon: (axi-fan-control) Make sure the clock is enabled

The core will only work if it's clock is enabled. This patch is a
minor enhancement to make sure that's the case.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210811114853.159298-2-nuno.sa@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Nuno Sá and committed by
Guenter Roeck
a3933625 76b72736

+13
+13
drivers/hwmon/axi-fan-control.c
··· 351 351 return ret; 352 352 } 353 353 354 + static void axi_fan_control_clk_disable(void *clk) 355 + { 356 + clk_disable_unprepare(clk); 357 + } 358 + 354 359 static const struct hwmon_channel_info *axi_fan_control_info[] = { 355 360 HWMON_CHANNEL_INFO(pwm, HWMON_PWM_INPUT), 356 361 HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_FAULT | HWMON_F_LABEL), ··· 410 405 dev_err(&pdev->dev, "clk_get failed with %ld\n", PTR_ERR(clk)); 411 406 return PTR_ERR(clk); 412 407 } 408 + 409 + ret = clk_prepare_enable(clk); 410 + if (ret) 411 + return ret; 412 + 413 + ret = devm_add_action_or_reset(&pdev->dev, axi_fan_control_clk_disable, clk); 414 + if (ret) 415 + return ret; 413 416 414 417 ctl->clk_rate = clk_get_rate(clk); 415 418 if (!ctl->clk_rate)