]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ACPI / sysfs: Treat the count field of counter_show() as unsigned
authorNan Li <nli@suse.com>
Wed, 4 Mar 2015 10:48:35 +0000 (18:48 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 10 Mar 2015 00:03:30 +0000 (01:03 +0100)
The count field is an unsigned 32bit value, and the
counter_show() function should also treat it as a unsigned
value.

Otherwise the counter may show negative number as we found on a
machine:
...
gpe23:        0   invalid
gpe24: -2071733   enabled
gpe25:        0   invalid
...
gpe_all: -2070980
sci: -2070949

Signed-off-by: Nan Li <nli@suse.com>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/sysfs.c

index 13e577c80201bb1ce4341f9b99007e28d1a0a261..0876d77b320627507c945c9591026f6c0db60dcc 100644 (file)
@@ -527,7 +527,7 @@ static ssize_t counter_show(struct kobject *kobj,
            acpi_irq_not_handled;
        all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count =
            acpi_gpe_count;
-       size = sprintf(buf, "%8d", all_counters[index].count);
+       size = sprintf(buf, "%8u", all_counters[index].count);
 
        /* "gpe_all" or "sci" */
        if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)