[RFC PATCH] bq27000_battery. Retains old value in ETIME error

Mike Westerhof (mwester) mwester at dls.net
Thu Jul 30 19:03:05 CEST 2009

Michael Trimarchi wrote:
> Timo Lindfors wrote:
>> Michael Trimarchi <trimarchi at gandalf.sssup.it> writes:
>>> Fix a possible invalid update of the battery value. If the hdq goes
>>> in timeout
>>> the driver must manteins the old value.
>> Is there a bug report about this? Did it previously just return bogus
>> data as voltage or temperature?
> Return bogus data and sometimes android switch off. For now is a fix of
> invalid data

Shouldn't user-space be alerted to the invalid data, and deal with it in
a user-space-specific fashion?  It seems to me that this patch is really
just having the kernel lie to user-space, since the truth of the matter
is that if we get an ETIME error in the kernel, we don't know what the
real values are.

Maybe we should return "-1" as the value for the fields instead.

(If we do decide that the kernel should preserve the last valid values,
then I think we do need to provide a sysfs "error" node, set to "1" by
the kernel when it has encountered an ETIME or similar error, and
cleared at resume time, or when userspace clears that flag explicitly.)

Mike (mwester)

More information about the openmoko-kernel mailing list