]> asedeno.scripts.mit.edu Git - linux.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)
commitfe8a6534396807b8a0863cd146b72c0bce0b0c88
treecee4795b492c68ff19d5ab242ab48287d994f987
parent48f680c0a9cae36e37d91a3dc086143d6047c8a8
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