aboutsummaryrefslogtreecommitdiff
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-04-18 22:16:50 +0000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-04-30 15:37:20 +1000
commitea5c64b06743b505e0eb4e6caa1810fe685c9559 (patch)
tree61d98ccdc6a509424242457888ecd1102e20fca0 /drivers/macintosh
parenta94d72b13642364e4d9da6e9165da05c0e055507 (diff)
powerpc/windfarm: Improve display of fan speeds in sysfs
Controls registered as RPM and PWM fans are now displayed with the "RPM" or "%" suffix respectively to make it clearer to the user what the value actually means since the fan type isn't otherwise obvious. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/windfarm_core.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index ce8897933a8..ebafc2543d5 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -164,13 +164,24 @@ static ssize_t wf_show_control(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct wf_control *ctrl = container_of(attr, struct wf_control, attr);
+ const char *typestr;
s32 val = 0;
int err;
err = ctrl->ops->get_value(ctrl, &val);
if (err < 0)
return err;
- return sprintf(buf, "%d\n", val);
+ switch(ctrl->type) {
+ case WF_CONTROL_RPM_FAN:
+ typestr = " RPM";
+ break;
+ case WF_CONTROL_PWM_FAN:
+ typestr = " %";
+ break;
+ default:
+ typestr = "";
+ }
+ return sprintf(buf, "%d%s\n", val, typestr);
}
/* This is really only for debugging... */