Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp342036iog; Fri, 24 Jun 2022 05:14:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vz0Y2F6jSuNXrakDpW7qX5UwGhicHJMV096l8q5ToweQQnkb3tBpPrXaOxztnltkiaYxDL X-Received: by 2002:a17:90b:4c0a:b0:1ec:e6b3:7690 with SMTP id na10-20020a17090b4c0a00b001ece6b37690mr3650871pjb.121.1656072882835; Fri, 24 Jun 2022 05:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656072882; cv=none; d=google.com; s=arc-20160816; b=vo9rCXEDtxf2EqBTNBWVuX4Ecr7YFzGZAhqZ991GoFraRl73eBwt79mDrSFg8NPvZv zPPJOhX4Ti1c7w8aVcMTQY1ugnN4rd9JVdY+2Yi1vEx45L+wOVkjWo67ExxqP5BGkflK EQV2r0i/Qi3oC0jrV/YreGd7uJYXc/Tv+YBZNzx9BNxFEgeAc0Dura9L0+D4w9FSiB+x QssAysVG5Pcc1jI0/BcFCxG3tIjLImfEoIZVmiVtGeubZwwF9hLQn3Sx0/d2Bgq2JTnE Dm1UtA+N2aQhMz1RZHa+RTsiMSUJ8unHqS9Ivo4rLyXVj6vFteczj/JZY5jbC8P+FEfA ZerQ== 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=LRLPrqZ/tJwGdvagoItMmAQzSmts6CJt9PpLGt2HBU0=; b=QeCX0VRANec1A0w0BNw6564tM9W96Xiclr6incfpjQmeNhRLRjfun6INcqXbfiFi3+ JyRhu94I9VPaB1OurMgpRJUZOMPb04gYcWQJACqmO9UUUkvo67qLNGSIALd/x97J/sJY EML7uej15DvEw/6mEI1+2Ut1OuNKoG31952koYwRIONy1QLjTh4javO6d1Gfvae0Or0w eemiRe8JUjHgjkI4XxjT7Hpm5R4lDat7QYql5HXCOa6e3HJPx8P6aXA4IU4qbUVDvgeQ 9Tdxk79x++d5nJHvvngQ3h89MYyJ1+wgrbR/9im/bxrp107eLawA2fsUMuc2T28nlrfl u+OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ftyp1r8Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e37-20020a631e25000000b004052ab25e19si2520434pge.767.2022.06.24.05.14.31; Fri, 24 Jun 2022 05:14:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ftyp1r8Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230264AbiFXMDZ (ORCPT + 99 others); Fri, 24 Jun 2022 08:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbiFXMDW (ORCPT ); Fri, 24 Jun 2022 08:03:22 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5F092CDC2; Fri, 24 Jun 2022 05:03:21 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id j21so4138522lfe.1; Fri, 24 Jun 2022 05:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LRLPrqZ/tJwGdvagoItMmAQzSmts6CJt9PpLGt2HBU0=; b=ftyp1r8QDfaCG2ZUcjStjpwLhkm6KG1dI2xfKjr2WmMEkVteu2G5rE8dftLZhyQe2l 3bX3/fFhpiDREOMiyos/YG9qwD1PxI8Q3ZZRTp/Lux+AVyzkDaBR+5o157pwX7AbXo6i Zh0wWQdI6W+I9htRkxQRCU61bPcZrxdXTzUbam2UBO3fjs09URVb/A5n+QPNgzklQC2i 86+j4hmp1JfgDPR7Bffx6X7cQsdvyZg5zdi9rwr1Dj7tO5GUMB5jRtbSRBoKhFU0kylL VVpYhWf6J3REfEs3Fm7ZGjEUlJAhkc4QVXzktYtTvnbShnEPqJ7Qrmev+w1al/8/i8Tu /g4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LRLPrqZ/tJwGdvagoItMmAQzSmts6CJt9PpLGt2HBU0=; b=CNtS8qLsQWocELbwNgRfOk76E/TRuXVQspOBS5PT49vpLclESuIoazaJ0KLp2/Rfh1 Jx2oOt8xBztynNCja82t2xG4xUeSVNzm5M9aPHAltJi2jYNLD1u4nMjhZxy/76MXxLE5 UKDteCZLlvaqDaWA7NmvGsuGHvwDszuenTogME61plM+4PPwC9KzevBWH5FctnYNswto ohWLKCH3BsVpbAeBf2LZxJes/QN9j81/lUBsoeO403PaKAhtUBWsABMDXaZIjwi7Fdt/ RHAQfpk2bJ6UT8FKTZk/KFHAziYNvaZsLpaD3qHcgEW+RQ/c3fklKX0zBjYGC15HPxSK TKxA== X-Gm-Message-State: AJIora8eOHrN2AjoegBroamO4YKVJ/m0XHxLTB7JLg8VfOlGpVGUu/kZ bBu7bxHUxX9PHmoGSEeOf1k= X-Received: by 2002:a05:6512:ea5:b0:47f:785c:7031 with SMTP id bi37-20020a0565120ea500b0047f785c7031mr8766005lfb.35.1656072199616; Fri, 24 Jun 2022 05:03:19 -0700 (PDT) Received: from gmail.com (82-209-154-112.cust.bredband2.com. [82.209.154.112]) by smtp.gmail.com with ESMTPSA id u16-20020ac258d0000000b0047f6f675ea1sm338586lfo.161.2022.06.24.05.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 05:03:18 -0700 (PDT) Date: Fri, 24 Jun 2022 14:05:08 +0200 From: Marcus Folkesson To: Andy Shevchenko Cc: Kent Gustavsson , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , linux-iio , devicetree , Linux Kernel Mailing List Subject: Re: [PATCH 10/10] iio: adc: mcp3911: add support to set PGA Message-ID: References: <20220623170844.2189814-1-marcus.folkesson@gmail.com> <20220623170844.2189814-10-marcus.folkesson@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bKRj2/f7JE0UQ8BO" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --bKRj2/f7JE0UQ8BO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 23, 2022 at 09:15:51PM +0200, Andy Shevchenko wrote: > On Thu, Jun 23, 2022 at 7:41 PM Marcus Folkesson > wrote: > > > > Add support for setting the Programmable Gain Amplifiers by adjust the > > scale value. >=20 > ... >=20 > > + int ret =3D mcp3911_read(adc, MCP3911_REG_GAIN, val, 1); > > + > > + if (ret) > > + return ret; >=20 > Please split the assignment. >=20 > int ret; >=20 > ret =3D ... > if (ret) OK >=20 >=20 > ... >=20 > > + *val >>=3D channel * 3; > > + *val &=3D 0x07; >=20 > GENMASK() ? I will use GENMASK >=20 > > + *val =3D (1 << *val); >=20 > Unneeded parentheses, perhaps BIT()? I will switch to BIT() >=20 > ... >=20 > > + ret =3D mcp3911_update(adc, MCP3911_REG= _GAIN, > > + MCP3911_GAIN_MASK(chann= el->channel), > > + MCP3911_GAIN_VAL(channe= l->channel, > > + i), 1); >=20 > This is not good indentation, at least i), should be on the previous line. Agree >=20 > ... >=20 > > +static int mcp3911_calc_scale_table(struct mcp3911 *adc) > > +{ > > + u32 ref =3D MCP3911_INT_VREF_MV; > > + u32 div; >=20 > > + int ret =3D 0; >=20 > Useless assignment. Agree >=20 >=20 > Return directly. OK >=20 >=20 > The useless label. Agree >=20 > > + return ret; >=20 Thanks, Marcus Folkesson --bKRj2/f7JE0UQ8BO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEBVGi6LZstU1kwSxliIBOb1ldUjIFAmK1qGAACgkQiIBOb1ld UjKJNRAAge69rOmGEVokFO/oISGAzXS1ZqArxPISfbiEhZnC08gxknW2F8FoFVYd KF0vimNI8D6ZojSGrJ/3Dn000yFgFf/nhjKWbEu/Wz1hGr5T7c25lw/darA7iyuZ KhzfVorHKEaZxDd/xVVVS2IU8ebDLsUDDyrBfOyvS5ERj25sz/kw7jZXDjsY3QAd wtIve7zqV58QRD+TYulZCb4Ms5mTdGHDWktPgeQiOnI7hFQGjVtUuWrcuQAKHffa QhEqHSVIqXB+Y6pjQuk/SjBZod9zSb5rlSCjId9wzFrBJLkhl1ITqTxcAse9/eyF 6vwqLnfGblOzcFHdovPTSG5IjPgrzeevoftvbera4t+uOAnKSxrrSyftvXSESarE r92dxeP/nxtJ7sPuwReIHgOHvRNaamlFN5CPgzc0SL6i4xoCryVJswh6/J1SXHmE b15T1/X6a9L7eFPn0JwgOcr03dh010ZMZF39LYP+TfW1eDkYusd6ePNuyctMjT/1 MhjgZ4uXFEYfCApWJ+0UWyFDnIvU8/SSP+GxE2JQuEzZgnqyGGgZd6gd0oGyQtHJ y5QsDtfTAhuOh+6wsI447gjnxD0DCzEp0kropz3eaIMGTfrXnF3t9A3HyRdut6/h LgEyb+kYTGF39sT6FLeR37vvyZKvACpaOalFGKrbz+jmDVltq7k= =1Q1R -----END PGP SIGNATURE----- --bKRj2/f7JE0UQ8BO--