From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Christos Gkekas <chris.gekas@gmail.com>
Cc: Joe Perches <joe@perches.com>, Jiri Kosina <jikos@kernel.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] HID: wacom: Remove comparison of u8 mode with zero and simplify.
Date: Wed, 12 Jul 2017 09:39:17 +0200 [thread overview]
Message-ID: <20170712073917.GE22282@mail.corp.redhat.com> (raw)
In-Reply-To: <1499541948-3392-1-git-send-email-chris.gekas@gmail.com>
On Jul 08 2017 or thereabouts, Christos Gkekas wrote:
> Variable mode in method wacom_show_remote_mode() is defined as u8, thus
> statement (mode >= 0) is always true and should be removed, simplifying
> the logic.
>
> Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
> ---
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> drivers/hid/wacom_sys.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 838c1eb..ae2408d 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -1671,10 +1671,7 @@ static ssize_t wacom_show_remote_mode(struct kobject *kobj,
> u8 mode;
>
> mode = wacom->led.groups[index].select;
> - if (mode >= 0 && mode < 3)
> - return snprintf(buf, PAGE_SIZE, "%d\n", mode);
> - else
> - return snprintf(buf, PAGE_SIZE, "%d\n", -1);
> + return sprintf(buf, "%d\n", mode < 3 ? mode : -1);
> }
>
> #define DEVICE_EKR_ATTR_GROUP(SET_ID) \
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-07-12 7:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-08 19:25 [PATCH RESEND] HID: wacom: Remove comparison of u8 mode with zero and simplify Christos Gkekas
2017-07-12 7:39 ` Benjamin Tissoires [this message]
2017-07-20 13:43 ` Jiri Kosina
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=20170712073917.GE22282@mail.corp.redhat.com \
--to=benjamin.tissoires@redhat.com \
--cc=chris.gekas@gmail.com \
--cc=jikos@kernel.org \
--cc=joe@perches.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).