Skip to content

Commit

Permalink
USB: Rework musb suspend()/resume_early()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Magnus Damm authored and Rafael J. Wysocki committed Jul 21, 2009
1 parent 6a6c618 commit 48fea96
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions drivers/usb/musb/musb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2168,8 +2168,9 @@ static int __devexit musb_remove(struct platform_device *pdev)

#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;
struct musb *musb = dev_to_musb(&pdev->dev);

Expand All @@ -2196,8 +2197,9 @@ static int musb_suspend(struct platform_device *pdev, pm_message_t message)
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);

if (!musb->clock)
Expand All @@ -2215,21 +2217,25 @@ static int musb_resume_early(struct platform_device *pdev)
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
#define musb_suspend NULL
#define musb_resume_early NULL
#define MUSB_DEV_PM_OPS NULL
#endif

static struct platform_driver musb_driver = {
.driver = {
.name = (char *)musb_driver_name,
.bus = &platform_bus_type,
.owner = THIS_MODULE,
.pm = MUSB_DEV_PM_OPS,
},
.remove = __devexit_p(musb_remove),
.shutdown = musb_shutdown,
.suspend = musb_suspend,
.resume_early = musb_resume_early,
};

/*-------------------------------------------------------------------------*/
Expand Down

0 comments on commit 48fea96

Please sign in to comment.