PM / Sleep: Make enter_state() in kernel/power/suspend.c static
The enter_state() function in kernel/power/suspend.c should be static and state_store() in kernel/power/suspend.c should call pm_suspend() instead of it, so make that happen (which also reduces code duplication related to suspend statistics). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
This commit is contained in:
parent
55ae451918
commit
93e1ee43a7
|
@ -291,12 +291,10 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
|
||||||
|
|
||||||
#ifdef CONFIG_SUSPEND
|
#ifdef CONFIG_SUSPEND
|
||||||
for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
|
for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
|
||||||
if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
|
if (*s && len == strlen(*s) && !strncmp(buf, *s, len)) {
|
||||||
|
error = pm_suspend(state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (state < PM_SUSPEND_MAX && *s) {
|
|
||||||
error = enter_state(state);
|
|
||||||
suspend_stats_update(error);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -177,13 +177,11 @@ extern const char *const pm_states[];
|
||||||
|
|
||||||
extern bool valid_state(suspend_state_t state);
|
extern bool valid_state(suspend_state_t state);
|
||||||
extern int suspend_devices_and_enter(suspend_state_t state);
|
extern int suspend_devices_and_enter(suspend_state_t state);
|
||||||
extern int enter_state(suspend_state_t state);
|
|
||||||
#else /* !CONFIG_SUSPEND */
|
#else /* !CONFIG_SUSPEND */
|
||||||
static inline int suspend_devices_and_enter(suspend_state_t state)
|
static inline int suspend_devices_and_enter(suspend_state_t state)
|
||||||
{
|
{
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
static inline int enter_state(suspend_state_t state) { return -ENOSYS; }
|
|
||||||
static inline bool valid_state(suspend_state_t state) { return false; }
|
static inline bool valid_state(suspend_state_t state) { return false; }
|
||||||
#endif /* !CONFIG_SUSPEND */
|
#endif /* !CONFIG_SUSPEND */
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,7 @@ static void suspend_finish(void)
|
||||||
* Fail if that's not the case. Otherwise, prepare for system suspend, make the
|
* Fail if that's not the case. Otherwise, prepare for system suspend, make the
|
||||||
* system enter the given sleep state and clean up after wakeup.
|
* system enter the given sleep state and clean up after wakeup.
|
||||||
*/
|
*/
|
||||||
int enter_state(suspend_state_t state)
|
static int enter_state(suspend_state_t state)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue