From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 062F6C27C47 for ; Sat, 28 Oct 2023 13:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229519AbjJ1Ndr (ORCPT ); Sat, 28 Oct 2023 09:33:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjJ1Ndq (ORCPT ); Sat, 28 Oct 2023 09:33:46 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEF2DC0; Sat, 28 Oct 2023 06:33:44 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B608C433C8; Sat, 28 Oct 2023 13:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698500024; bh=hLbfxuRpowB3R+I1UXL8u9WS/bWkX7DQHooMrGVVcXs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Iw8etJ7+NXu9Cqluj7e1KgtXkQS4V+iaC0HhlnNGyMEC69idLx1Lb4/3271MMWr+n Go8lsCiwQjZCg4OLqz1ZRcHydPHZvd7o/NOUvThVRBGK2Y030Tf50GizZMzb7TQONZ 5g3EQMrP1yhxGaVS36TVNFjwT1qv8lVN3J5XZzCbqZc+EC4jviqLZ4V6XTRF0NsMdg Hi6EcL0DDIggOnhRcCNVOucK43Uv57pGRKTfFpGlNFea81h5fR4H7MzBEe3PFpAPrB kD+tASkPnPoO+O3KxqKGdpcvEBSTbmGkqADz4ryk7VzsPEHVyp1AfXmqK9sD/vxWgy iLMNjo4+YSelg== Date: Sat, 28 Oct 2023 14:33:10 +0100 From: Jonathan Cameron To: Jean-Baptiste Maneyrol Cc: Bragatheswaran Manickavel , "lars@metafoo.de" , "linux-iio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] iio/imu: inv_icm42600: Use max() helper macros Message-ID: <20231028143230.1a6f3187@jic23-huawei> In-Reply-To: References: <20231027094410.3706-1-bragathemanick0908@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Fri, 27 Oct 2023 15:19:49 +0000 Jean-Baptiste Maneyrol wrote: > Hello, >=20 > thanks for the patch, looks good. >=20 > Acked-by: Jean-Baptiste Maneyrol Interestingly b4 isn't finding this tag. I'm too lazy to look into why but seems your email didn't reach patchwork either. Applied it by hand whilst applying the patch to the togreg branch of iio.git which given timing will be rebase on rc1 once available. For now I'll just push it out as testing to give 0-day a head start. Jonathan >=20 > Thanks, > JB >=20 > From: Bragatheswaran Manickavel > Sent: Friday, October 27, 2023 11:44 > To: Jean-Baptiste Maneyrol ; jic23@kernel= .org ; lars@metafoo.de > Cc: Bragatheswaran Manickavel ; linux-iio@v= ger.kernel.org ; linux-kernel@vger.kernel.org > Subject: [PATCH v2] iio/imu: inv_icm42600: Use max() helper macros=20 > =C2=A0 > Use the standard max() helper macros instead of direct variable compariso= n using if/else blocks or ternary operator. Change identified using minmax.= =E2=80=8Acocci Coccinelle semantic patch. Signed-off-by: Bragatheswaran Man= ickavel =20 > ZjQcmQRYFpfptBannerStart > This Message Is From an Untrusted Sender=20 > You have not previously corresponded with this sender.=20 > =C2=A0 > ZjQcmQRYFpfptBannerEnd > Use the standard max() helper macros instead of direct > variable comparison using if/else blocks or ternary > operator. Change identified using minmax.cocci > Coccinelle semantic patch. >=20 > Signed-off-by: Bragatheswaran Manickavel > --- > V1 -> V2: Adding similar changes to inv_icm42600_gyro & inv_icm42600_buff= er >=20 > drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 5 +---- > drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c | 5 +---- > drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c | 5 +---- > 3 files changed, 3 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c b/drivers/= iio/imu/inv_icm42600/inv_icm42600_accel.c > index b1e4fde27d25..f67bd5a39beb 100644 > --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c > +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c > @@ -137,10 +137,7 @@ static int inv_icm42600_accel_update_scan_mode(struc= t iio_dev *indio_dev, > out_unlock: > mutex_unlock(&st->lock); > /* sleep maximum required time */ > - if (sleep_accel > sleep_temp) > - sleep =3D sleep_accel; > - else > - sleep =3D sleep_temp; > + sleep =3D max(sleep_accel, sleep_temp); > if (sleep) > msleep(sleep); > return ret; > diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c b/drivers= /iio/imu/inv_icm42600/inv_icm42600_buffer.c > index 6ef1df9d60b7..b52f328fd26c 100644 > --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c > +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c > @@ -424,10 +424,7 @@ static int inv_icm42600_buffer_postdisable(struct ii= o_dev *indio_dev) > mutex_unlock(&st->lock); > =20 > /* sleep maximum required time */ > - if (sleep_sensor > sleep_temp) > - sleep =3D sleep_sensor; > - else > - sleep =3D sleep_temp; > + sleep =3D max(sleep_sensor, sleep_temp); > if (sleep) > msleep(sleep); > =20 > diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c b/drivers/i= io/imu/inv_icm42600/inv_icm42600_gyro.c > index 3bf946e56e1d..3df0a715e885 100644 > --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c > +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c > @@ -137,10 +137,7 @@ static int inv_icm42600_gyro_update_scan_mode(struct= iio_dev *indio_dev, > out_unlock: > mutex_unlock(&st->lock); > /* sleep maximum required time */ > - if (sleep_gyro > sleep_temp) > - sleep =3D sleep_gyro; > - else > - sleep =3D sleep_temp; > + sleep =3D max(sleep_gyro, sleep_temp); > if (sleep) > msleep(sleep); > return ret;