Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291856
b: refs/heads/master
c: bc25cf5
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed Feb 17, 2012
1 parent bdd7a01 commit d78ef51
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 93e1ee43a72b11e1b50aab87046c131a836a4456
refs/heads/master: bc25cf508942c56810d4fb623ef27b56ccef7783
16 changes: 0 additions & 16 deletions trunk/include/linux/suspend.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,6 @@ static inline void dpm_save_failed_step(enum suspend_stat_step step)
suspend_stats.last_failed_step %= REC_FAILED_NUM;
}

/**
* suspend_stats_update - Update success/failure statistics of suspend-to-ram
*
* @error: Value returned by enter_state() function
*/
static inline void suspend_stats_update(int error)
{
if (error) {
suspend_stats.fail++;
dpm_save_failed_errno(error);
} else {
suspend_stats.success++;
}
}


/**
* struct platform_suspend_ops - Callbacks for managing platform dependent
* system sleep states.
Expand Down
18 changes: 12 additions & 6 deletions trunk/kernel/power/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,18 @@ static int enter_state(suspend_state_t state)
*/
int pm_suspend(suspend_state_t state)
{
int ret;
if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX) {
ret = enter_state(state);
suspend_stats_update(ret);
return ret;
int error;

if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
return -EINVAL;

error = enter_state(state);
if (error) {
suspend_stats.fail++;
dpm_save_failed_errno(error);
} else {
suspend_stats.success++;
}
return -EINVAL;
return error;
}
EXPORT_SYMBOL(pm_suspend);

0 comments on commit d78ef51

Please sign in to comment.