summaryrefslogtreecommitdiff
path: root/include/linux/suspend.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-01-29 17:11:57 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-02-05 14:25:56 +0100
commitb730bab0b9c4204d7dda3f5bc8adf4292497fc39 (patch)
tree369f2c1cfe5641f6bd250d45cdcc7662202bd17b /include/linux/suspend.h
parentbc88528cda2eddc3e5ea304fc3f147f1b4186aa4 (diff)
PM: sleep: stats: Use an array of step failure counters
Instead of using a set of individual struct suspend_stats fields representing suspend step failure counters, use an array of counters indexed by enum suspend_stat_step for this purpose, which allows dpm_save_failed_step() to increment the appropriate counter automatically, so that its callers don't need to do that directly. It also allows suspend_stats_show() to carry out a loop over the counters array to print their values. Because the counters cannot become negative, use unsigned int for representing them. The only user-observable impact of this change is a different ordering of entries in the suspend_stats debugfs file which is not expected to matter. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'include/linux/suspend.h')
-rw-r--r--include/linux/suspend.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 58f7352af205..5e4c4d4aed95 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -52,17 +52,12 @@ enum suspend_stat_step {
SUSPEND_RESUME
};
+#define SUSPEND_NR_STEPS SUSPEND_RESUME
+
struct suspend_stats {
+ unsigned int step_failures[SUSPEND_NR_STEPS];
int success;
int fail;
- int failed_freeze;
- int failed_prepare;
- int failed_suspend;
- int failed_suspend_late;
- int failed_suspend_noirq;
- int failed_resume;
- int failed_resume_early;
- int failed_resume_noirq;
#define REC_FAILED_NUM 2
int last_failed_dev;
char failed_devs[REC_FAILED_NUM][40];
@@ -95,6 +90,7 @@ static inline void dpm_save_failed_errno(int err)
static inline void dpm_save_failed_step(enum suspend_stat_step step)
{
+ suspend_stats.step_failures[step-1]++;
suspend_stats.failed_steps[suspend_stats.last_failed_step] = step;
suspend_stats.last_failed_step++;
suspend_stats.last_failed_step %= REC_FAILED_NUM;