Skip to contentSkip to conversation

MFD: twl-core: move device_init_wakeup to after platform_device_add.

PATCH Applied NeilBrown 3 participants 3 messages Jul 6, 2012 – Jul 9, 2012

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 MFD: twl-core: move device_init_wakeup to after platform_device_add.

device_init_wakeup uses the dev_name() of the device to set the name of the wakeup_source which appears in /sys/kernel/debug/wakeup_sources.

For a platform device, that name is not set until platform_device_add calls dev_set_name.

So the call to device_init_wakeup() must be after the call to platform_device_add().
Making this change causes correct names to appear in the wakeup_sources file.

drivers/mfd/twl-core.c +2 -1
index 6fc90be..b012efd 100644
@@ -568,7 +568,6 @@ add_numbered_child(unsigned chip, const char *name, int num,
 		goto err;
 	}
 
-	device_init_wakeup(&pdev->dev, can_wakeup);
 	pdev->dev.parent = &twl->client->dev;
 
 	if (pdata) {
@@ -593,6 +592,8 @@ add_numbered_child(unsigned chip, const char *name, int num,
 	}
 
 	status = platform_device_add(pdev);
+	if (status == 0)
+		device_init_wakeup(&pdev->dev, can_wakeup);
 
 err:
 	if (status < 0) {
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · NeilBrown

device_init_wakeup uses the dev_name() of the device to set the name of the wakeup_source which appears in /sys/kernel/debug/wakeup_sources.

For a platform device, that name is not set until platform_device_add calls dev_set_name.

Quoted 7 lines

So the call to device_init_wakeup() must be after the call to platform_device_add().
Making this change causes correct names to appear in the wakeup_sources file.

Quoted 23 lines
drivers/mfd/twl-core.c +2 -1
index 6fc90be..b012efd 100644
@@ -568,7 +568,6 @@ add_numbered_child(unsigned chip, const char *name, int num,
 		goto err;
 	}
 
-	device_init_wakeup(&pdev->dev, can_wakeup);
 	pdev->dev.parent = &twl->client->dev;
 
 	if (pdata) {
@@ -593,6 +592,8 @@ add_numbered_child(unsigned chip, const char *name, int num,
 	}
 
 	status = platform_device_add(pdev);
+	if (status == 0)
+		device_init_wakeup(&pdev->dev, can_wakeup);
 
 err:
 	if (status < 0) {
Applied
#2 lore raw
In reply to NeilBrown

Hi Neil,

Quoted 6 lines · NeilBrown

device_init_wakeup uses the dev_name() of the device to set the name of the wakeup_source which appears in /sys/kernel/debug/wakeup_sources.

Quoted 7 lines

For a platform device, that name is not set until platform_device_add calls dev_set_name.

So the call to device_init_wakeup() must be after the call to platform_device_add().
Making this change causes correct names to appear in the wakeup_sources file.

Applied, thanks.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/