linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MFD: twl-core: move device_init_wakeup to after platform_device_add.
@ 2012-07-06 22:51 NeilBrown
  2012-07-07 20:55 ` Rafael J. Wysocki
  2012-07-09 11:15 ` Samuel Ortiz
  0 siblings, 2 replies; 3+ messages in thread
From: NeilBrown @ 2012-07-06 22:51 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, linux-omap, linux-pm

[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]



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>

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) {

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [PATCH] MFD: twl-core: move device_init_wakeup to after platform_device_add.
  2012-07-06 22:51 [PATCH] MFD: twl-core: move device_init_wakeup to after platform_device_add NeilBrown
@ 2012-07-07 20:55 ` Rafael J. Wysocki
  2012-07-09 11:15 ` Samuel Ortiz
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2012-07-07 20:55 UTC (permalink / raw)
  To: NeilBrown; +Cc: Samuel Ortiz, linux-kernel, linux-omap, linux-pm

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) {
> 


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

* Re: [PATCH] MFD: twl-core: move device_init_wakeup to after platform_device_add.
  2012-07-06 22:51 [PATCH] MFD: twl-core: move device_init_wakeup to after platform_device_add NeilBrown
  2012-07-07 20:55 ` Rafael J. Wysocki
@ 2012-07-09 11:15 ` Samuel Ortiz
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Ortiz @ 2012-07-09 11:15 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux-kernel, linux-omap, linux-pm

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.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2012-07-09 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06 22:51 [PATCH] MFD: twl-core: move device_init_wakeup to after platform_device_add NeilBrown
2012-07-07 20:55 ` Rafael J. Wysocki
2012-07-09 11:15 ` Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).