power: supply: sbs-battery: move gpio present detect to sbs_get_property
authorPhil Reid <preid@electromag.com.au>
Thu, 24 Aug 2017 09:31:10 +0000 (17:31 +0800)
committerWolfram Sang <wsa@the-dreams.de>
Sat, 28 Oct 2017 21:43:32 +0000 (23:43 +0200)
commit1cf855535b034579ac4d39f49da853594ce968dc
tree348d1193421a7ef3f2f6fee9c602bdb913a2dd8f
parenta0b8839e2afc6613566ab723f8e3f0e698e9e007
power: supply: sbs-battery: move gpio present detect to sbs_get_property

Currently when a gpio is defined for battery presence it is only used in
the sbs_get_battery_presence_and_health function for 2 properties.
All other properties currently try to read data form the battery before
returning an error if not present. We should know in advance that no
data is going to returned.

As the driver tries multiple times to access a property, this prevents
a lot of smbus accesses, which had a significant effect on device boot-up.
As when the device is registered lots of property accesses are attempted
during boot.

If no gpio is used for presence detection no change in behaviour should
occur.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/power/supply/sbs-battery.c