Skip to content

Commit 2231f78

Browse files
committed
PM: sleep: stats: Use unsigned int for success and failure counters
Change the type of the "success" and "fail" fields in struct suspend_stats to unsigned int, because they cannot be negative. No intentional functional impact. 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>
1 parent b730bab commit 2231f78

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

include/linux/suspend.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ enum suspend_stat_step {
5656

5757
struct suspend_stats {
5858
unsigned int step_failures[SUSPEND_NR_STEPS];
59-
int success;
60-
int fail;
59+
unsigned int success;
60+
unsigned int fail;
6161
#define REC_FAILED_NUM 2
6262
int last_failed_dev;
6363
char failed_devs[REC_FAILED_NUM][40];

kernel/power/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ static ssize_t _name##_show(struct kobject *kobj, \
339339
} \
340340
static struct kobj_attribute _name = __ATTR_RO(_name)
341341

342-
suspend_attr(success, "%d\n");
343-
suspend_attr(fail, "%d\n");
342+
suspend_attr(success, "%u\n");
343+
suspend_attr(fail, "%u\n");
344344
suspend_attr(last_hw_sleep, "%llu\n");
345345
suspend_attr(total_hw_sleep, "%llu\n");
346346
suspend_attr(max_hw_sleep, "%llu\n");
@@ -458,7 +458,7 @@ static int suspend_stats_show(struct seq_file *s, void *unused)
458458
last_step = suspend_stats.last_failed_step + REC_FAILED_NUM - 1;
459459
last_step %= REC_FAILED_NUM;
460460

461-
seq_printf(s, "success: %d\nfail: %d\n",
461+
seq_printf(s, "success: %u\nfail: %u\n",
462462
suspend_stats.success, suspend_stats.fail);
463463

464464
for (step = SUSPEND_FREEZE; step <= SUSPEND_NR_STEPS; step++)

0 commit comments

Comments
 (0)