public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: Azael Avalos <coproscefalo@gmail.com>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] toshiba_acpi: Adapt kbd_bl_timeout_store to the new kbd type
Date: Mon, 6 Oct 2014 17:44:35 -0700	[thread overview]
Message-ID: <20141007004434.GA26764@vmdeb7> (raw)
In-Reply-To: <1412445741-7719-1-git-send-email-coproscefalo@gmail.com>

Hi Azael,

On Sat, Oct 04, 2014 at 12:02:21PM -0600, Azael Avalos wrote:
> With the introduccion of the new keyboard backlight

introduction

> implementation, the *_timeout_store function is
> broken, as it only supports the first kbd_type.
> 
> This patch adapt such function for the new kbd_type,

adapts

> as well as convert from using sscanf to kstrtoint.

converts

>

Functional changes look good to me, thank you.

I've made a couple minor formatting corrections in the interest of time. In
the future, please check your patches with checkpatch.pl and consider using a
spell checker in your $EDITOR for commit messages. Using git am to apply your
own patches would also have caught the whitespace error.

> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>

Queued to testing, I'll push to for-next tomorrow(ish), which should give us
enough time to make 3.18 since Linus pushed out the merge window a bit.

> ---
> Changes since v1:
> - Check for timeout values depending on kbd_type
> - Removed some misleading comments
> 
> Note: I'll be out of town until the next weekend,
> in case something else needs to be changed, I'll
> catch up whenever I'm back.
> 
>  drivers/platform/x86/toshiba_acpi.c | 38 ++++++++++++++++++++++++++++---------
>  1 file changed, 29 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
> index 5d509ea..f360dac 100644
> --- a/drivers/platform/x86/toshiba_acpi.c
> +++ b/drivers/platform/x86/toshiba_acpi.c
> @@ -1453,18 +1453,38 @@ static ssize_t toshiba_kbd_bl_timeout_store(struct device *dev,
>  					    const char *buf, size_t count)
>  {
>  	struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
> -	int time = -1;
> +	int time;
> +	int ret;
>  
> -	if (sscanf(buf, "%i", &time) != 1 && (time < 0 || time > 60))
> -		return -EINVAL;
> +	ret = kstrtoint(buf, 0, &time);
> +	if (ret)
> +		return ret;
>  
> -	/* Set the Keyboard Backlight Timeout: 0-60 seconds */
> -	if (time != -1 && toshiba->kbd_time != time) {
> +	/* Check for supported values depending on kbd_type */
> +	if (toshiba->kbd_type == 1) {
> +		if (time < 0 || time > 60)
> +			return -EINVAL;
> +	} else if (toshiba->kbd_type == 2) {
> +		if (time < 1 || time > 60)
> +			return -EINVAL;
> +	}
> +
> +	/* Set the Keyboard Backlight Timeout */
> +	

 ^ Tab at beginning of otherwise empty line.

Thanks,

Darren

> +	/* Only make a change if the actual timeout has changed */
> +	if (toshiba->kbd_time != time) {
> +		/* Shift the time to "base time" (0x3c0000 == 60 seconds) */
>  		time = time << HCI_MISC_SHIFT;
> -		time = (toshiba->kbd_mode == SCI_KBD_MODE_AUTO) ?
> -							time + 1 : time + 2;
> -		if (toshiba_kbd_illum_status_set(toshiba, time) < 0)
> -			return -EIO;
> +		/* OR the "base time" to the actual method format */
> +		if (toshiba->kbd_type == 1)
> +			time |= SCI_KBD_MODE_FNZ;
> +		else if (toshiba->kbd_type == 2)
> +			time |= SCI_KBD_MODE_AUTO;
> +
> +		ret = toshiba_kbd_illum_status_set(toshiba, time);
> +		if (ret)
> +			return ret;
> +
>  		toshiba->kbd_time = time >> HCI_MISC_SHIFT;
>  	}
>  
> -- 
> 2.0.0
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center

      reply	other threads:[~2014-10-07  0:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-04 18:02 [PATCH v2] toshiba_acpi: Adapt kbd_bl_timeout_store to the new kbd type Azael Avalos
2014-10-07  0:44 ` Darren Hart [this message]

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=20141007004434.GA26764@vmdeb7 \
    --to=dvhart@infradead.org \
    --cc=coproscefalo@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox