]> git.baikalelectronics.ru Git - kernel.git/commit
power: supply: sbs-battery: Prevent CAPACITY_MODE races
authorShawn Nematbakhsh <shawnn@chromium.org>
Tue, 13 Jun 2017 17:53:25 +0000 (10:53 -0700)
committerSebastian Reichel <sre@kernel.org>
Thu, 15 Jun 2017 14:51:25 +0000 (16:51 +0200)
commitf372716204c3b81148cfd02eb9652533ef332bb1
treecee4795b492c68ff19d5ab242ab48287d994f987
parentb96409b8f678b8079280e021c250288e194d3cd2
power: supply: sbs-battery: Prevent CAPACITY_MODE races

A subset of smart battery commands return charge or energy depending on
the CAPACITY_MODE bit setting of BatteryMode(). In order to
unambiguously read a charge or energy value, it is necessary to ensure
that CAPACITY_MODE is set as desired, and not changed for the duration
of the attribute read.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
drivers/power/supply/sbs-battery.c