aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/platform.c38
-rw-r--r--drivers/base/power/main.c8
2 files changed, 6 insertions, 40 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 81cb01bfc356..ae5c4aa6d269 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -628,30 +628,6 @@ static int platform_legacy_suspend(struct device *dev, pm_message_t mesg)
628 return ret; 628 return ret;
629} 629}
630 630
631static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg)
632{
633 struct platform_driver *pdrv = to_platform_driver(dev->driver);
634 struct platform_device *pdev = to_platform_device(dev);
635 int ret = 0;
636
637 if (dev->driver && pdrv->suspend_late)
638 ret = pdrv->suspend_late(pdev, mesg);
639
640 return ret;
641}
642
643static int platform_legacy_resume_early(struct device *dev)
644{
645 struct platform_driver *pdrv = to_platform_driver(dev->driver);
646 struct platform_device *pdev = to_platform_device(dev);
647 int ret = 0;
648
649 if (dev->driver && pdrv->resume_early)
650 ret = pdrv->resume_early(pdev);
651
652 return ret;
653}
654
655static int platform_legacy_resume(struct device *dev) 631static int platform_legacy_resume(struct device *dev)
656{ 632{
657 struct platform_driver *pdrv = to_platform_driver(dev->driver); 633 struct platform_driver *pdrv = to_platform_driver(dev->driver);
@@ -714,8 +690,6 @@ static int platform_pm_suspend_noirq(struct device *dev)
714 if (drv->pm) { 690 if (drv->pm) {
715 if (drv->pm->suspend_noirq) 691 if (drv->pm->suspend_noirq)
716 ret = drv->pm->suspend_noirq(dev); 692 ret = drv->pm->suspend_noirq(dev);
717 } else {
718 ret = platform_legacy_suspend_late(dev, PMSG_SUSPEND);
719 } 693 }
720 694
721 return ret; 695 return ret;
@@ -750,8 +724,6 @@ static int platform_pm_resume_noirq(struct device *dev)
750 if (drv->pm) { 724 if (drv->pm) {
751 if (drv->pm->resume_noirq) 725 if (drv->pm->resume_noirq)
752 ret = drv->pm->resume_noirq(dev); 726 ret = drv->pm->resume_noirq(dev);
753 } else {
754 ret = platform_legacy_resume_early(dev);
755 } 727 }
756 728
757 return ret; 729 return ret;
@@ -797,8 +769,6 @@ static int platform_pm_freeze_noirq(struct device *dev)
797 if (drv->pm) { 769 if (drv->pm) {
798 if (drv->pm->freeze_noirq) 770 if (drv->pm->freeze_noirq)
799 ret = drv->pm->freeze_noirq(dev); 771 ret = drv->pm->freeze_noirq(dev);
800 } else {
801 ret = platform_legacy_suspend_late(dev, PMSG_FREEZE);
802 } 772 }
803 773
804 return ret; 774 return ret;
@@ -833,8 +803,6 @@ static int platform_pm_thaw_noirq(struct device *dev)
833 if (drv->pm) { 803 if (drv->pm) {
834 if (drv->pm->thaw_noirq) 804 if (drv->pm->thaw_noirq)
835 ret = drv->pm->thaw_noirq(dev); 805 ret = drv->pm->thaw_noirq(dev);
836 } else {
837 ret = platform_legacy_resume_early(dev);
838 } 806 }
839 807
840 return ret; 808 return ret;
@@ -869,8 +837,6 @@ static int platform_pm_poweroff_noirq(struct device *dev)
869 if (drv->pm) { 837 if (drv->pm) {
870 if (drv->pm->poweroff_noirq) 838 if (drv->pm->poweroff_noirq)
871 ret = drv->pm->poweroff_noirq(dev); 839 ret = drv->pm->poweroff_noirq(dev);
872 } else {
873 ret = platform_legacy_suspend_late(dev, PMSG_HIBERNATE);
874 } 840 }
875 841
876 return ret; 842 return ret;
@@ -905,8 +871,6 @@ static int platform_pm_restore_noirq(struct device *dev)
905 if (drv->pm) { 871 if (drv->pm) {
906 if (drv->pm->restore_noirq) 872 if (drv->pm->restore_noirq)
907 ret = drv->pm->restore_noirq(dev); 873 ret = drv->pm->restore_noirq(dev);
908 } else {
909 ret = platform_legacy_resume_early(dev);
910 } 874 }
911 875
912 return ret; 876 return ret;
@@ -925,7 +889,7 @@ static int platform_pm_restore_noirq(struct device *dev)
925 889
926#endif /* !CONFIG_HIBERNATION */ 890#endif /* !CONFIG_HIBERNATION */
927 891
928static struct dev_pm_ops platform_dev_pm_ops = { 892static const struct dev_pm_ops platform_dev_pm_ops = {
929 .prepare = platform_pm_prepare, 893 .prepare = platform_pm_prepare,
930 .complete = platform_pm_complete, 894 .complete = platform_pm_complete,
931 .suspend = platform_pm_suspend, 895 .suspend = platform_pm_suspend,
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 58a3e572f2c9..1b1a786b7dec 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -157,8 +157,9 @@ void device_pm_move_last(struct device *dev)
157 * @ops: PM operations to choose from. 157 * @ops: PM operations to choose from.
158 * @state: PM transition of the system being carried out. 158 * @state: PM transition of the system being carried out.
159 */ 159 */
160static int pm_op(struct device *dev, struct dev_pm_ops *ops, 160static int pm_op(struct device *dev,
161 pm_message_t state) 161 const struct dev_pm_ops *ops,
162 pm_message_t state)
162{ 163{
163 int error = 0; 164 int error = 0;
164 165
@@ -220,7 +221,8 @@ static int pm_op(struct device *dev, struct dev_pm_ops *ops,
220 * The operation is executed with interrupts disabled by the only remaining 221 * The operation is executed with interrupts disabled by the only remaining
221 * functional CPU in the system. 222 * functional CPU in the system.
222 */ 223 */
223static int pm_noirq_op(struct device *dev, struct dev_pm_ops *ops, 224static int pm_noirq_op(struct device *dev,
225 const struct dev_pm_ops *ops,
224 pm_message_t state) 226 pm_message_t state)
225{ 227{
226 int error = 0; 228 int error = 0;