diff mbox

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

Message ID 20120707085103.7b1a51ec@notabene.brown (mailing list archive)
State New, archived
Headers show

Commit Message

NeilBrown July 6, 2012, 10:51 p.m. UTC
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.


Signed-off-by: NeilBrown <neilb@suse.de>

Comments

Rafael Wysocki July 7, 2012, 8:55 p.m. UTC | #1
On Saturday, July 07, 2012, NeilBrown wrote:
> 
> 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.
> 
> 
> Signed-off-by: NeilBrown <neilb@suse.de>

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>

> 
> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index 6fc90be..b012efd 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -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) {
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Samuel Ortiz July 9, 2012, 11:15 a.m. UTC | #2
Hi Neil,

On Sat, Jul 07, 2012 at 08:51:03AM +1000, NeilBrown wrote:
> 
> 
> 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.
Applied, thanks.

Cheers,
Samuel.
diff mbox

Patch

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 6fc90be..b012efd 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -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) {