linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pwm-fan) Ensure the fan going on in .probe()
@ 2021-11-30  9:22 Billy Tsai
  2021-11-30 10:38 ` Uwe Kleine-König
  2021-11-30 14:33 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Billy Tsai @ 2021-11-30  9:22 UTC (permalink / raw)
  To: b.zolnierkie, jdelvare, linux, u.kleine-koenig, linux-hwmon,
	linux-kernel
  Cc: BMC-SW, stable

Before commit 86585c61972f ("hwmon: (pwm-fan) stop using legacy
PWM functions and some cleanups") pwm_apply_state() was called
unconditionally in pwm_fan_probe(). In this commit this direct
call was replaced by a call to __set_pwm(ct, MAX_PWM) which
however is a noop if ctx->pwm_value already matches the value to
set.
After probe the fan is supposed to run at full speed, and the
internal driver state suggests it does, but this isn't asserted
and depending on bootloader and pwm low-level driver, the fan
might just be off.
So drop setting pwm_value to MAX_PWM to ensure the check in
__set_pwm doesn't make it exit early and the fan goes on as
intended.

Cc: stable@vger.kernel.org
Fixes: 86585c61972f ("hwmon: (pwm-fan) stop using legacy PWM functions and some cleanups")
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
 drivers/hwmon/pwm-fan.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 17518b4cab1b..f12b9a28a232 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -336,8 +336,6 @@ static int pwm_fan_probe(struct platform_device *pdev)
 			return ret;
 	}
 
-	ctx->pwm_value = MAX_PWM;
-
 	pwm_init_state(ctx->pwm, &ctx->pwm_state);
 
 	/*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (pwm-fan) Ensure the fan going on in .probe()
  2021-11-30  9:22 [PATCH] hwmon: (pwm-fan) Ensure the fan going on in .probe() Billy Tsai
@ 2021-11-30 10:38 ` Uwe Kleine-König
  2021-11-30 14:33 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2021-11-30 10:38 UTC (permalink / raw)
  To: Billy Tsai
  Cc: b.zolnierkie, jdelvare, linux, linux-hwmon, linux-kernel, BMC-SW, stable

[-- Attachment #1: Type: text/plain, Size: 1211 bytes --]

On Tue, Nov 30, 2021 at 05:22:12PM +0800, Billy Tsai wrote:
> Before commit 86585c61972f ("hwmon: (pwm-fan) stop using legacy
> PWM functions and some cleanups") pwm_apply_state() was called
> unconditionally in pwm_fan_probe(). In this commit this direct
> call was replaced by a call to __set_pwm(ct, MAX_PWM) which
> however is a noop if ctx->pwm_value already matches the value to
> set.
> After probe the fan is supposed to run at full speed, and the
> internal driver state suggests it does, but this isn't asserted
> and depending on bootloader and pwm low-level driver, the fan
> might just be off.
> So drop setting pwm_value to MAX_PWM to ensure the check in
> __set_pwm doesn't make it exit early and the fan goes on as
> intended.
> 
> Cc: stable@vger.kernel.org
> Fixes: 86585c61972f ("hwmon: (pwm-fan) stop using legacy PWM functions and some cleanups")
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>

Nice commit log :-)

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (pwm-fan) Ensure the fan going on in .probe()
  2021-11-30  9:22 [PATCH] hwmon: (pwm-fan) Ensure the fan going on in .probe() Billy Tsai
  2021-11-30 10:38 ` Uwe Kleine-König
@ 2021-11-30 14:33 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2021-11-30 14:33 UTC (permalink / raw)
  To: Billy Tsai, b.zolnierkie, jdelvare, u.kleine-koenig, linux-hwmon,
	linux-kernel
  Cc: BMC-SW, stable

On 11/30/21 1:22 AM, Billy Tsai wrote:
> Before commit 86585c61972f ("hwmon: (pwm-fan) stop using legacy
> PWM functions and some cleanups") pwm_apply_state() was called
> unconditionally in pwm_fan_probe(). In this commit this direct
> call was replaced by a call to __set_pwm(ct, MAX_PWM) which
> however is a noop if ctx->pwm_value already matches the value to
> set.
> After probe the fan is supposed to run at full speed, and the
> internal driver state suggests it does, but this isn't asserted
> and depending on bootloader and pwm low-level driver, the fan
> might just be off.
> So drop setting pwm_value to MAX_PWM to ensure the check in
> __set_pwm doesn't make it exit early and the fan goes on as
> intended.
> 
> Cc: stable@vger.kernel.org
> Fixes: 86585c61972f ("hwmon: (pwm-fan) stop using legacy PWM functions and some cleanups")
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>

I'll apply this patch, but _please_ version your patches in the future
and provide a change log.

Guenter

> ---
>   drivers/hwmon/pwm-fan.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
> index 17518b4cab1b..f12b9a28a232 100644
> --- a/drivers/hwmon/pwm-fan.c
> +++ b/drivers/hwmon/pwm-fan.c
> @@ -336,8 +336,6 @@ static int pwm_fan_probe(struct platform_device *pdev)
>   			return ret;
>   	}
>   
> -	ctx->pwm_value = MAX_PWM;
> -
>   	pwm_init_state(ctx->pwm, &ctx->pwm_state);
>   
>   	/*
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-30 14:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30  9:22 [PATCH] hwmon: (pwm-fan) Ensure the fan going on in .probe() Billy Tsai
2021-11-30 10:38 ` Uwe Kleine-König
2021-11-30 14:33 ` Guenter Roeck

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).