aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-08-09 18:15:30 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-08-10 19:29:56 -0400
commit23d5855f4774f4f7c246a67057ecacc904696d8a (patch)
tree97aef5b1503b049c8797dc8b503095a14fb0cda4
parent28ba086ed30fb3fb714598aa029b894c3754fa7b (diff)
PM / s2idle: Rename platform operations structure
Rename struct platform_freeze_ops to platform_s2idle_ops to make it clear that the callbacks in it are used during suspend-to-idle suspend/resume transitions and rename the related functions, variables and so on accordingly. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/sleep.c28
-rw-r--r--include/linux/suspend.h6
-rw-r--r--kernel/power/suspend.c30
3 files changed, 32 insertions, 32 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index a0a6fd10fb5f..f7a8abbeac6e 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -737,14 +737,14 @@ static struct acpi_scan_handler lps0_handler = {
737 .attach = lps0_device_attach, 737 .attach = lps0_device_attach,
738}; 738};
739 739
740static int acpi_freeze_begin(void) 740static int acpi_s2idle_begin(void)
741{ 741{
742 acpi_scan_lock_acquire(); 742 acpi_scan_lock_acquire();
743 s2idle_in_progress = true; 743 s2idle_in_progress = true;
744 return 0; 744 return 0;
745} 745}
746 746
747static int acpi_freeze_prepare(void) 747static int acpi_s2idle_prepare(void)
748{ 748{
749 if (lps0_device_handle) { 749 if (lps0_device_handle) {
750 acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF); 750 acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF);
@@ -764,7 +764,7 @@ static int acpi_freeze_prepare(void)
764 return 0; 764 return 0;
765} 765}
766 766
767static void acpi_freeze_wake(void) 767static void acpi_s2idle_wake(void)
768{ 768{
769 /* 769 /*
770 * If IRQD_WAKEUP_ARMED is not set for the SCI at this point, it means 770 * If IRQD_WAKEUP_ARMED is not set for the SCI at this point, it means
@@ -778,7 +778,7 @@ static void acpi_freeze_wake(void)
778 } 778 }
779} 779}
780 780
781static void acpi_freeze_sync(void) 781static void acpi_s2idle_sync(void)
782{ 782{
783 /* 783 /*
784 * Process all pending events in case there are any wakeup ones. 784 * Process all pending events in case there are any wakeup ones.
@@ -791,7 +791,7 @@ static void acpi_freeze_sync(void)
791 s2idle_wakeup = false; 791 s2idle_wakeup = false;
792} 792}
793 793
794static void acpi_freeze_restore(void) 794static void acpi_s2idle_restore(void)
795{ 795{
796 if (acpi_sci_irq_valid()) 796 if (acpi_sci_irq_valid())
797 disable_irq_wake(acpi_sci_irq); 797 disable_irq_wake(acpi_sci_irq);
@@ -804,19 +804,19 @@ static void acpi_freeze_restore(void)
804 } 804 }
805} 805}
806 806
807static void acpi_freeze_end(void) 807static void acpi_s2idle_end(void)
808{ 808{
809 s2idle_in_progress = false; 809 s2idle_in_progress = false;
810 acpi_scan_lock_release(); 810 acpi_scan_lock_release();
811} 811}
812 812
813static const struct platform_freeze_ops acpi_freeze_ops = { 813static const struct platform_s2idle_ops acpi_s2idle_ops = {
814 .begin = acpi_freeze_begin, 814 .begin = acpi_s2idle_begin,
815 .prepare = acpi_freeze_prepare, 815 .prepare = acpi_s2idle_prepare,
816 .wake = acpi_freeze_wake, 816 .wake = acpi_s2idle_wake,
817 .sync = acpi_freeze_sync, 817 .sync = acpi_s2idle_sync,
818 .restore = acpi_freeze_restore, 818 .restore = acpi_s2idle_restore,
819 .end = acpi_freeze_end, 819 .end = acpi_s2idle_end,
820}; 820};
821 821
822static void acpi_sleep_suspend_setup(void) 822static void acpi_sleep_suspend_setup(void)
@@ -831,7 +831,7 @@ static void acpi_sleep_suspend_setup(void)
831 &acpi_suspend_ops_old : &acpi_suspend_ops); 831 &acpi_suspend_ops_old : &acpi_suspend_ops);
832 832
833 acpi_scan_add_handler(&lps0_handler); 833 acpi_scan_add_handler(&lps0_handler);
834 freeze_set_ops(&acpi_freeze_ops); 834 s2idle_set_ops(&acpi_s2idle_ops);
835} 835}
836 836
837#else /* !CONFIG_SUSPEND */ 837#else /* !CONFIG_SUSPEND */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index feb43dfbf7bc..0d41daf7e89d 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -186,7 +186,7 @@ struct platform_suspend_ops {
186 void (*recover)(void); 186 void (*recover)(void);
187}; 187};
188 188
189struct platform_freeze_ops { 189struct platform_s2idle_ops {
190 int (*begin)(void); 190 int (*begin)(void);
191 int (*prepare)(void); 191 int (*prepare)(void);
192 void (*wake)(void); 192 void (*wake)(void);
@@ -251,7 +251,7 @@ static inline bool idle_should_enter_s2idle(void)
251} 251}
252 252
253extern void __init pm_states_init(void); 253extern void __init pm_states_init(void);
254extern void freeze_set_ops(const struct platform_freeze_ops *ops); 254extern void s2idle_set_ops(const struct platform_s2idle_ops *ops);
255extern void s2idle_wake(void); 255extern void s2idle_wake(void);
256 256
257/** 257/**
@@ -286,7 +286,7 @@ static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
286static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } 286static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
287static inline bool idle_should_enter_s2idle(void) { return false; } 287static inline bool idle_should_enter_s2idle(void) { return false; }
288static inline void __init pm_states_init(void) {} 288static inline void __init pm_states_init(void) {}
289static inline void freeze_set_ops(const struct platform_freeze_ops *ops) {} 289static inline void s2idle_set_ops(const struct platform_s2idle_ops *ops) {}
290static inline void s2idle_wake(void) {} 290static inline void s2idle_wake(void) {}
291#endif /* !CONFIG_SUSPEND */ 291#endif /* !CONFIG_SUSPEND */
292 292
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index ae9b579c2533..3e2b4f519009 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -56,16 +56,16 @@ unsigned int pm_suspend_global_flags;
56EXPORT_SYMBOL_GPL(pm_suspend_global_flags); 56EXPORT_SYMBOL_GPL(pm_suspend_global_flags);
57 57
58static const struct platform_suspend_ops *suspend_ops; 58static const struct platform_suspend_ops *suspend_ops;
59static const struct platform_freeze_ops *freeze_ops; 59static const struct platform_s2idle_ops *s2idle_ops;
60static DECLARE_WAIT_QUEUE_HEAD(s2idle_wait_head); 60static DECLARE_WAIT_QUEUE_HEAD(s2idle_wait_head);
61 61
62enum s2idle_states __read_mostly s2idle_state; 62enum s2idle_states __read_mostly s2idle_state;
63static DEFINE_SPINLOCK(s2idle_lock); 63static DEFINE_SPINLOCK(s2idle_lock);
64 64
65void freeze_set_ops(const struct platform_freeze_ops *ops) 65void s2idle_set_ops(const struct platform_s2idle_ops *ops)
66{ 66{
67 lock_system_sleep(); 67 lock_system_sleep();
68 freeze_ops = ops; 68 s2idle_ops = ops;
69 unlock_system_sleep(); 69 unlock_system_sleep();
70} 70}
71 71
@@ -131,13 +131,13 @@ static void s2idle_loop(void)
131 break; 131 break;
132 } 132 }
133 133
134 if (freeze_ops && freeze_ops->wake) 134 if (s2idle_ops && s2idle_ops->wake)
135 freeze_ops->wake(); 135 s2idle_ops->wake();
136 136
137 dpm_noirq_end(); 137 dpm_noirq_end();
138 138
139 if (freeze_ops && freeze_ops->sync) 139 if (s2idle_ops && s2idle_ops->sync)
140 freeze_ops->sync(); 140 s2idle_ops->sync();
141 141
142 if (pm_wakeup_pending()) 142 if (pm_wakeup_pending())
143 break; 143 break;
@@ -250,8 +250,8 @@ static int platform_suspend_prepare(suspend_state_t state)
250 250
251static int platform_suspend_prepare_late(suspend_state_t state) 251static int platform_suspend_prepare_late(suspend_state_t state)
252{ 252{
253 return state == PM_SUSPEND_TO_IDLE && freeze_ops && freeze_ops->prepare ? 253 return state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->prepare ?
254 freeze_ops->prepare() : 0; 254 s2idle_ops->prepare() : 0;
255} 255}
256 256
257static int platform_suspend_prepare_noirq(suspend_state_t state) 257static int platform_suspend_prepare_noirq(suspend_state_t state)
@@ -268,8 +268,8 @@ static void platform_resume_noirq(suspend_state_t state)
268 268
269static void platform_resume_early(suspend_state_t state) 269static void platform_resume_early(suspend_state_t state)
270{ 270{
271 if (state == PM_SUSPEND_TO_IDLE && freeze_ops && freeze_ops->restore) 271 if (state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->restore)
272 freeze_ops->restore(); 272 s2idle_ops->restore();
273} 273}
274 274
275static void platform_resume_finish(suspend_state_t state) 275static void platform_resume_finish(suspend_state_t state)
@@ -280,8 +280,8 @@ static void platform_resume_finish(suspend_state_t state)
280 280
281static int platform_suspend_begin(suspend_state_t state) 281static int platform_suspend_begin(suspend_state_t state)
282{ 282{
283 if (state == PM_SUSPEND_TO_IDLE && freeze_ops && freeze_ops->begin) 283 if (state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->begin)
284 return freeze_ops->begin(); 284 return s2idle_ops->begin();
285 else if (suspend_ops && suspend_ops->begin) 285 else if (suspend_ops && suspend_ops->begin)
286 return suspend_ops->begin(state); 286 return suspend_ops->begin(state);
287 else 287 else
@@ -290,8 +290,8 @@ static int platform_suspend_begin(suspend_state_t state)
290 290
291static void platform_resume_end(suspend_state_t state) 291static void platform_resume_end(suspend_state_t state)
292{ 292{
293 if (state == PM_SUSPEND_TO_IDLE && freeze_ops && freeze_ops->end) 293 if (state == PM_SUSPEND_TO_IDLE && s2idle_ops && s2idle_ops->end)
294 freeze_ops->end(); 294 s2idle_ops->end();
295 else if (suspend_ops && suspend_ops->end) 295 else if (suspend_ops && suspend_ops->end)
296 suspend_ops->end(); 296 suspend_ops->end();
297} 297}