Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1769113rdh; Sat, 28 Oct 2023 06:34:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYruQN/OSw9CwoOAgXpnNPy612pjmOwYuzwr8QllIB+slPz7Q1afyl2PHwFN47MdysWNv3 X-Received: by 2002:a05:6a21:1205:b0:15c:b7ba:ea44 with SMTP id oe5-20020a056a21120500b0015cb7baea44mr3916367pzb.60.1698500045203; Sat, 28 Oct 2023 06:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698500045; cv=none; d=google.com; s=arc-20160816; b=ZU57aCLOFqpsBkPgtljfbJ1PSAJ0WRuoLE2vW3J+Qi+Rs3yRk1wK92b8TPS46IO32V q6Pbq7u3hhexR7drWTqjHv7ZY4+qDp1H6Xw+RQwwBWL5kET1yZB82TEyQLOzpoXA8vfk NSSsAJNOXzn2stWKUwndcTO0pKDGoOBkDE8DEyVOOlL6JmnbLLfx8JkuWgydadtpDFkm UGK8umTIk5+lbLusXHKk8OCFh9mi9Jy0efIsebBeaXkBODkANGXMG/90fdKQdlIh5SXe ILrpSqH2NgZ52CfvdtHgxGiw0iaVo6yOq8+jirbvQBXhXfRe9G5GtcaRerAwCN867F58 GSjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=udh2iu3RSAgMUruGl87fINrKTmYZK6ifb7O5+lPSbkQ=; fh=Y6h9UBOxkpRLdTjWxLFZzguAcMCtuVUowcEZEl/D1tk=; b=cEeoYzVCG3y81Vs2ACT1fr3BdQXq5SJCpjpFO3Bn2CNlFTg67ppmJ3oTtYoihIqd69 WFc4KyFv87eFDTOyXmTvcS2dSR3zIYyq1Q3tfPCVejaX/PBMaqEtBrJ/qTbadnCH0hHu UoXK5XmzPmSIG39bvfhFgk92d9BbDY0+iJaNDNMyJrOSbCq6VKyLkcvo9TDmkIvSDQ1Z 2VBoyQD03wIREfI7cNkc65Nyzel8isRUjajraKjSgDdAO1y5vO/NLKZz2WZ2dIkzD4mt S+hBAyr97xgVr7oeFyqO5NoPtRGPI/t9W6U6m0KmfvfyaxO/klG9uhvUXNhAAQ4wJGTo o6RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Iw8etJ7+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k9-20020aa79989000000b00690c23d353asi2404190pfh.217.2023.10.28.06.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 06:34:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Iw8etJ7+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 7C28E805F5EE; Sat, 28 Oct 2023 06:34:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbjJ1Ndr (ORCPT + 99 others); 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 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 28 Oct 2023 06:34:02 -0700 (PDT) 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;