All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi: The count field of counter_show() function should be an unsigned value
@ 2015-03-04 10:48 Lee, Chun-Yi
  2015-03-12 22:41 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Lee, Chun-Yi @ 2015-03-04 10:48 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-acpi, linux-kernel, Lee, Chun-Yi, Len Brown,
	Thomas Renninger, Nan Li

From: Nan Li <nli@suse.com>

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" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Thomas Renninger <trenn@suse.de>
Signed-off-by: Nan Li <nli@suse.com>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
 drivers/acpi/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 13e577c..0876d77 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -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)
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] acpi: The count field of counter_show() function should be an unsigned value
  2015-03-04 10:48 [PATCH] acpi: The count field of counter_show() function should be an unsigned value Lee, Chun-Yi
@ 2015-03-12 22:41 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2015-03-12 22:41 UTC (permalink / raw)
  To: Lee, Chun-Yi
  Cc: linux-acpi, linux-kernel, Lee, Chun-Yi, Len Brown,
	Thomas Renninger, Nan Li

On Wednesday, March 04, 2015 06:48:35 PM Lee, Chun-Yi wrote:
> From: Nan Li <nli@suse.com>
> 
> 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" <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Thomas Renninger <trenn@suse.de>
> Signed-off-by: Nan Li <nli@suse.com>
> Signed-off-by: Lee, Chun-Yi <jlee@suse.com>

Queued up for 4.1, thanks!

> ---
>  drivers/acpi/sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
> index 13e577c..0876d77 100644
> --- a/drivers/acpi/sysfs.c
> +++ b/drivers/acpi/sysfs.c
> @@ -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)
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-12 22:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 10:48 [PATCH] acpi: The count field of counter_show() function should be an unsigned value Lee, Chun-Yi
2015-03-12 22:41 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.