Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp3135104pxy; Wed, 4 Aug 2021 03:16:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWw/EZVIR5sXE3IjqwOKLsSPsF3Xu+UnVyVSAui8aXzHpEWOp8vkAwAnbVWRdarxk0mXtO X-Received: by 2002:a17:907:98b9:: with SMTP id ju25mr18980818ejc.290.1628072174630; Wed, 04 Aug 2021 03:16:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628072174; cv=none; d=google.com; s=arc-20160816; b=b+a4UVepD7JTlsAjsCzLSiG95TPSYPTvZw84e76LWZP//iWvy18J0pXHivPUYZ/4SQ iycoKecMsTY8XN+isTv9gnLTQzFi3dMCHLyGVPfOFPQixz3Pn9qzG8SVk8Y9SpaU0qS8 i7TrigQ4bfSgc1XjNUu/EKLPPUykrR2SPuwjmQeATxF65hK40Yp3rFDM+YNHAUa+IDA4 blwG46zgNoOSzrrbfuCK1VLEU+4bksepaiogqXKmrogkPMvSXedpY/YU3Bg/Isyr0WCp 3Z/4sBpqsYJzDp8ohnDIhikJm0LoECHd0giJ+bJ1PsLBaiTk7otIhFz81FroBFQLxU1k FABw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lSM5Fl/9jBoF9MQc0fXFxb/Vc4ig6mH04pzxLSmfIQ8=; b=PeoZaZkr2PnAb+7R7wNGAeJq/y0ieJltIXWd9Em852QMRFlGsjoWN2FuiP5gDmXoVa wGjs7rjR+ufm5mG68DQ1GkE5TeUOLTHCsW9/os91JVysHvGUA+mpzX0tKoXVituDa6mc QuUSaR7ccgH/0VHLv+6GNLoWtoOz6xB9pOOa3t8NcdcHAcWKME/HDln68GYjGNGss8lg XrFq7eQbYBwy1nxql1mIJQN9orGOwcKLYYwEpYEmeIv6Gnellbtki0+/hWzZLkiy3fjD HKYS6/+OplSRAl72LXC3A0+Db7h8QiyXo7C2+2OYgcdIlbEa2k5JCAVpE00YFenBk9sy Ox9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EK0cf9uy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g14si1831284edu.31.2021.08.04.03.15.50; Wed, 04 Aug 2021 03:16:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EK0cf9uy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237204AbhHDJqb (ORCPT + 99 others); Wed, 4 Aug 2021 05:46:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:43506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237177AbhHDJqa (ORCPT ); Wed, 4 Aug 2021 05:46:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D0F060F43; Wed, 4 Aug 2021 09:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628070378; bh=nt0RjSYMCjZ+aptscxs5+o+ti2RHm78rEXtWUlpI+iQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EK0cf9uy1ZVm3nPQNyD1Gb3mct7D6fJwv0rz9ej7uTVuQN8DblPmgfmarHSPKStLX e2CqUR+AsVFh/4/lel3GeXOpenokesve6/IeaWI8ox636wFduNeTQJgIMtx0wTwVnZ nrnv3kHTWyLsM4aymDPwxpw5h9RWDMpH6vnIdIKa5VCam3jQmNjixUP1htZ3wfJTvT OFoi0ro6dOKr41ScGwrXhU10MadOlaSda8xJVEjN2vhT1mhGQKUpLUPCNlyBlgvoQf jEDlB/NeaFQBiHMHZYUcNAZ2lUDxLblo5xs9DP5FZhlkv5TUh/2pJxdkgQHLyP134N 7MX5sMnjyDpwQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1mBDSx-0007Zu-O3; Wed, 04 Aug 2021 11:45:36 +0200 Date: Wed, 4 Aug 2021 11:45:35 +0200 From: Johan Hovold To: Salah Triki Cc: Dmitry Torokhov , Lee Jones , gregkh@linuxfoundation.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] input: touchscreen: replace conditional statement with max() Message-ID: References: <20210803003857.GA1560352@pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210803003857.GA1560352@pc> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 03, 2021 at 01:38:57AM +0100, Salah Triki wrote: > Replace conditional statement with max() in order to make code cleaner. > Issue found by coccinelle. > > Signed-off-by: Salah Triki > --- > 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); I'm afraid that like the related patch you've posted elsewhere, this not an improvement either. > > return 1; > } Johan