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 456594bd97bc..d28c289e4a3f 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -625,30 +625,6 @@ static int platform_legacy_suspend(struct device *dev, pm_message_t mesg)
625 return ret; 625 return ret;
626} 626}
627 627
628static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg)
629{
630 struct platform_driver *pdrv = to_platform_driver(dev->driver);
631 struct platform_device *pdev = to_platform_device(dev);
632 int ret = 0;
633
634 if (dev->driver && pdrv->suspend_late)
635 ret = pdrv->suspend_late(pdev, mesg);
636
637 return ret;
638}
639
640static int platform_legacy_resume_early(struct device *dev)
641{
642 struct platform_driver *pdrv = to_platform_driver(dev->driver);
643 struct platform_device *pdev = to_platform_device(dev);
644 int ret = 0;
645
646 if (dev->driver && pdrv->resume_early)
647 ret = pdrv->resume_early(pdev);
648
649 return ret;
650}
651
652static int platform_legacy_resume(struct device *dev) 628static int platform_legacy_resume(struct device *dev)
653{ 629{
654 struct platform_driver *pdrv = to_platform_driver(dev->driver); 630 struct platform_driver *pdrv = to_platform_driver(dev->driver);
@@ -711,8 +687,6 @@ static int platform_pm_suspend_noirq(struct device *dev)
711 if (drv->pm) { 687 if (drv->pm) {
712 if (drv->pm->suspend_noirq) 688 if (drv->pm->suspend_noirq)
713 ret = drv->pm->suspend_noirq(dev); 689 ret = drv->pm->suspend_noirq(dev);
714 } else {
715 ret = platform_legacy_suspend_late(dev, PMSG_SUSPEND);
716 } 690 }
717 691
718 return ret; 692 return ret;
@@ -747,8 +721,6 @@ static int platform_pm_resume_noirq(struct device *dev)
747 if (drv->pm) { 721 if (drv->pm) {
748 if (drv->pm->resume_noirq) 722 if (drv->pm->resume_noirq)
749 ret = drv->pm->resume_noirq(dev); 723 ret = drv->pm->resume_noirq(dev);
750 } else {
751 ret = platform_legacy_resume_early(dev);
752 } 724 }
753 725
754 return ret; 726 return ret;
@@ -794,8 +766,6 @@ static int platform_pm_freeze_noirq(struct device *dev)
794 if (drv->pm) { 766 if (drv->pm) {
795 if (drv->pm->freeze_noirq) 767 if (drv->pm->freeze_noirq)
796 ret = drv->pm->freeze_noirq(dev); 768 ret = drv->pm->freeze_noirq(dev);
797 } else {
798 ret = platform_legacy_suspend_late(dev, PMSG_FREEZE);
799 } 769 }
800 770
801 return ret; 771 return ret;
@@ -830,8 +800,6 @@ static int platform_pm_thaw_noirq(struct device *dev)
830 if (drv->pm) { 800 if (drv->pm) {
831 if (drv->pm->thaw_noirq) 801 if (drv->pm->thaw_noirq)
832 ret = drv->pm->thaw_noirq(dev); 802 ret = drv->pm->thaw_noirq(dev);
833 } else {
834 ret = platform_legacy_resume_early(dev);
835 } 803 }
836 804
837 return ret; 805 return ret;
@@ -866,8 +834,6 @@ static int platform_pm_poweroff_noirq(struct device *dev)
866 if (drv->pm) { 834 if (drv->pm) {
867 if (drv->pm->poweroff_noirq) 835 if (drv->pm->poweroff_noirq)
868 ret = drv->pm->poweroff_noirq(dev); 836 ret = drv->pm->poweroff_noirq(dev);
869 } else {
870 ret = platform_legacy_suspend_late(dev, PMSG_HIBERNATE);
871 } 837 }
872 838
873 return ret; 839 return ret;
@@ -902,8 +868,6 @@ static int platform_pm_restore_noirq(struct device *dev)
902 if (drv->pm) { 868 if (drv->pm) {
903 if (drv->pm->restore_noirq) 869 if (drv->pm->restore_noirq)
904 ret = drv->pm->restore_noirq(dev); 870 ret = drv->pm->restore_noirq(dev);
905 } else {
906 ret = platform_legacy_resume_early(dev);
907 } 871 }
908 872
909 return ret; 873 return ret;
@@ -922,7 +886,7 @@ static int platform_pm_restore_noirq(struct device *dev)
922 886
923#endif /* !CONFIG_HIBERNATION */ 887#endif /* !CONFIG_HIBERNATION */
924 888
925static struct dev_pm_ops platform_dev_pm_ops = { 889static const struct dev_pm_ops platform_dev_pm_ops = {
926 .prepare = platform_pm_prepare, 890 .prepare = platform_pm_prepare,
927 .complete = platform_pm_complete, 891 .complete = platform_pm_complete,
928 .suspend = platform_pm_suspend, 892 .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;