Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: Move twl-core 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.

Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

NeilBrown and committed by
Samuel Ortiz
17ffba6a 5500e396

+2 -1
+2 -1
drivers/mfd/twl-core.c
··· 568 568 goto err; 569 569 } 570 570 571 - device_init_wakeup(&pdev->dev, can_wakeup); 572 571 pdev->dev.parent = &twl->client->dev; 573 572 574 573 if (pdata) { ··· 592 593 } 593 594 594 595 status = platform_device_add(pdev); 596 + if (status == 0) 597 + device_init_wakeup(&pdev->dev, can_wakeup); 595 598 596 599 err: 597 600 if (status < 0) {