fujitsu-laptop: fix tests of acpi_evaluate_integer() return
Subsystems (3)
PATCH 3/9 fujitsu-laptop: fix tests of acpi_evaluate_integer() return
From: Roel Kluin <[email protected]>
The wrong test was used acpi_status status is unsigned.
---
drivers/platform/x86/fujitsu-laptop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/fujitsu-laptop.c renamed from drivers/platform/x86/fujitsu-laptop.c~fujitsu-laptop-fix-tests-of-acpi_evaluate_integer-return +2 -2
@@ -376,7 +376,7 @@ static int get_lcd_level(void) status =acpi_evaluate_integer (fujitsu->acpi_handle,"GBLL" ,NULL , &state); -if (status <0 ) +if (ACPI_FAILURE (status))return status; fujitsu->brightness_level = state &0x0fffffff ;
@@ -398,7 +398,7 @@ static int get_max_brightness(void) status =acpi_evaluate_integer (fujitsu->acpi_handle,"RBLL" ,NULL , &state); -if (status <0 ) +if (ACPI_FAILURE (status))return status; fujitsu->max_brightness = state;
_
NAK, this patch is incorrect
Quoted 17 lines · On Mon, 21 Dec 2009, [email protected] wrote:
From: Roel Kluin <[email protected]>
The wrong test was used
acpi_statusstatus is unsigned.Signed-off-by Roel Kluin <[email protected]>Acked-by Jonathan Woithe <[email protected]>Cc Len Brown <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/platform/x86/fujitsu-laptop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)diff -puN
drivers/platform/x86/fujitsu-laptop.c~fujitsu-laptop-fix-tests-of-acpi_evaluate_integer-returndrivers/platform/x86/fujitsu-laptop.c
drivers/platform/x86/fujitsu-laptop.c static int get_lcd_level(void) · line 380
Quoted 6 lines
drivers/platform/x86/fujitsu-laptop.c renamed from drivers/platform/x86/fujitsu-laptop.c~fujitsu-laptop-fix-tests-of-acpi_evaluate_integer-return +1
-1@@ -376,7 +376,7 @@ static int get_lcd_level(void) status =acpi_evaluate_integer (fujitsu->acpi_handle,"GBLL" ,NULL , &state); -if (status <0 ) +if (ACPI_FAILURE (status))return status;
backlight_show_actual_brightness() will stuff this return value in sysfs no matter what you return.
I'm sure we don't want to return an acpi_status.
Looks like it should return 0 on failure, like thinkpad does.
drivers/platform/x86/fujitsu-laptop.c static int get_max_brightness(void) · line 402
Quoted 9 lines
drivers/platform/x86/fujitsu-laptop.c renamed from drivers/platform/x86/fujitsu-laptop.c~fujitsu-laptop-fix-tests-of-acpi_evaluate_integer-return +1
-1fujitsu->brightness_level = state &0x0fffffff ;@@ -398,7 +398,7 @@ static int get_max_brightness(void) status =acpi_evaluate_integer (fujitsu->acpi_handle,"RBLL" ,NULL , &state); -if (status <0 ) +if (ACPI_FAILURE (status))return status;
needs to be return -1, since show_max_brightness is testing for < 0.
Quoted 4 lines
drivers/platform/x86/fujitsu-laptop.c renamed from drivers/platform/x86/fujitsu-laptop.c~fujitsu-laptop-fix-tests-of-acpi_evaluate_integer-return +0
-0fujitsu->max_brightness = state;_
Re: [patch 3/9] fujitsu-laptop: fix tests of acpi_evaluate_integer()
Quoted 31 lines
NAK, this patch is incorrect
Quoted 17 lines · On Mon, 21 Dec 2009, [email protected] wrote:
From: Roel Kluin <[email protected]>
The wrong test was used
acpi_statusstatus is unsigned.Signed-off-by Roel Kluin <[email protected]>Acked-by Jonathan Woithe <[email protected]>Cc Len Brown <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/platform/x86/fujitsu-laptop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)diff -puN
drivers/platform/x86/fujitsu-laptop.c~fujitsu-laptop-fix-tests-of-acpi_evaluate_integer-returndrivers/platform/x86/fujitsu-laptop.cdrivers/platform/x86/fujitsu-laptop.c static int get_lcd_level(void) · line 380
Quoted 6 lines
drivers/platform/x86/fujitsu-laptop.c renamed from drivers/platform/x86/fujitsu-laptop.c~fujitsu-laptop-fix-tests-of-acpi_evaluate_integer-return +1
-1@@ -376,7 +376,7 @@ static int get_lcd_level(void) status =acpi_evaluate_integer (fujitsu->acpi_handle,"GBLL" ,NULL , &state); -if (status <0 ) +if (ACPI_FAILURE (status))return status;
backlight_show_actual_brightness()will stuff this return value in sysfs no matter what you return.
Quoted 3 lines
I'm sure we don't want to return an
acpi_status.Looks like it should return 0 on failure, like thinkpad does.
Fair enough. At the time this patch was first proposed there was some confusion as to what the return value should be. We ended up taking a punt and got it wrong.
Quoted 10 lines
drivers/platform/x86/fujitsu-laptop.c static int get_max_brightness(void) · line 402
Quoted 8 lines
drivers/platform/x86/fujitsu-laptop.c renamed from drivers/platform/x86/fujitsu-laptop.c~fujitsu-laptop-fix-tests-of-acpi_evaluate_integer-return +1
-1fujitsu->brightness_level = state &0x0fffffff ;@@ -398,7 +398,7 @@ static int get_max_brightness(void) status =acpi_evaluate_integer (fujitsu->acpi_handle,"RBLL" ,NULL , &state); -if (status <0 ) +if (ACPI_FAILURE (status))return status;needs to be return -1, since
show_max_brightnessis testing for < 0.
Same here.
Thanks for the feedback; I'll do up a revised patch in a sec.
Regards
jonathan