hwmon: gpio-fan: move fan_alarm_init after devm_hwmon_device_register_with_groups
Quoted 7 lines · On Tue, Jul 02, 2019 at 03:23:37PM +0200, [email protected] wrote:
From: Christian Schneider <[email protected]>
This makes it possible to use the
hwmon_devinfan_alarm_notify(). Otherwise it would be possible, that a interupt arrives andfan_alarm_notify()is executed, beforehwmon_devis initialized.Signed-off-by Christian Schneider <[email protected]>
Applied.
Thanks,
Guenter
Quoted 39 lines
--- drivers/hwmon/gpio-fan.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/hwmon/gpio-fan.c +7
-7@@ -510,13 +510,6 @@ static int gpio_fan_probe(struct platform_device *pdev)platform_set_drvdata (pdev, fan_data);mutex_init (&fan_data->lock); -/* Configure alarm GPIO if available. */ -if (fan_data->alarm_gpio) { - err =fan_alarm_init (fan_data); -if (err) -return err; - } -/* Configure control GPIOs if available. */ if (fan_data->gpios && fan_data->num_gpios >0 ) {if (!fan_data->speed || fan_data->num_speed <=1 )@@ -535,6 +528,13 @@ static int gpio_fan_probe(struct platform_device *pdev)if (IS_ERR (fan_data->hwmon_dev))return PTR_ERR (fan_data->hwmon_dev); +/* Configure alarm GPIO if available. */ +if (fan_data->alarm_gpio) { + err =fan_alarm_init (fan_data); +if (err) +return err; + } +/* Optional cooling device register for Device tree platforms */ fan_data->cdev =devm_thermal_of_cooling_device_register (dev, np,"gpio-fan" , fan_data, &gpio_fan_cool_ops);Signature · 1 line
2.22.0