diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-04-18 18:16:50 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-04-30 01:37:20 -0400 |
commit | ea5c64b06743b505e0eb4e6caa1810fe685c9559 (patch) | |
tree | 61d98ccdc6a509424242457888ecd1102e20fca0 /drivers/macintosh | |
parent | a94d72b13642364e4d9da6e9165da05c0e055507 (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.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c index ce8897933a84..ebafc2543d5f 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, | |||
164 | struct device_attribute *attr, char *buf) | 164 | struct device_attribute *attr, char *buf) |
165 | { | 165 | { |
166 | struct wf_control *ctrl = container_of(attr, struct wf_control, attr); | 166 | struct wf_control *ctrl = container_of(attr, struct wf_control, attr); |
167 | const char *typestr; | ||
167 | s32 val = 0; | 168 | s32 val = 0; |
168 | int err; | 169 | int err; |
169 | 170 | ||
170 | err = ctrl->ops->get_value(ctrl, &val); | 171 | err = ctrl->ops->get_value(ctrl, &val); |
171 | if (err < 0) | 172 | if (err < 0) |
172 | return err; | 173 | return err; |
173 | return sprintf(buf, "%d\n", val); | 174 | switch(ctrl->type) { |
175 | case WF_CONTROL_RPM_FAN: | ||
176 | typestr = " RPM"; | ||
177 | break; | ||
178 | case WF_CONTROL_PWM_FAN: | ||
179 | typestr = " %"; | ||
180 | break; | ||
181 | default: | ||
182 | typestr = ""; | ||
183 | } | ||
184 | return sprintf(buf, "%d%s\n", val, typestr); | ||
174 | } | 185 | } |
175 | 186 | ||
176 | /* This is really only for debugging... */ | 187 | /* This is really only for debugging... */ |