From: Christos Gkekas <chris.gekas@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: wacom: Remove comparison of u8 mode with zero and simplify.
Date: Sun, 2 Jul 2017 23:32:57 +0100 [thread overview]
Message-ID: <20170702223257.GA24929@inspiron> (raw)
In-Reply-To: <1499033068.9885.7.camel@perches.com>
On 02/07/17 15:04:28 -0700, Joe Perches wrote:
> On Sun, 2017-07-02 at 22:54 +0100, 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.
> []
> > diff --git 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 snprintf(buf, PAGE_SIZE, "%d\n", mode < 3 ? mode : -1);
>
> It's also hard to imagine that PAGE_SIZE could be less than 4 bytes so
> return sprintf(buf, "%d\n", mode < 3 ? mode : -1);
> could work too.
>
Thanks for the suggestion, makes sense. I will resend the patch.
next prev parent reply other threads:[~2017-07-02 22:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-02 21:54 [PATCH] HID: wacom: Remove comparison of u8 mode with zero and simplify Christos Gkekas
2017-07-02 22:04 ` Joe Perches
2017-07-02 22:32 ` Christos Gkekas [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-07-02 22:46 Christos Gkekas
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=20170702223257.GA24929@inspiron \
--to=chris.gekas@gmail.com \
--cc=benjamin.tissoires@redhat.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 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.