All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: Azael Avalos <coproscefalo@gmail.com>,
	rjw@rjwysocki.net, linux-acpi@vger.kernel.org
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, Nuno Lopes <nunoplopes@sapo.pt>
Subject: Re: [PATCH] toshiba_acpi: Fix regression caused by backlight extra check code
Date: Mon, 3 Nov 2014 22:21:37 -0800	[thread overview]
Message-ID: <20141104062137.GC56751@vmdeb7> (raw)
In-Reply-To: <1415073514-12555-1-git-send-email-coproscefalo@gmail.com>

On Mon, Nov 03, 2014 at 08:58:34PM -0700, Azael Avalos wrote:
> Bug 86521 uncovered that some TOS6208 devices also return
> non zero values on a write call to the backlight method,
> thus getting caught and bailed out by the extra check code.
> 
> This patch makes sure that the extra check is being done
> on a TOS1900 device and then make the check for the broken
> backlight code.
> 
> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
> ---
>  drivers/platform/x86/toshiba_acpi.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
> index ef3a190..e3fed12 100644
> --- a/drivers/platform/x86/toshiba_acpi.c
> +++ b/drivers/platform/x86/toshiba_acpi.c
> @@ -944,9 +944,13 @@ static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value)
>  	/* Extra check for "incomplete" backlight method, where the AML code
>  	 * doesn't check for HCI_SET or HCI_GET and returns TOS_SUCCESS,
>  	 * the actual brightness, and in some cases the max brightness.
> +	 * Use the SPFC method as an indicator that we're on a TOS1900 device,
> +	 * otherwise some TOS6208 devices might get bailed out, see bug 86521

This needs a clearer description here in this comment, rather than redirecting
the reader to a bug report (which may or may not exist when needed).

>  	 */
> -	if (out[2] > 0  || out[3] == 0xE000)
> -		return -ENODEV;
> +	if (acpi_has_method(dev->acpi_dev->handle, "SPFC")) {

Hrm, this checking for the existence of a specific method seems suspect to me.
We would know if we are on a TOS1900 as we matches the acpi id already. Is the
SPFC significant here, or is it just a "we only see SPFC on TOS1900 so it's a
convenient test"? If the latter, it seems rather fragile and prone to other
breakage to me.

Rafael, any recommendations here?

> +		if (out[2] > 0  || out[3] == 0xE000)
> +			return -ENODEV;
> +	}
>  
>  	return out[0] == TOS_SUCCESS ? 0 : -EIO;
>  }
> -- 
> 2.1.1
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center

  reply	other threads:[~2014-11-04  6:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04  3:58 [PATCH] toshiba_acpi: Fix regression caused by backlight extra check code Azael Avalos
2014-11-04  6:21 ` Darren Hart [this message]
2014-11-10 16:58   ` Azael Avalos
2014-11-11  5:49     ` Darren Hart
2014-11-11 16:01       ` Azael Avalos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141104062137.GC56751@vmdeb7 \
    --to=dvhart@infradead.org \
    --cc=coproscefalo@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nunoplopes@sapo.pt \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.