public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: platform-driver-x86@vger.kernel.org,
	Corentin Chary <corentin.chary@gmail.com>,
	acpi4asus-user@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com
Subject: Re: [PATCH v3 2/2] asus-laptop: cleanup is_visible
Date: Mon, 26 Jan 2015 19:11:46 -0800	[thread overview]
Message-ID: <20150127031146.GB3585@vmdeb7> (raw)
In-Reply-To: <1422021671-31861-2-git-send-email-vivien.didelot@savoirfairelinux.com>

On Fri, Jan 23, 2015 at 09:01:11AM -0500, Vivien Didelot wrote:
> Get rid of the "normal" label, use one if-statement per attribute for
> maintainability and change s/supported/ret/ and s/asus->handle/handle/
> to fix a coding style issue (lines with 80+ chars).
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
>  drivers/platform/x86/asus-laptop.c | 61 ++++++++++++++------------------------
>  1 file changed, 22 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
> index 46b2746..37a3a1f 100644
> --- a/drivers/platform/x86/asus-laptop.c
> +++ b/drivers/platform/x86/asus-laptop.c
> @@ -1602,55 +1602,38 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct asus_laptop *asus = platform_get_drvdata(pdev);
>  	acpi_handle handle = asus->handle;
> -	bool supported;
> +	bool ret = true;

Very odd to have ret be a bool...

>  
> -	if (asus->is_pega_lucid) {
> -		/* no ls_level interface on the Lucid */
> -		if (attr == &dev_attr_ls_switch.attr)
> -			supported = true;
> -		else if (attr == &dev_attr_ls_level.attr)
> -			supported = false;
> -		else
> -			goto normal;
> -
> -		return supported ? attr->mode : 0;
> -	}
> -
> -normal:
>  	if (attr == &dev_attr_wlan.attr) {
> -		supported = !acpi_check_handle(handle, METHOD_WLAN, NULL);
> -
> +		ret = !acpi_check_handle(handle, METHOD_WLAN, NULL);

acpi_check_handle returns an int, you should be able to just use that.
...

>  	} else if (attr == &dev_attr_ls_value.attr) {
> -		supported = asus->is_pega_lucid;
> +		ret = asus->is_pega_lucid;

This should promote to an int without a problem.
...

-- 
Darren Hart
Intel Open Source Technology Center

  reply	other threads:[~2015-01-27  3:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 14:01 [PATCH v3 1/2] asus-laptop: use DEVICE_ATTR_xx macros Vivien Didelot
2015-01-23 14:01 ` [PATCH v3 2/2] asus-laptop: cleanup is_visible Vivien Didelot
2015-01-27  3:11   ` Darren Hart [this message]
2015-01-27  3:13 ` [PATCH v3 1/2] asus-laptop: use DEVICE_ATTR_xx macros Darren Hart

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=20150127031146.GB3585@vmdeb7 \
    --to=dvhart@infradead.org \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=corentin.chary@gmail.com \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /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