2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 20:53:53 +08:00

USB: Rework musb suspend()/resume_early()

This patch reworks platform driver power management code
for musb from legacy callbacks to dev_pm_ops.

The callbacks are converted for CONFIG_SUSPEND like this:
  suspend() -> suspend()
  resume_early() -> resume_noirq()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
This commit is contained in:
Magnus Damm 2009-07-08 13:22:56 +02:00 committed by Rafael J. Wysocki
parent 6a6c6189b1
commit 48fea9659e

View File

@ -2168,8 +2168,9 @@ static int __devexit musb_remove(struct platform_device *pdev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int musb_suspend(struct platform_device *pdev, pm_message_t message) static int musb_suspend(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
unsigned long flags; unsigned long flags;
struct musb *musb = dev_to_musb(&pdev->dev); struct musb *musb = dev_to_musb(&pdev->dev);
@ -2196,8 +2197,9 @@ static int musb_suspend(struct platform_device *pdev, pm_message_t message)
return 0; return 0;
} }
static int musb_resume_early(struct platform_device *pdev) static int musb_resume_noirq(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct musb *musb = dev_to_musb(&pdev->dev); struct musb *musb = dev_to_musb(&pdev->dev);
if (!musb->clock) if (!musb->clock)
@ -2215,9 +2217,14 @@ static int musb_resume_early(struct platform_device *pdev)
return 0; return 0;
} }
static struct dev_pm_ops musb_dev_pm_ops = {
.suspend = musb_suspend,
.resume_noirq = musb_resume_noirq,
};
#define MUSB_DEV_PM_OPS (&musb_dev_pm_ops)
#else #else
#define musb_suspend NULL #define MUSB_DEV_PM_OPS NULL
#define musb_resume_early NULL
#endif #endif
static struct platform_driver musb_driver = { static struct platform_driver musb_driver = {
@ -2225,11 +2232,10 @@ static struct platform_driver musb_driver = {
.name = (char *)musb_driver_name, .name = (char *)musb_driver_name,
.bus = &platform_bus_type, .bus = &platform_bus_type,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = MUSB_DEV_PM_OPS,
}, },
.remove = __devexit_p(musb_remove), .remove = __devexit_p(musb_remove),
.shutdown = musb_shutdown, .shutdown = musb_shutdown,
.suspend = musb_suspend,
.resume_early = musb_resume_early,
}; };
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/