[RFC PATCH] bq27000 battery mutex protection

Werner Almesberger werner at openmoko.org
Mon Oct 12 18:37:06 CEST 2009

Michael Trimarchi wrote:
> Protect the data using a mutex. Fix a race that can happen when
> the user read from the sysfs and the worker execute in the middle.

Looks good, but I'd suggest to put the inner part of
bq27000_battery_get_property into a separate function and have a
small wrapper that does just the locking. This way, you can still
just return (keeps the code simpler) and there's no risk of ever
missing an unlock path.

- Werner

More information about the openmoko-kernel mailing list