Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1679575
| Path | csiph.com!xmission!news.alt.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!newsreader4.netcologne.de!news.netcologne.de!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Christos Gkekas <chris.gekas@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] HID: wacom: Remove comparison of u8 mode with zero and simplify. |
| Date | Mon, 03 Jul 2017 00:40:01 +0200 |
| Message-ID | <tYVH3-be-3@gated-at.bofh.it> (permalink) |
| References | <tYV4l-88R-13@gated-at.bofh.it> <tYVe2-8rT-9@gated-at.bofh.it> |
| X-Original-To | Joe Perches <joe@perches.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KVDQNiMkzGUB1KAqAuBebQE1z176l6F8jh7uR2tUDH4=; b=nEfq+aiAbd+hbFzpE3t5ThMUge5T+ZNybtU42TW5pPpdo6aVXmrbycotGbJyt3Ucle Pssoh1OBLuknpCgll1iZ3jiFX7CMl44VF/vudxtQ7iYfZAYtX1JX63bRsjdZMuaG7J73 67AvsrvmtOb7uoJmvoQGCw8n8QPMZSE05IPsX6LONXWKm+Hd0OO5dUZ6OlFYxWBinGjT RsyCABUPkN7tlb8Kt1tbe5XLARaWza4OKUmq9wT68Ug1sgHHS4pqvc1XU+UMTpYZQSz3 838P1BJkpwfx92llf9fLkaQwnslhlDxh/N6nF6gmNO4mM/mTMioUxJywyszkPMe66V2B niYQ== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KVDQNiMkzGUB1KAqAuBebQE1z176l6F8jh7uR2tUDH4=; b=BBUvmz/3/Sg0oE+x9WtpboeDwl8x7EU7z+dznYfcRha9YNDwL9hsR9XdAOxJTfSh7d zjLnWYcV2AOL1VU8hSjgruuEzuvez0Q5LN0Sj2H8Xz5kj4qwyaDikZFkW/1yNLIXuDxl ecnihxXn836aqhpEC+InC7rGOyzKgvKtL1UVg3RUYMf82eeR8MMhjNIl0PaLyRCCKYuq WkHn8DZ1ZF+c1tSR1iLSY9m0jITXdXeEpwzlCJPj8nuhSc+zt4E35Dvnjkdmn1xr5/Xg TF7t10P12BwgeSiZfJPsGb/hhYqZyGHcttyCqN4/Bz9kUecU8WhHJNnTdU1gCGI9j2o+ oCog== |
| X-Gm-Message-State | AKS2vOxlTXguXTGz2shMOPmoxGM01Db0Ai4sFRMtjGiu9/CQfxUt17Gg CZuRAlNRzdCvtbAdKid6Xw== |
| X-Received | by 10.28.6.77 with SMTP id 74mr11919631wmg.96.1499034778986; Sun, 02 Jul 2017 15:32:58 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Disposition | inline |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 23 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <benjamin.tissoires@redhat.com>, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Sun, 2 Jul 2017 23:32:57 +0100 |
| X-Original-Message-ID | <20170702223257.GA24929@inspiron> |
| X-Original-References | <1499032463-22425-1-git-send-email-chris.gekas@gmail.com> <1499033068.9885.7.camel@perches.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| X-Received-Body-CRC | 3880654703 |
| Xref | csiph.com linux.kernel:1679575 |
Show key headers only | View raw
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.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] HID: wacom: Remove comparison of u8 mode with zero and simplify. Christos Gkekas <chris.gekas@gmail.com> - 2017-07-03 00:00 +0200
Re: [PATCH] HID: wacom: Remove comparison of u8 mode with zero and simplify. Joe Perches <joe@perches.com> - 2017-07-03 00:10 +0200
Re: [PATCH] HID: wacom: Remove comparison of u8 mode with zero and simplify. Christos Gkekas <chris.gekas@gmail.com> - 2017-07-03 00:40 +0200
csiph-web