summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-07-15 18:20:38 +0200
committerAnton Vorontsov <cbouatmailru@gmail.com>2009-07-30 17:35:58 +0400
commit2e83a5c5d2317c386de2880eb43ef0bef8eb1fa9 (patch)
tree39333e462d8aa49f94e5feef71b2f02064d092ba /drivers/power
parent4aed03ae58946c716c8e3f7060f8b500b8a8e30f (diff)
downloadlwn-2e83a5c5d2317c386de2880eb43ef0bef8eb1fa9.tar.gz
lwn-2e83a5c5d2317c386de2880eb43ef0bef8eb1fa9.zip
ds2760_battery: delay power supply registration
This fixes a race condition I recently introduced with the PMOD feature addition (cef437e3: "w1: ds2760_battery: add support for sleep mode feature"). Postpone the call to power_supply_register() to fix it. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu> Acked-by: Matt Reimer <mreimer@vpop.net> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/ds2760_battery.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c
index 520b5c49ff30..cf07c43e90cd 100644
--- a/drivers/power/ds2760_battery.c
+++ b/drivers/power/ds2760_battery.c
@@ -381,12 +381,6 @@ static int ds2760_battery_probe(struct platform_device *pdev)
di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN;
- retval = power_supply_register(&pdev->dev, &di->bat);
- if (retval) {
- dev_err(di->dev, "failed to register battery\n");
- goto batt_failed;
- }
-
/* enable sleep mode feature */
ds2760_battery_read_status(di);
status = di->raw[DS2760_STATUS_REG];
@@ -397,6 +391,12 @@ static int ds2760_battery_probe(struct platform_device *pdev)
ds2760_battery_write_status(di, status);
+ retval = power_supply_register(&pdev->dev, &di->bat);
+ if (retval) {
+ dev_err(di->dev, "failed to register battery\n");
+ goto batt_failed;
+ }
+
INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work);
di->monitor_wqueue = create_singlethread_workqueue(dev_name(&pdev->dev));
if (!di->monitor_wqueue) {