Skip to content

Commit

Permalink
powerpc/windfarm: Improve display of fan speeds in sysfs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Benjamin Herrenschmidt committed Apr 30, 2012
1 parent a94d72b commit ea5c64b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/macintosh/windfarm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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... */
Expand Down

0 comments on commit ea5c64b

Please sign in to comment.