public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] ds2760: delay power supply registration
@ 2009-07-15 16:20 Daniel Mack
  2009-07-15 16:20 ` [PATCH 2/4] ds2760: export more features Daniel Mack
  2009-07-15 18:05 ` [PATCH 1/4] ds2760: delay power supply registration Matt Reimer
  0 siblings, 2 replies; 13+ messages in thread
From: Daniel Mack @ 2009-07-15 16:20 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Daniel Mack, Szabolcs Gyurko, Matt Reimer, Anton Vorontsov

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>
Cc: Matt Reimer <mreimer@vpop.net>
Cc: Anton Vorontsov <cbou@mail.ru>
---
 drivers/power/ds2760_battery.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c
index 520b5c4..cf07c43 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) {
-- 
1.6.3.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-07-15 20:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15 16:20 [PATCH 1/4] ds2760: delay power supply registration Daniel Mack
2009-07-15 16:20 ` [PATCH 2/4] ds2760: export more features Daniel Mack
2009-07-15 16:20   ` [PATCH 3/4] ds2760: add rated_capacity module parameter Daniel Mack
2009-07-15 16:20     ` [PATCH 4/4] ds2760: handle full_active_uAh == 0 case correctly Daniel Mack
2009-07-15 18:06       ` Matt Reimer
2009-07-15 18:51         ` Daniel Mack
2009-07-15 19:06           ` Andrew Morton
2009-07-15 19:28             ` Anton Vorontsov
2009-07-15 20:02               ` Daniel Mack
2009-07-15 20:57                 ` Daniel Mack
2009-07-15 18:06     ` [PATCH 3/4] ds2760: add rated_capacity module parameter Matt Reimer
2009-07-15 18:06   ` [PATCH 2/4] ds2760: export more features Matt Reimer
2009-07-15 18:05 ` [PATCH 1/4] ds2760: delay power supply registration Matt Reimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox