Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-06 Thread Darren Hart
On Thu, Aug 06, 2015 at 10:21:15AM -0600, Azael Avalos wrote:
> Hi Darren,
> 
> 2015-08-05 17:21 GMT-06:00 Darren Hart :
> > On Wed, Aug 05, 2015 at 04:23:49PM -0600, Azael Avalos wrote:
> >> Hi Darren,
> >>
> >> 2015-08-05 14:21 GMT-06:00 Darren Hart :
> >> >> @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
> >> >> toshiba_acpi_dev *dev, u32 state)
> >> >>
> >> >>   result = sci_write(dev, SCI_USB_THREE, state);
> >> >>   sci_close(dev);
> >> >> - if (result == TOS_FAILURE) {
> >> >> + if (result == TOS_FAILURE)
> >> >>   pr_err("ACPI call to set USB 3 failed\n");
> >> >> - return -EIO;
> >> >> - } else if (result == TOS_NOT_SUPPORTED) {
> >> >> + else if (result == TOS_NOT_SUPPORTED)
> >> >>   return -ENODEV;
> >> >> - } else if (result == TOS_INPUT_DATA_ERROR) {
> >> >> - return -EIO;
> >> >> - }
> >> >>
> >> >>   return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;
> >> >
> >> > Hrm... the above line cause patch application failure via git (note the
> >> > missing ? before the '0 : -EIO;'). This never existed upstream so far as
> >> > I can determine.
> >>
> >> I've spotted that while compile-checking my changes locally, but I might
> >> have sent you the wrong patch here, I'll double check in the future to 
> >> avoid
> >> these embarrassments :-(
> >>
> >> >
> >> > It applied with some fuzz manually, but I'm concerned about how this
> >> > happened.  Did you have a dirty tree when you prepared these patches
> >> > perhaps?
> >>
> >> This is weird, all these patches applied cleanly on my local copy, I'll 
> >> fetch
> >> a new copy from your "for-next" tree and check w/ it.
> >
> > Please verify what I have in "testing", if that's right, then we're good. 
> > It has
> > already passed my checks and 0day's.
> 
> I just checked it, and it's good, sorry for all the fuzz :-)

Great, these are all queued to for-next.

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-06 Thread Azael Avalos
Hi Darren,

2015-08-05 17:21 GMT-06:00 Darren Hart :
> On Wed, Aug 05, 2015 at 04:23:49PM -0600, Azael Avalos wrote:
>> Hi Darren,
>>
>> 2015-08-05 14:21 GMT-06:00 Darren Hart :
>> >> @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
>> >> toshiba_acpi_dev *dev, u32 state)
>> >>
>> >>   result = sci_write(dev, SCI_USB_THREE, state);
>> >>   sci_close(dev);
>> >> - if (result == TOS_FAILURE) {
>> >> + if (result == TOS_FAILURE)
>> >>   pr_err("ACPI call to set USB 3 failed\n");
>> >> - return -EIO;
>> >> - } else if (result == TOS_NOT_SUPPORTED) {
>> >> + else if (result == TOS_NOT_SUPPORTED)
>> >>   return -ENODEV;
>> >> - } else if (result == TOS_INPUT_DATA_ERROR) {
>> >> - return -EIO;
>> >> - }
>> >>
>> >>   return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;
>> >
>> > Hrm... the above line cause patch application failure via git (note the
>> > missing ? before the '0 : -EIO;'). This never existed upstream so far as
>> > I can determine.
>>
>> I've spotted that while compile-checking my changes locally, but I might
>> have sent you the wrong patch here, I'll double check in the future to avoid
>> these embarrassments :-(
>>
>> >
>> > It applied with some fuzz manually, but I'm concerned about how this
>> > happened.  Did you have a dirty tree when you prepared these patches
>> > perhaps?
>>
>> This is weird, all these patches applied cleanly on my local copy, I'll fetch
>> a new copy from your "for-next" tree and check w/ it.
>
> Please verify what I have in "testing", if that's right, then we're good. It 
> has
> already passed my checks and 0day's.

I just checked it, and it's good, sorry for all the fuzz :-)

>
> --
> Darren Hart
> Intel Open Source Technology Center

Cheers
Azael


-- 
-- El mundo apesta y vosotros apestais tambien --
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-06 Thread Darren Hart
On Thu, Aug 06, 2015 at 10:21:15AM -0600, Azael Avalos wrote:
 Hi Darren,
 
 2015-08-05 17:21 GMT-06:00 Darren Hart dvh...@infradead.org:
  On Wed, Aug 05, 2015 at 04:23:49PM -0600, Azael Avalos wrote:
  Hi Darren,
 
  2015-08-05 14:21 GMT-06:00 Darren Hart dvh...@infradead.org:
   @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
   toshiba_acpi_dev *dev, u32 state)
  
 result = sci_write(dev, SCI_USB_THREE, state);
 sci_close(dev);
   - if (result == TOS_FAILURE) {
   + if (result == TOS_FAILURE)
 pr_err(ACPI call to set USB 3 failed\n);
   - return -EIO;
   - } else if (result == TOS_NOT_SUPPORTED) {
   + else if (result == TOS_NOT_SUPPORTED)
 return -ENODEV;
   - } else if (result == TOS_INPUT_DATA_ERROR) {
   - return -EIO;
   - }
  
 return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;
  
   Hrm... the above line cause patch application failure via git (note the
   missing ? before the '0 : -EIO;'). This never existed upstream so far as
   I can determine.
 
  I've spotted that while compile-checking my changes locally, but I might
  have sent you the wrong patch here, I'll double check in the future to 
  avoid
  these embarrassments :-(
 
  
   It applied with some fuzz manually, but I'm concerned about how this
   happened.  Did you have a dirty tree when you prepared these patches
   perhaps?
 
  This is weird, all these patches applied cleanly on my local copy, I'll 
  fetch
  a new copy from your for-next tree and check w/ it.
 
  Please verify what I have in testing, if that's right, then we're good. 
  It has
  already passed my checks and 0day's.
 
 I just checked it, and it's good, sorry for all the fuzz :-)

Great, these are all queued to for-next.

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-06 Thread Azael Avalos
Hi Darren,

2015-08-05 17:21 GMT-06:00 Darren Hart dvh...@infradead.org:
 On Wed, Aug 05, 2015 at 04:23:49PM -0600, Azael Avalos wrote:
 Hi Darren,

 2015-08-05 14:21 GMT-06:00 Darren Hart dvh...@infradead.org:
  @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
  toshiba_acpi_dev *dev, u32 state)
 
result = sci_write(dev, SCI_USB_THREE, state);
sci_close(dev);
  - if (result == TOS_FAILURE) {
  + if (result == TOS_FAILURE)
pr_err(ACPI call to set USB 3 failed\n);
  - return -EIO;
  - } else if (result == TOS_NOT_SUPPORTED) {
  + else if (result == TOS_NOT_SUPPORTED)
return -ENODEV;
  - } else if (result == TOS_INPUT_DATA_ERROR) {
  - return -EIO;
  - }
 
return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;
 
  Hrm... the above line cause patch application failure via git (note the
  missing ? before the '0 : -EIO;'). This never existed upstream so far as
  I can determine.

 I've spotted that while compile-checking my changes locally, but I might
 have sent you the wrong patch here, I'll double check in the future to avoid
 these embarrassments :-(

 
  It applied with some fuzz manually, but I'm concerned about how this
  happened.  Did you have a dirty tree when you prepared these patches
  perhaps?

 This is weird, all these patches applied cleanly on my local copy, I'll fetch
 a new copy from your for-next tree and check w/ it.

 Please verify what I have in testing, if that's right, then we're good. It 
 has
 already passed my checks and 0day's.

I just checked it, and it's good, sorry for all the fuzz :-)


 --
 Darren Hart
 Intel Open Source Technology Center

Cheers
Azael


-- 
-- El mundo apesta y vosotros apestais tambien --
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-05 Thread Darren Hart
On Wed, Aug 05, 2015 at 04:23:49PM -0600, Azael Avalos wrote:
> Hi Darren,
> 
> 2015-08-05 14:21 GMT-06:00 Darren Hart :
> >> @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
> >> toshiba_acpi_dev *dev, u32 state)
> >>
> >>   result = sci_write(dev, SCI_USB_THREE, state);
> >>   sci_close(dev);
> >> - if (result == TOS_FAILURE) {
> >> + if (result == TOS_FAILURE)
> >>   pr_err("ACPI call to set USB 3 failed\n");
> >> - return -EIO;
> >> - } else if (result == TOS_NOT_SUPPORTED) {
> >> + else if (result == TOS_NOT_SUPPORTED)
> >>   return -ENODEV;
> >> - } else if (result == TOS_INPUT_DATA_ERROR) {
> >> - return -EIO;
> >> - }
> >>
> >>   return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;
> >
> > Hrm... the above line cause patch application failure via git (note the
> > missing ? before the '0 : -EIO;'). This never existed upstream so far as
> > I can determine.
> 
> I've spotted that while compile-checking my changes locally, but I might
> have sent you the wrong patch here, I'll double check in the future to avoid
> these embarrassments :-(
> 
> >
> > It applied with some fuzz manually, but I'm concerned about how this
> > happened.  Did you have a dirty tree when you prepared these patches
> > perhaps?
> 
> This is weird, all these patches applied cleanly on my local copy, I'll fetch
> a new copy from your "for-next" tree and check w/ it.

Please verify what I have in "testing", if that's right, then we're good. It has
already passed my checks and 0day's.

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-05 Thread Azael Avalos
Hi Darren,

2015-08-05 14:21 GMT-06:00 Darren Hart :
>> @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
>> toshiba_acpi_dev *dev, u32 state)
>>
>>   result = sci_write(dev, SCI_USB_THREE, state);
>>   sci_close(dev);
>> - if (result == TOS_FAILURE) {
>> + if (result == TOS_FAILURE)
>>   pr_err("ACPI call to set USB 3 failed\n");
>> - return -EIO;
>> - } else if (result == TOS_NOT_SUPPORTED) {
>> + else if (result == TOS_NOT_SUPPORTED)
>>   return -ENODEV;
>> - } else if (result == TOS_INPUT_DATA_ERROR) {
>> - return -EIO;
>> - }
>>
>>   return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;
>
> Hrm... the above line cause patch application failure via git (note the
> missing ? before the '0 : -EIO;'). This never existed upstream so far as
> I can determine.

I've spotted that while compile-checking my changes locally, but I might
have sent you the wrong patch here, I'll double check in the future to avoid
these embarrassments :-(

>
> It applied with some fuzz manually, but I'm concerned about how this
> happened.  Did you have a dirty tree when you prepared these patches
> perhaps?

This is weird, all these patches applied cleanly on my local copy, I'll fetch
a new copy from your "for-next" tree and check w/ it.

In the mean time, thanks for your observations, I'll try to keep a closer look
on future patches.

>
> --
> Darren Hart
> Intel Open Source Technology Center


Cheers
Azael

-- 
-- El mundo apesta y vosotros apestais tambien --
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-05 Thread Darren Hart
> @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
> toshiba_acpi_dev *dev, u32 state)
>  
>   result = sci_write(dev, SCI_USB_THREE, state);
>   sci_close(dev);
> - if (result == TOS_FAILURE) {
> + if (result == TOS_FAILURE)
>   pr_err("ACPI call to set USB 3 failed\n");
> - return -EIO;
> - } else if (result == TOS_NOT_SUPPORTED) {
> + else if (result == TOS_NOT_SUPPORTED)
>   return -ENODEV;
> - } else if (result == TOS_INPUT_DATA_ERROR) {
> - return -EIO;
> - }
>  
>   return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;

Hrm... the above line cause patch application failure via git (note the
missing ? before the '0 : -EIO;'). This never existed upstream so far as
I can determine.

It applied with some fuzz manually, but I'm concerned about how this
happened.  Did you have a dirty tree when you prepared these patches
perhaps?

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-05 Thread Darren Hart
 @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
 toshiba_acpi_dev *dev, u32 state)
  
   result = sci_write(dev, SCI_USB_THREE, state);
   sci_close(dev);
 - if (result == TOS_FAILURE) {
 + if (result == TOS_FAILURE)
   pr_err(ACPI call to set USB 3 failed\n);
 - return -EIO;
 - } else if (result == TOS_NOT_SUPPORTED) {
 + else if (result == TOS_NOT_SUPPORTED)
   return -ENODEV;
 - } else if (result == TOS_INPUT_DATA_ERROR) {
 - return -EIO;
 - }
  
   return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;

Hrm... the above line cause patch application failure via git (note the
missing ? before the '0 : -EIO;'). This never existed upstream so far as
I can determine.

It applied with some fuzz manually, but I'm concerned about how this
happened.  Did you have a dirty tree when you prepared these patches
perhaps?

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-05 Thread Darren Hart
On Wed, Aug 05, 2015 at 04:23:49PM -0600, Azael Avalos wrote:
 Hi Darren,
 
 2015-08-05 14:21 GMT-06:00 Darren Hart dvh...@infradead.org:
  @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
  toshiba_acpi_dev *dev, u32 state)
 
result = sci_write(dev, SCI_USB_THREE, state);
sci_close(dev);
  - if (result == TOS_FAILURE) {
  + if (result == TOS_FAILURE)
pr_err(ACPI call to set USB 3 failed\n);
  - return -EIO;
  - } else if (result == TOS_NOT_SUPPORTED) {
  + else if (result == TOS_NOT_SUPPORTED)
return -ENODEV;
  - } else if (result == TOS_INPUT_DATA_ERROR) {
  - return -EIO;
  - }
 
return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;
 
  Hrm... the above line cause patch application failure via git (note the
  missing ? before the '0 : -EIO;'). This never existed upstream so far as
  I can determine.
 
 I've spotted that while compile-checking my changes locally, but I might
 have sent you the wrong patch here, I'll double check in the future to avoid
 these embarrassments :-(
 
 
  It applied with some fuzz manually, but I'm concerned about how this
  happened.  Did you have a dirty tree when you prepared these patches
  perhaps?
 
 This is weird, all these patches applied cleanly on my local copy, I'll fetch
 a new copy from your for-next tree and check w/ it.

Please verify what I have in testing, if that's right, then we're good. It has
already passed my checks and 0day's.

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-08-05 Thread Azael Avalos
Hi Darren,

2015-08-05 14:21 GMT-06:00 Darren Hart dvh...@infradead.org:
 @@ -1131,14 +1055,10 @@ static int toshiba_usb_three_set(struct 
 toshiba_acpi_dev *dev, u32 state)

   result = sci_write(dev, SCI_USB_THREE, state);
   sci_close(dev);
 - if (result == TOS_FAILURE) {
 + if (result == TOS_FAILURE)
   pr_err(ACPI call to set USB 3 failed\n);
 - return -EIO;
 - } else if (result == TOS_NOT_SUPPORTED) {
 + else if (result == TOS_NOT_SUPPORTED)
   return -ENODEV;
 - } else if (result == TOS_INPUT_DATA_ERROR) {
 - return -EIO;
 - }

   return (result == TOS_SUCCESS || result == TOS_SUCCESS2) 0 : -EIO;

 Hrm... the above line cause patch application failure via git (note the
 missing ? before the '0 : -EIO;'). This never existed upstream so far as
 I can determine.

I've spotted that while compile-checking my changes locally, but I might
have sent you the wrong patch here, I'll double check in the future to avoid
these embarrassments :-(


 It applied with some fuzz manually, but I'm concerned about how this
 happened.  Did you have a dirty tree when you prepared these patches
 perhaps?

This is weird, all these patches applied cleanly on my local copy, I'll fetch
a new copy from your for-next tree and check w/ it.

In the mean time, thanks for your observations, I'll try to keep a closer look
on future patches.


 --
 Darren Hart
 Intel Open Source Technology Center


Cheers
Azael

-- 
-- El mundo apesta y vosotros apestais tambien --
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-07-31 Thread Azael Avalos
A previous patch added explicit feature checks for support, *SUCCESS*
and *FAILURE to the HCI/SCI *{get, set} functions.

This patch removes some unnedded checks to the driver HCI/SCI
functions given that the default error return value is now set to
-EIO, there is no need to check for other error values other than
the ones currently checking for.

Signed-off-by: Azael Avalos 
---
 drivers/platform/x86/toshiba_acpi.c | 169 ++--
 1 file changed, 44 insertions(+), 125 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c 
b/drivers/platform/x86/toshiba_acpi.c
index 7b16d8d..4802fd7 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -459,8 +459,6 @@ static void toshiba_illumination_available(struct 
toshiba_acpi_dev *dev)
sci_close(dev);
if (ACPI_FAILURE(status))
pr_err("ACPI call to query Illumination support failed\n");
-   else if (out[0] == TOS_NOT_SUPPORTED)
-   return;
else if (out[0] == TOS_SUCCESS)
dev->illumination_supported = 1;
 }
@@ -481,12 +479,8 @@ static void toshiba_illumination_set(struct led_classdev 
*cdev,
state = brightness ? 1 : 0;
result = sci_write(dev, SCI_ILLUMINATION, state);
sci_close(dev);
-   if (result == TOS_FAILURE) {
+   if (result == TOS_FAILURE)
pr_err("ACPI call for illumination failed\n");
-   return;
-   } else if (result == TOS_NOT_SUPPORTED) {
-   return;
-   }
 }
 
 static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)
@@ -502,7 +496,7 @@ static enum led_brightness toshiba_illumination_get(struct 
led_classdev *cdev)
/* Check the illumination */
result = sci_read(dev, SCI_ILLUMINATION, );
sci_close(dev);
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE) {
pr_err("ACPI call for illumination failed\n");
return LED_OFF;
} else if (result != TOS_SUCCESS) {
@@ -527,10 +521,8 @@ static void toshiba_kbd_illum_available(struct 
toshiba_acpi_dev *dev)
 
status = tci_raw(dev, in, out);
sci_close(dev);
-   if (ACPI_FAILURE(status) || out[0] == TOS_INPUT_DATA_ERROR) {
+   if (ACPI_FAILURE(status)) {
pr_err("ACPI call to query kbd illumination support failed\n");
-   } else if (out[0] == TOS_NOT_SUPPORTED) {
-   return;
} else if (out[0] == TOS_SUCCESS) {
/*
 * Check for keyboard backlight timeout max value,
@@ -560,12 +552,10 @@ static int toshiba_kbd_illum_status_set(struct 
toshiba_acpi_dev *dev, u32 time)
 
result = sci_write(dev, SCI_KBD_ILLUM_STATUS, time);
sci_close(dev);
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE)
pr_err("ACPI call to set KBD backlight status failed\n");
-   return -EIO;
-   } else if (result == TOS_NOT_SUPPORTED) {
+   else if (result == TOS_NOT_SUPPORTED)
return -ENODEV;
-   }
 
return result == TOS_SUCCESS ? 0 : -EIO;
 }
@@ -579,12 +569,10 @@ static int toshiba_kbd_illum_status_get(struct 
toshiba_acpi_dev *dev, u32 *time)
 
result = sci_read(dev, SCI_KBD_ILLUM_STATUS, time);
sci_close(dev);
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE)
pr_err("ACPI call to get KBD backlight status failed\n");
-   return -EIO;
-   } else if (result == TOS_NOT_SUPPORTED) {
+   else if (result == TOS_NOT_SUPPORTED)
return -ENODEV;
-   }
 
return result == TOS_SUCCESS ? 0 : -EIO;
 }
@@ -598,7 +586,7 @@ static enum led_brightness toshiba_kbd_backlight_get(struct 
led_classdev *cdev)
 
/* Check the keyboard backlight state */
result = hci_read(dev, HCI_KBD_ILLUMINATION, );
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE) {
pr_err("ACPI call to get the keyboard backlight failed\n");
return LED_OFF;
} else if (result != TOS_SUCCESS) {
@@ -619,12 +607,8 @@ static void toshiba_kbd_backlight_set(struct led_classdev 
*cdev,
/* Set the keyboard backlight state */
state = brightness ? 1 : 0;
result = hci_write(dev, HCI_KBD_ILLUMINATION, state);
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE)
pr_err("ACPI call to set KBD Illumination mode failed\n");
-   return;
-   } else if (result == TOS_NOT_SUPPORTED) {
-   return;
-   }
 }
 
 /* TouchPad support */
@@ -637,12 +621,10 @@ static int toshiba_touchpad_set(struct toshiba_acpi_dev 
*dev, u32 state)
 
result = sci_write(dev, SCI_TOUCHPAD, 

[PATCH v3 4/5] toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions

2015-07-31 Thread Azael Avalos
A previous patch added explicit feature checks for support, *SUCCESS*
and *FAILURE to the HCI/SCI *{get, set} functions.

This patch removes some unnedded checks to the driver HCI/SCI
functions given that the default error return value is now set to
-EIO, there is no need to check for other error values other than
the ones currently checking for.

Signed-off-by: Azael Avalos coproscef...@gmail.com
---
 drivers/platform/x86/toshiba_acpi.c | 169 ++--
 1 file changed, 44 insertions(+), 125 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c 
b/drivers/platform/x86/toshiba_acpi.c
index 7b16d8d..4802fd7 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -459,8 +459,6 @@ static void toshiba_illumination_available(struct 
toshiba_acpi_dev *dev)
sci_close(dev);
if (ACPI_FAILURE(status))
pr_err(ACPI call to query Illumination support failed\n);
-   else if (out[0] == TOS_NOT_SUPPORTED)
-   return;
else if (out[0] == TOS_SUCCESS)
dev-illumination_supported = 1;
 }
@@ -481,12 +479,8 @@ static void toshiba_illumination_set(struct led_classdev 
*cdev,
state = brightness ? 1 : 0;
result = sci_write(dev, SCI_ILLUMINATION, state);
sci_close(dev);
-   if (result == TOS_FAILURE) {
+   if (result == TOS_FAILURE)
pr_err(ACPI call for illumination failed\n);
-   return;
-   } else if (result == TOS_NOT_SUPPORTED) {
-   return;
-   }
 }
 
 static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)
@@ -502,7 +496,7 @@ static enum led_brightness toshiba_illumination_get(struct 
led_classdev *cdev)
/* Check the illumination */
result = sci_read(dev, SCI_ILLUMINATION, state);
sci_close(dev);
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE) {
pr_err(ACPI call for illumination failed\n);
return LED_OFF;
} else if (result != TOS_SUCCESS) {
@@ -527,10 +521,8 @@ static void toshiba_kbd_illum_available(struct 
toshiba_acpi_dev *dev)
 
status = tci_raw(dev, in, out);
sci_close(dev);
-   if (ACPI_FAILURE(status) || out[0] == TOS_INPUT_DATA_ERROR) {
+   if (ACPI_FAILURE(status)) {
pr_err(ACPI call to query kbd illumination support failed\n);
-   } else if (out[0] == TOS_NOT_SUPPORTED) {
-   return;
} else if (out[0] == TOS_SUCCESS) {
/*
 * Check for keyboard backlight timeout max value,
@@ -560,12 +552,10 @@ static int toshiba_kbd_illum_status_set(struct 
toshiba_acpi_dev *dev, u32 time)
 
result = sci_write(dev, SCI_KBD_ILLUM_STATUS, time);
sci_close(dev);
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE)
pr_err(ACPI call to set KBD backlight status failed\n);
-   return -EIO;
-   } else if (result == TOS_NOT_SUPPORTED) {
+   else if (result == TOS_NOT_SUPPORTED)
return -ENODEV;
-   }
 
return result == TOS_SUCCESS ? 0 : -EIO;
 }
@@ -579,12 +569,10 @@ static int toshiba_kbd_illum_status_get(struct 
toshiba_acpi_dev *dev, u32 *time)
 
result = sci_read(dev, SCI_KBD_ILLUM_STATUS, time);
sci_close(dev);
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE)
pr_err(ACPI call to get KBD backlight status failed\n);
-   return -EIO;
-   } else if (result == TOS_NOT_SUPPORTED) {
+   else if (result == TOS_NOT_SUPPORTED)
return -ENODEV;
-   }
 
return result == TOS_SUCCESS ? 0 : -EIO;
 }
@@ -598,7 +586,7 @@ static enum led_brightness toshiba_kbd_backlight_get(struct 
led_classdev *cdev)
 
/* Check the keyboard backlight state */
result = hci_read(dev, HCI_KBD_ILLUMINATION, state);
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE) {
pr_err(ACPI call to get the keyboard backlight failed\n);
return LED_OFF;
} else if (result != TOS_SUCCESS) {
@@ -619,12 +607,8 @@ static void toshiba_kbd_backlight_set(struct led_classdev 
*cdev,
/* Set the keyboard backlight state */
state = brightness ? 1 : 0;
result = hci_write(dev, HCI_KBD_ILLUMINATION, state);
-   if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) {
+   if (result == TOS_FAILURE)
pr_err(ACPI call to set KBD Illumination mode failed\n);
-   return;
-   } else if (result == TOS_NOT_SUPPORTED) {
-   return;
-   }
 }
 
 /* TouchPad support */
@@ -637,12 +621,10 @@ static int toshiba_touchpad_set(struct toshiba_acpi_dev 
*dev, u32 state)
 
result = sci_write(dev,