All of lore.kernel.org
 help / color / mirror / Atom feed
From: Salah Triki <salah.triki@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Salah Triki <salah.triki@gmail.com>,
	Johan Hovold <johan@kernel.org>, Lee Jones <lee.jones@linaro.org>,
	gregkh@linuxfoundation.org
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] input: touchscreen: replace conditional statement with max()
Date: Tue, 3 Aug 2021 01:38:57 +0100	[thread overview]
Message-ID: <20210803003857.GA1560352@pc> (raw)

Replace conditional statement with max() in order to make code cleaner.
Issue found by coccinelle.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/input/touchscreen/usbtouchscreen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 43c521f50c85..69f36d4f6cea 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -269,7 +269,7 @@ static int e2i_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 
 	tmp = tmp - 0xA000;
 	dev->touch = (tmp > 0);
-	dev->press = (tmp > 0 ? tmp : 0);
+	dev->press = max(tmp, 0);
 
 	return 1;
 }
-- 
2.25.1


             reply	other threads:[~2021-08-03  0:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03  0:38 Salah Triki [this message]
2021-08-04  9:45 ` [PATCH] input: touchscreen: replace conditional statement with max() Johan Hovold

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=20210803003857.GA1560352@pc \
    --to=salah.triki@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=lee.jones@linaro.org \
    --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.