diff options
author | Zhang Rui <rui.zhang@intel.com> | 2014-05-28 15:23:37 +0800 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-30 13:45:25 +0200 |
commit | 9113e260767b1cb44f8da0e5922e1a9a5417c4b8 (patch) | |
tree | 12753a12dfda868b7c993d9c9b182abf881158d6 /drivers/power | |
parent | 1ac5aaa67290b397712e4410de7f067d5cd85871 (diff) | |
download | op-kernel-dev-9113e260767b1cb44f8da0e5922e1a9a5417c4b8.zip op-kernel-dev-9113e260767b1cb44f8da0e5922e1a9a5417c4b8.tar.gz |
power_supply: allow power supply devices registered w/o wakeup source
Currently, all the power supply devices are registered with wakeup source,
this results in that every power_supply_changed() invocation brings
the system out of suspend-to-freeze state.
This is overkill as some device drivers, e.g. ACPI battery driver,
have the ability to check the device status and wake up the system
from sleeping only when necessary.
Thus introduce a new API which allows device to be registered
w/o wakeup source.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/power_supply_core.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 2660664..5a5a24e 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c @@ -537,7 +537,7 @@ static void psy_unregister_cooler(struct power_supply *psy) } #endif -int power_supply_register(struct device *parent, struct power_supply *psy) +int __power_supply_register(struct device *parent, struct power_supply *psy, bool ws) { struct device *dev; int rc; @@ -568,7 +568,7 @@ int power_supply_register(struct device *parent, struct power_supply *psy) } spin_lock_init(&psy->changed_lock); - rc = device_init_wakeup(dev, true); + rc = device_init_wakeup(dev, ws); if (rc) goto wakeup_init_failed; @@ -606,8 +606,19 @@ dev_set_name_failed: success: return rc; } + +int power_supply_register(struct device *parent, struct power_supply *psy) +{ + return __power_supply_register(parent, psy, true); +} EXPORT_SYMBOL_GPL(power_supply_register); +int power_supply_register_no_ws(struct device *parent, struct power_supply *psy) +{ + return __power_supply_register(parent, psy, false); +} +EXPORT_SYMBOL_GPL(power_supply_register_no_ws); + void power_supply_unregister(struct power_supply *psy) { cancel_work_sync(&psy->changed_work); |