Skip to content

Commit 52fb36a

Browse files
juhosggroeck
authored andcommitted
hwmon: (gpio-fan) Allow to stop FANs when CONFIG_PM is disabled
When CONFIG_PM is disabled, the GPIO controlled FANs can't be stopped by using the sysfs attributes since commit 0d01110 ("hwmon: (gpio-fan) Add regulator support"). Using either the 'pwm1' or the 'fan1_target' attribute fails the same way: $ echo 0 > /sys/class/hwmon/hwmon1/pwm1 ash: write error: Function not implemented $ echo 0 > /sys/class/hwmon/hwmon1/fan1_target ash: write error: Function not implemented Both commands were working flawlessly before the mentioned commit. The issue happens because pm_runtime_put_sync() returns with -ENOSYS when CONFIG_PM is disabled, and the set_fan_speed() function handles this as an error. In order to restore the previous behaviour, change the error check in the set_fan_speed() function to ignore the -ENOSYS error code. Cc: [email protected] Fixes: 0d01110 ("hwmon: (gpio-fan) Add regulator support") Signed-off-by: Gabor Juhos <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent f5c0927 commit 52fb36a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/hwmon/gpio-fan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static int set_fan_speed(struct gpio_fan_data *fan_data, int speed_index)
148148
int ret;
149149

150150
ret = pm_runtime_put_sync(fan_data->dev);
151-
if (ret < 0)
151+
if (ret < 0 && ret != -ENOSYS)
152152
return ret;
153153
}
154154

0 commit comments

Comments
 (0)