diff options
Diffstat (limited to 'drivers/base/platform.c')
| -rw-r--r-- | drivers/base/platform.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 8b4708e06244..ead3f64c41d0 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -469,22 +469,6 @@ static void platform_drv_shutdown(struct device *_dev) | |||
| 469 | drv->shutdown(dev); | 469 | drv->shutdown(dev); |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 472 | static int platform_drv_suspend(struct device *_dev, pm_message_t state) | ||
| 473 | { | ||
| 474 | struct platform_driver *drv = to_platform_driver(_dev->driver); | ||
| 475 | struct platform_device *dev = to_platform_device(_dev); | ||
| 476 | |||
| 477 | return drv->suspend(dev, state); | ||
| 478 | } | ||
| 479 | |||
| 480 | static int platform_drv_resume(struct device *_dev) | ||
| 481 | { | ||
| 482 | struct platform_driver *drv = to_platform_driver(_dev->driver); | ||
| 483 | struct platform_device *dev = to_platform_device(_dev); | ||
| 484 | |||
| 485 | return drv->resume(dev); | ||
| 486 | } | ||
| 487 | |||
| 488 | /** | 472 | /** |
| 489 | * platform_driver_register | 473 | * platform_driver_register |
| 490 | * @drv: platform driver structure | 474 | * @drv: platform driver structure |
| @@ -498,10 +482,10 @@ int platform_driver_register(struct platform_driver *drv) | |||
| 498 | drv->driver.remove = platform_drv_remove; | 482 | drv->driver.remove = platform_drv_remove; |
| 499 | if (drv->shutdown) | 483 | if (drv->shutdown) |
| 500 | drv->driver.shutdown = platform_drv_shutdown; | 484 | drv->driver.shutdown = platform_drv_shutdown; |
| 501 | if (drv->suspend) | 485 | if (drv->suspend || drv->resume) |
| 502 | drv->driver.suspend = platform_drv_suspend; | 486 | pr_warning("Platform driver '%s' needs updating - please use " |
| 503 | if (drv->resume) | 487 | "dev_pm_ops\n", drv->driver.name); |
| 504 | drv->driver.resume = platform_drv_resume; | 488 | |
| 505 | return driver_register(&drv->driver); | 489 | return driver_register(&drv->driver); |
| 506 | } | 490 | } |
| 507 | EXPORT_SYMBOL_GPL(platform_driver_register); | 491 | EXPORT_SYMBOL_GPL(platform_driver_register); |
| @@ -633,10 +617,12 @@ static int platform_match(struct device *dev, struct device_driver *drv) | |||
| 633 | 617 | ||
| 634 | static int platform_legacy_suspend(struct device *dev, pm_message_t mesg) | 618 | static int platform_legacy_suspend(struct device *dev, pm_message_t mesg) |
| 635 | { | 619 | { |
| 620 | struct platform_driver *pdrv = to_platform_driver(dev->driver); | ||
| 621 | struct platform_device *pdev = to_platform_device(dev); | ||
| 636 | int ret = 0; | 622 | int ret = 0; |
| 637 | 623 | ||
| 638 | if (dev->driver && dev->driver->suspend) | 624 | if (dev->driver && pdrv->suspend) |
| 639 | ret = dev->driver->suspend(dev, mesg); | 625 | ret = pdrv->suspend(pdev, mesg); |
| 640 | 626 | ||
| 641 | return ret; | 627 | return ret; |
| 642 | } | 628 | } |
| @@ -667,10 +653,12 @@ static int platform_legacy_resume_early(struct device *dev) | |||
| 667 | 653 | ||
| 668 | static int platform_legacy_resume(struct device *dev) | 654 | static int platform_legacy_resume(struct device *dev) |
| 669 | { | 655 | { |
| 656 | struct platform_driver *pdrv = to_platform_driver(dev->driver); | ||
| 657 | struct platform_device *pdev = to_platform_device(dev); | ||
| 670 | int ret = 0; | 658 | int ret = 0; |
| 671 | 659 | ||
| 672 | if (dev->driver && dev->driver->resume) | 660 | if (dev->driver && pdrv->resume) |
| 673 | ret = dev->driver->resume(dev); | 661 | ret = pdrv->resume(pdev); |
| 674 | 662 | ||
| 675 | return ret; | 663 | return ret; |
| 676 | } | 664 | } |
