aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/platform.c30
-rw-r--r--include/linux/platform_device.h2
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
508static int platform_suspend(struct device * dev, pm_message_t state) 508static 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
518static 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
530static 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};
536EXPORT_SYMBOL_GPL(platform_bus_type); 562EXPORT_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};