* Re: [PATCH 1/2] hwmon: gpio-fan: move fan_alarm_init after devm_hwmon_device_register_with_groups
@ 2019-07-02 13:39 Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-07-02 13:39 UTC (permalink / raw)
To: cschneider; +Cc: linux-hwmon, christian
On Tue, Jul 02, 2019 at 03:23:37PM +0200, cschneider@radiodata.biz wrote:
> From: Christian Schneider <cschneider@radiodata.biz>
>
> 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>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/gpio-fan.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
> index 84753680a4e8..a962a9ee7225 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)
> @@ -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);
> --
> 2.22.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/2] hwmon: gpio-fan: move fan_alarm_init after devm_hwmon_device_register_with_groups
@ 2019-07-02 13:23 cschneider
0 siblings, 0 replies; 2+ messages in thread
From: cschneider @ 2019-07-02 13:23 UTC (permalink / raw)
To: linux-hwmon; +Cc: christian, linux, cschneider
From: Christian Schneider <cschneider@radiodata.biz>
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>
---
drivers/hwmon/gpio-fan.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index 84753680a4e8..a962a9ee7225 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)
@@ -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);
--
2.22.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-02 13:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 13:39 [PATCH 1/2] hwmon: gpio-fan: move fan_alarm_init after devm_hwmon_device_register_with_groups Guenter Roeck
-- strict thread matches above, loose matches on Subject: below --
2019-07-02 13:23 cschneider
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).