Re: [PATCH 10/10] i8k: Add support for fan labels

From: Pali RohÃr
Date: Mon Dec 22 2014 - 03:07:45 EST


On Monday 22 December 2014 00:01:49 Guenter Roeck wrote:
> > +static ssize_t i8k_hwmon_show_fan_label(struct device *dev,
> > + struct device_attribute *devattr,
> > + char *buf)
> > +{
> > + static const char * const labels[] = {
> > + "Processor Fan",
> > + "Motherboard Fan",
> > + "Video Fan",
> > + "Power Supply Fan",
> > + "Chipset Fan",
> > + "Other Fan",
> > + };
> > + int index = to_sensor_dev_attr(devattr)->index;
> > + bool dock = false;
> > + int type;
> > +
> > + type = i8k_get_fan_type(index);
> > + if (type < 0)
> > + return type;
> > +
> > + if (type & 0x10) {
> > + dock = true;
> > + type &= 0x0F;
> > + }
> > +
>
> What if bit 5..7 is set ? This would result in a result of
> "other fan", which given the above does not seem to be
> correct. Given that, I wonder why the type mask is only
> applied if bit 4 is set and not unconditionally.
>
> Thanks,
> Guenter
>

NBSVC.MDM maps values 0x0-0x5 to exactly to strings in labels[].
Next it maps 0x10-0x15 to values same values in strings labels[]
but with prefix "Docking". I do not see nothing more in NBSVC.MDM
so for other values is "Other Fan" better than nothing.

--
Pali RohÃr
pali.rohar@xxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part.