Re: [PATCH 04/12] hdaps: Correct readout and remove nonsensical attributes

From: Pavel Machek
Date: Mon Aug 07 2006 - 10:12:17 EST


> The current hdaps driver got some details wrong about the result of
> hardware queries.
> First, it fails to check a couple of status values.
> Second, it turns out that the hardware will return up to two readouts:
> the latest one and also the previous one if it was missed (host didn't
> poll fast enough). The current driver wrongly interprets the latter as
> a "variance", which is nonsensical. We have no use for that previous
> readout, so it should be ignored.
> This patch adds proper status checking, and removes the "variance" and
> "temp2" sysfs attributes which refer to the old readout.
> Signed-off-by: Shem Multinymous <multinymous@xxxxxxxxx>

Signed-off-by: Pavel Machek <pavel@xxxxxxx>

> + if (data.val[EC_ACCEL_IDX_READOUTS]<1)

Could we get spaces around '<'?

> + int total, ret;
> + for (total=READ_TIMEOUT_MSECS; total>0; total-=RETRY_MSECS) {

Could we go from 0 to timeout, not the other way around?

> static DEVICE_ATTR(position, 0444, hdaps_position_show, NULL);
> -static DEVICE_ATTR(variance, 0444, hdaps_variance_show, NULL);
> static DEVICE_ATTR(temp1, 0444, hdaps_temp1_show, NULL);
> -static DEVICE_ATTR(temp2, 0444, hdaps_temp2_show, NULL);
> + /* "temp1" instead of "temperature" is hwmon convention */
> static DEVICE_ATTR(keyboard_activity, 0444, hdaps_keyboard_activity_show, NULL);
> static DEVICE_ATTR(mouse_activity, 0444, hdaps_mouse_activity_show, NULL);
> static DEVICE_ATTR(calibrate, 0644, hdaps_calibrate_show,hdaps_calibrate_store);

This actually changes userland interface... but that is probably okay.

Thanks for all the (sleeping) penguins.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at