aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/main.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-10-18 06:04:40 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:37:18 -0400
commit26398a70ea35f153feb799fa850c71685667712b (patch)
treee75959ef010bf3521bce2a33e59565c34b0c109d /kernel/power/main.c
parent95d9ffbe01fb21d524c86bf77871255066bc6e55 (diff)
PM: Rename struct pm_ops and related things
The name of 'struct pm_ops' suggests that it is related to the power management in general, but in fact it is only related to suspend.  Moreover, its name should indicate what this structure is used for, so it seems reasonable to change it to 'struct platform_suspend_ops'.  In that case, the name of the global variable of this type used by the PM core and the names of related functions should be changed accordingly. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: Len Brown <lenb@kernel.org> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r--kernel/power/main.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 2a46b6d62f76..854bf0811d40 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -32,28 +32,28 @@ DEFINE_MUTEX(pm_mutex);
32/* This is just an arbitrary number */ 32/* This is just an arbitrary number */
33#define FREE_PAGE_NUMBER (100) 33#define FREE_PAGE_NUMBER (100)
34 34
35struct pm_ops *pm_ops; 35struct platform_suspend_ops *suspend_ops;
36 36
37/** 37/**
38 * pm_set_ops - Set the global power method table. 38 * suspend_set_ops - Set the global suspend method table.
39 * @ops: Pointer to ops structure. 39 * @ops: Pointer to ops structure.
40 */ 40 */
41 41
42void pm_set_ops(struct pm_ops * ops) 42void suspend_set_ops(struct platform_suspend_ops *ops)
43{ 43{
44 mutex_lock(&pm_mutex); 44 mutex_lock(&pm_mutex);
45 pm_ops = ops; 45 suspend_ops = ops;
46 mutex_unlock(&pm_mutex); 46 mutex_unlock(&pm_mutex);
47} 47}
48 48
49/** 49/**
50 * pm_valid_only_mem - generic memory-only valid callback 50 * suspend_valid_only_mem - generic memory-only valid callback
51 * 51 *
52 * pm_ops drivers that implement mem suspend only and only need 52 * Platform drivers that implement mem suspend only and only need
53 * to check for that in their .valid callback can use this instead 53 * to check for that in their .valid callback can use this instead
54 * of rolling their own .valid callback. 54 * of rolling their own .valid callback.
55 */ 55 */
56int pm_valid_only_mem(suspend_state_t state) 56int suspend_valid_only_mem(suspend_state_t state)
57{ 57{
58 return state == PM_SUSPEND_MEM; 58 return state == PM_SUSPEND_MEM;
59} 59}
@@ -61,8 +61,8 @@ int pm_valid_only_mem(suspend_state_t state)
61 61
62static inline void pm_finish(suspend_state_t state) 62static inline void pm_finish(suspend_state_t state)
63{ 63{
64 if (pm_ops->finish) 64 if (suspend_ops->finish)
65 pm_ops->finish(state); 65 suspend_ops->finish(state);
66} 66}
67 67
68/** 68/**
@@ -76,7 +76,7 @@ static int suspend_prepare(void)
76 int error; 76 int error;
77 unsigned int free_pages; 77 unsigned int free_pages;
78 78
79 if (!pm_ops || !pm_ops->enter) 79 if (!suspend_ops || !suspend_ops->enter)
80 return -EPERM; 80 return -EPERM;
81 81
82 error = pm_notifier_call_chain(PM_SUSPEND_PREPARE); 82 error = pm_notifier_call_chain(PM_SUSPEND_PREPARE);
@@ -139,7 +139,7 @@ static int suspend_enter(suspend_state_t state)
139 printk(KERN_ERR "Some devices failed to power down\n"); 139 printk(KERN_ERR "Some devices failed to power down\n");
140 goto Done; 140 goto Done;
141 } 141 }
142 error = pm_ops->enter(state); 142 error = suspend_ops->enter(state);
143 device_power_up(); 143 device_power_up();
144 Done: 144 Done:
145 arch_suspend_enable_irqs(); 145 arch_suspend_enable_irqs();
@@ -156,11 +156,11 @@ int suspend_devices_and_enter(suspend_state_t state)
156{ 156{
157 int error; 157 int error;
158 158
159 if (!pm_ops) 159 if (!suspend_ops)
160 return -ENOSYS; 160 return -ENOSYS;
161 161
162 if (pm_ops->set_target) { 162 if (suspend_ops->set_target) {
163 error = pm_ops->set_target(state); 163 error = suspend_ops->set_target(state);
164 if (error) 164 if (error)
165 return error; 165 return error;
166 } 166 }
@@ -170,8 +170,8 @@ int suspend_devices_and_enter(suspend_state_t state)
170 printk(KERN_ERR "Some devices failed to suspend\n"); 170 printk(KERN_ERR "Some devices failed to suspend\n");
171 goto Resume_console; 171 goto Resume_console;
172 } 172 }
173 if (pm_ops->prepare) { 173 if (suspend_ops->prepare) {
174 error = pm_ops->prepare(state); 174 error = suspend_ops->prepare(state);
175 if (error) 175 if (error)
176 goto Resume_devices; 176 goto Resume_devices;
177 } 177 }
@@ -214,7 +214,7 @@ static inline int valid_state(suspend_state_t state)
214 /* All states need lowlevel support and need to be valid 214 /* All states need lowlevel support and need to be valid
215 * to the lowlevel implementation, no valid callback 215 * to the lowlevel implementation, no valid callback
216 * implies that none are valid. */ 216 * implies that none are valid. */
217 if (!pm_ops || !pm_ops->valid || !pm_ops->valid(state)) 217 if (!suspend_ops || !suspend_ops->valid || !suspend_ops->valid(state))
218 return 0; 218 return 0;
219 return 1; 219 return 1;
220} 220}