Skip to content

Commit f2173fa

Browse files
Christian Schneidergroeck
authored andcommitted
hwmon: (gpio-fan) move fan_alarm_init after devm_hwmon_device_register_with_groups
This makes it possible to use the hwmon_dev in fan_alarm_notify(). Otherwise it would be possible, that a interupt arrives and fan_alarm_notify() is executed, before hwmon_dev is initialized. Signed-off-by: Christian Schneider <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 7a1d220 commit f2173fa

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/hwmon/gpio-fan.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,6 @@ static int gpio_fan_probe(struct platform_device *pdev)
510510
platform_set_drvdata(pdev, fan_data);
511511
mutex_init(&fan_data->lock);
512512

513-
/* Configure alarm GPIO if available. */
514-
if (fan_data->alarm_gpio) {
515-
err = fan_alarm_init(fan_data);
516-
if (err)
517-
return err;
518-
}
519-
520513
/* Configure control GPIOs if available. */
521514
if (fan_data->gpios && fan_data->num_gpios > 0) {
522515
if (!fan_data->speed || fan_data->num_speed <= 1)
@@ -537,6 +530,13 @@ static int gpio_fan_probe(struct platform_device *pdev)
537530
if (IS_ERR(fan_data->hwmon_dev))
538531
return PTR_ERR(fan_data->hwmon_dev);
539532

533+
/* Configure alarm GPIO if available. */
534+
if (fan_data->alarm_gpio) {
535+
err = fan_alarm_init(fan_data);
536+
if (err)
537+
return err;
538+
}
539+
540540
/* Optional cooling device register for Device tree platforms */
541541
fan_data->cdev = devm_thermal_of_cooling_device_register(dev, np,
542542
"gpio-fan", fan_data, &gpio_fan_cool_ops);

0 commit comments

Comments
 (0)