UPSTREAM: power_supply: fix return value of get_property
authorRhyland Klein <rklein@nvidia.com>
Wed, 22 Jun 2016 15:45:52 +0000 (11:45 -0400)
committerCaesar Wang <wxt@rock-chips.com>
Tue, 22 Nov 2016 03:40:28 +0000 (11:40 +0800)
commite342aa46661c34dbc7c81f16de5d74703f7f2029
tree2e826d4ea4a267689f1e58caa8e0c76c7e3f34c5
parenta3da9a9bfeb7e56178d246cdd22277919da7ce67
UPSTREAM: power_supply: fix return value of get_property

power_supply_get_property() should ideally return -EAGAIN if it is
called while the power_supply is being registered. There was no way
previously to determine if use_cnt == 0 meant that the power_supply
wasn't fully registered yet, or if it had already been unregistered.

Add a new boolean to the power_supply struct to simply show if
registration is completed. Lastly, modify the check in
power_supply_show_property() to also ignore -EAGAIN when so it
doesn't complain about not returning the property.

Change-Id: I8a710802534c033d64589d8d213eeaa36d9cc7d7
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry picked from commit e380538529e83c5d3fd27e8cbfcc1f9799cb6bbb)
drivers/power/power_supply_core.c
drivers/power/power_supply_sysfs.c
include/linux/power_supply.h