linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] toshiba_acpi: Change sci_open function return value
@ 2015-01-14 18:59 Azael Avalos
  2015-01-18 18:28 ` Darren Hart
  0 siblings, 1 reply; 2+ messages in thread
From: Azael Avalos @ 2015-01-14 18:59 UTC (permalink / raw)
  To: Darren Hart, platform-driver-x86, linux-kernel; +Cc: Azael Avalos

Some Toshiba laptops have "poorly implemented" SCI calls on their
BIOSes and are not checking for sci_{open, close} calls, therefore,
the sci_open function is failing and making some of the supported
features unavailable (kbd backlight, touchpad and illumination).

This patch changes the default return code of the sci_open function
to return one instead of zero, making all those faulty laptops load
all the supported features.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
---
 drivers/platform/x86/toshiba_acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index fc34a71..71ac7c12 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -391,9 +391,10 @@ static int sci_open(struct toshiba_acpi_dev *dev)
 		return 1;
 	} else if (out[0] == TOS_NOT_PRESENT) {
 		pr_info("Toshiba SCI is not present\n");
+		return 0;
 	}
 
-	return 0;
+	return 1;
 }
 
 static void sci_close(struct toshiba_acpi_dev *dev)
-- 
2.2.1


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

* Re: [PATCH] toshiba_acpi: Change sci_open function return value
  2015-01-14 18:59 [PATCH] toshiba_acpi: Change sci_open function return value Azael Avalos
@ 2015-01-18 18:28 ` Darren Hart
  0 siblings, 0 replies; 2+ messages in thread
From: Darren Hart @ 2015-01-18 18:28 UTC (permalink / raw)
  To: Azael Avalos; +Cc: platform-driver-x86, linux-kernel

On Wed, Jan 14, 2015 at 11:59:32AM -0700, Azael Avalos wrote:
> Some Toshiba laptops have "poorly implemented" SCI calls on their
> BIOSes and are not checking for sci_{open, close} calls, therefore,
> the sci_open function is failing and making some of the supported
> features unavailable (kbd backlight, touchpad and illumination).
> 
> This patch changes the default return code of the sci_open function
> to return one instead of zero, making all those faulty laptops load
> all the supported features.
> 
> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
> ---
>  drivers/platform/x86/toshiba_acpi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
> index fc34a71..71ac7c12 100644
> --- a/drivers/platform/x86/toshiba_acpi.c
> +++ b/drivers/platform/x86/toshiba_acpi.c
> @@ -391,9 +391,10 @@ static int sci_open(struct toshiba_acpi_dev *dev)
>  		return 1;
>  	} else if (out[0] == TOS_NOT_PRESENT) {
>  		pr_info("Toshiba SCI is not present\n");
> +		return 0;
>  	}
>  
> -	return 0;
> +	return 1;

Which means there is really no point in continuing to check for
TOS_OPEN_SLOSE_OK or TOS_ALREADY_OPEN since we're going to return 1 anyway. The
only thing we care about now is TOS_NOT_PRESENT.

I appreciate coding to what it SHOULD be and then handling corner cases
separately, which is basically what this does. However, corner cases need to be
documented.

At the very least, please provide a comment block above return 1 explaining why
we are ignoring what the previous logic indicates should be a failure.

-- 
Darren Hart
Intel Open Source Technology Center

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

end of thread, other threads:[~2015-01-18 18:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-14 18:59 [PATCH] toshiba_acpi: Change sci_open function return value Azael Avalos
2015-01-18 18:28 ` Darren Hart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).