summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2007-04-27 22:00:12 -0300
committerLen Brown <len.brown@intel.com>2007-04-28 21:41:19 -0400
commitc573ddb998456a89a5ccb83a922d2c8ba18484a6 (patch)
tree73a40208efc05e8243ec48788725f11251de4b70 /drivers/misc
parentca4ac2f48a4502bbbfcb47b86312273c28194f53 (diff)
ACPI: thinkpad-acpi: map ENXIO to EINVAL for fan sysfs
Currently, all fan control operations return ENXIO if unsupported operations are requested, but return EINVAL if invalid fan modes are requested on a given ThinkPad. This is not strictly correct for sysfs, so map ENXIO to EINVAL in the sysfs attribute store handlers, as we do benefit from the ENXIO in other parts of the driver code. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/thinkpad_acpi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index b85f0960e60..7aed118ca82 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -2824,7 +2824,9 @@ static ssize_t fan_pwm1_enable_store(struct device *dev,
}
res = fan_set_level_safe(level);
- if (res < 0)
+ if (res == -ENXIO)
+ return -EINVAL;
+ else if (res < 0)
return res;
fan_watchdog_reset();
@@ -2888,7 +2890,9 @@ static ssize_t fan_pwm1_store(struct device *dev,
if (!rc && (status &
(TP_EC_FAN_AUTO | TP_EC_FAN_FULLSPEED)) == 0) {
rc = fan_set_level(newlevel);
- if (!rc) {
+ if (rc == -ENXIO)
+ rc = -EINVAL;
+ else if (!rc) {
fan_update_desired_level(newlevel);
fan_watchdog_reset();
}