diff options
author | Xing Tong Wu <xingtong.wu@siemens.com> | 2023-11-21 11:16:04 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-02-05 23:14:28 +0300 |
commit | 6f86bbf92cc5ebb304b1f8be43279354c4285daf (patch) | |
tree | 1619ad6f7e9ecf163b6504848bf6149182e0c1de /drivers/hwmon | |
parent | 8a315206425b51f0afc130010ff308f1480fda0e (diff) | |
download | linux-6f86bbf92cc5ebb304b1f8be43279354c4285daf.tar.xz |
hwmon: (nct6775) Fix fan speed set failure in automatic mode
[ Upstream commit 8b3800256abad20e91c2698607f9b28591407b19 ]
Setting the fan speed is only valid in manual mode; it is not possible
to set the fan's speed in automatic mode.
Return error when attempting to set the fan speed in automatic mode.
Signed-off-by: Xing Tong Wu <xingtong.wu@siemens.com>
Link: https://lore.kernel.org/r/20231121081604.2499-3-xingtong_wu@163.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/nct6775-core.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c index d928eb8ae5a3..92a49fafe2c0 100644 --- a/drivers/hwmon/nct6775-core.c +++ b/drivers/hwmon/nct6775-core.c @@ -2553,6 +2553,13 @@ store_pwm(struct device *dev, struct device_attribute *attr, const char *buf, int err; u16 reg; + /* + * The fan control mode should be set to manual if the user wants to adjust + * the fan speed. Otherwise, it will fail to set. + */ + if (index == 0 && data->pwm_enable[nr] > manual) + return -EBUSY; + err = kstrtoul(buf, 10, &val); if (err < 0) return err; |