acpi: The count field of counter_show() function should be an unsigned value
PATCH 1/1 acpi: The count field of counter_show() function should be an unsigned value
From: Nan Li <[email protected]>
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
Cc "Rafael J. Wysocki" <[email protected]>
Cc Len Brown <[email protected]>
Cc Thomas Renninger <[email protected]>
Signed-off-by Nan Li <[email protected]>
Signed-off-by Lee, Chun-Yi <[email protected]>
--- drivers/acpi/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/sysfs.c +1 -1
@@ -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 )
Signature · 1 line
1.8.4.5
Rafael J. Wysocki
AppliedQuoted 16 lines · Chun-Yi
From: Nan Li <[email protected]>
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
Quoted 5 lines
Cc "Rafael J. Wysocki" <[email protected]>Cc Len Brown <[email protected]>Cc Thomas Renninger <[email protected]>Signed-off-by Nan Li <[email protected]>Signed-off-by Lee, Chun-Yi <[email protected]>
Queued up for 4.1, thanks!
Quoted 18 lines
--- drivers/acpi/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/acpi/sysfs.c +1
-1@@ -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 )
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.