diff options
author | Christian Schneider <cschneider@radiodata.biz> | 2019-07-02 16:23:37 +0300 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-07-09 04:11:31 +0300 |
commit | f2173fa2246e906602c6286c7dade68109d68976 (patch) | |
tree | 26c2b089a18e4aeabc10a9c27a5d8644d1831d4f /drivers/hwmon/gpio-fan.c | |
parent | 7a1d220ccb0cc2b808eb176fb05bf55a38179f3f (diff) | |
download | linux-f2173fa2246e906602c6286c7dade68109d68976.tar.xz |
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 <cschneider@radiodata.biz>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/gpio-fan.c')
-rw-r--r-- | drivers/hwmon/gpio-fan.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index 54c27e683ee1..5f9b406134b5 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -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) @@ -537,6 +530,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); |