diff options
author | David Brownell <david-b@pacbell.net> | 2006-09-03 16:16:45 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-26 00:08:38 -0400 |
commit | 386415d88b1ae50304f9c61aa3e0db082fa90428 (patch) | |
tree | 15672b43c03e0fc17ac0c8339883e7b4fb1a5073 | |
parent | bb84c89f94851161f387285d0a449b4a3f29f4df (diff) |
PM: platform_bus and late_suspend/early_resume
Teach platform_bus about the new suspend_late/resume_early PM calls,
issued with IRQs off. Do we really need sysdev and friends any more,
or can janitors start switching its users over to platform_device so
we can do a minor code-ectomy?
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/base/platform.c | 30 | ||||
-rw-r--r-- | include/linux/platform_device.h | 2 |
2 files changed, 30 insertions, 2 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 2b8755db76c6..940ce41f1887 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -505,12 +505,36 @@ static int platform_match(struct device * dev, struct device_driver * drv) | |||
505 | return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0); | 505 | return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0); |
506 | } | 506 | } |
507 | 507 | ||
508 | static int platform_suspend(struct device * dev, pm_message_t state) | 508 | static int platform_suspend(struct device *dev, pm_message_t mesg) |
509 | { | 509 | { |
510 | int ret = 0; | 510 | int ret = 0; |
511 | 511 | ||
512 | if (dev->driver && dev->driver->suspend) | 512 | if (dev->driver && dev->driver->suspend) |
513 | ret = dev->driver->suspend(dev, state); | 513 | ret = dev->driver->suspend(dev, mesg); |
514 | |||
515 | return ret; | ||
516 | } | ||
517 | |||
518 | static int platform_suspend_late(struct device *dev, pm_message_t mesg) | ||
519 | { | ||
520 | struct platform_driver *drv = to_platform_driver(dev->driver); | ||
521 | struct platform_device *pdev = container_of(dev, struct platform_device, dev); | ||
522 | int ret = 0; | ||
523 | |||
524 | if (dev->driver && drv->suspend_late) | ||
525 | ret = drv->suspend_late(pdev, mesg); | ||
526 | |||
527 | return ret; | ||
528 | } | ||
529 | |||
530 | static int platform_resume_early(struct device *dev) | ||
531 | { | ||
532 | struct platform_driver *drv = to_platform_driver(dev->driver); | ||
533 | struct platform_device *pdev = container_of(dev, struct platform_device, dev); | ||
534 | int ret = 0; | ||
535 | |||
536 | if (dev->driver && drv->resume_early) | ||
537 | ret = drv->resume_early(pdev); | ||
514 | 538 | ||
515 | return ret; | 539 | return ret; |
516 | } | 540 | } |
@@ -531,6 +555,8 @@ struct bus_type platform_bus_type = { | |||
531 | .match = platform_match, | 555 | .match = platform_match, |
532 | .uevent = platform_uevent, | 556 | .uevent = platform_uevent, |
533 | .suspend = platform_suspend, | 557 | .suspend = platform_suspend, |
558 | .suspend_late = platform_suspend_late, | ||
559 | .resume_early = platform_resume_early, | ||
534 | .resume = platform_resume, | 560 | .resume = platform_resume, |
535 | }; | 561 | }; |
536 | EXPORT_SYMBOL_GPL(platform_bus_type); | 562 | EXPORT_SYMBOL_GPL(platform_bus_type); |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 782090c68932..29cd6dee13db 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -49,6 +49,8 @@ struct platform_driver { | |||
49 | int (*remove)(struct platform_device *); | 49 | int (*remove)(struct platform_device *); |
50 | void (*shutdown)(struct platform_device *); | 50 | void (*shutdown)(struct platform_device *); |
51 | int (*suspend)(struct platform_device *, pm_message_t state); | 51 | int (*suspend)(struct platform_device *, pm_message_t state); |
52 | int (*suspend_late)(struct platform_device *, pm_message_t state); | ||
53 | int (*resume_early)(struct platform_device *); | ||
52 | int (*resume)(struct platform_device *); | 54 | int (*resume)(struct platform_device *); |
53 | struct device_driver driver; | 55 | struct device_driver driver; |
54 | }; | 56 | }; |