Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp341552iog; Fri, 24 Jun 2022 05:14:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vKjJkQ/uVbrtF9Lw9uAbJ4xLe6gzaOoR1Q0aUC5sYdKCcu7RGcsCBXnmQMN6GAbGRJoBaW X-Received: by 2002:a17:902:e852:b0:16a:67d7:c427 with SMTP id t18-20020a170902e85200b0016a67d7c427mr3567755plg.154.1656072857465; Fri, 24 Jun 2022 05:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656072857; cv=none; d=google.com; s=arc-20160816; b=dbHM0bxEf11VWuxsZpk7tz3HHX+I87BOY5FBQMCIne7CNx0buCSTUD1HLQ80G695Zm SzL+OvctJuftNAaKt7MaFE+1Od1s6cRS1P6dtro5zV0mh+wSwR2G1/8Mb8CmOPbekBjZ uF/Myy1Zj3JSTvWoueGH2CkiXJLqRit2gIWzep1LLowCN33JSAnMkxdiLur7pwd0puN6 WgT5nW2jTVMOKzKGOpZAOqaynkGiiUBSBfzHq2Zesu5RiEdxkfwYXiwtWLBTNOr7uDP8 JFgc7QcM116+lQ/4L5FIzBhd4SPNK4a+xH3SJPHD7JoAmyHe5DsNc2Qgm7GDa749eSVb tCGw== 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=MlmWOxwc9B5om1qcXX6Sgk8MRmGPoyaBAHrPiH+sPck=; b=K6cPSJAltUvwzgyS6ij7Ba5FPbgeoEXN6khM511Y/XF7LF8dVXUt3Mo3vVFCI95CLo fyXwEfILM02HwE7sU8kNMLwBDcZMHOL/eDYvt44e54cvmXmNdDlMOY++mdtsMHeVlzGS cAjyWUMpCLauZbH1l3MpbJijKahkO1/xnfPCfEBh26cT/y49HdOWszF4wI6FXUa/Icf4 nQYCvJcdtjnuLIXxB3apJjb7Zn2qdCXKaV1UigrUlvoYOuCzsqooDBARTc1L/Sf5o0Ao RaOXWg4f8zO22XJXyof8mCjnIBE2kRxXBwluiccv1usr25MUvn8z3x5QO3GmNGLXZuSW +zRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TQavJQqP; 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 l5-20020a170903120500b0016a71886b5bsi623530plh.160.2022.06.24.05.14.03; Fri, 24 Jun 2022 05:14:17 -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=TQavJQqP; 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 S231910AbiFXMHm (ORCPT + 99 others); Fri, 24 Jun 2022 08:07:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231903AbiFXMHb (ORCPT ); Fri, 24 Jun 2022 08:07:31 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 222A87FD2A; Fri, 24 Jun 2022 05:07:30 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id bn8so2561290ljb.2; Fri, 24 Jun 2022 05:07:30 -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=MlmWOxwc9B5om1qcXX6Sgk8MRmGPoyaBAHrPiH+sPck=; b=TQavJQqPAxGOqaMWJH9G5tNHL53MY09upOvdRJfLqeqqZop/EKT0tPY3DYiABuEp6R zLNG7my/MHYCPm5oEBkNe/RKCL3gIoCOTEYLZ5XRY+flheUaPrpqFFaSipolHublVGk7 8Z9C6a2UXzh65Mwq/B9RTrrYSVAU33jj2TzOT+5tG18uTErqLoFcY6bpUlf7lQ4cKNrx FzTSgNU7Or9nuNLn2hU9yDkXPIgoY4cNUA2pxNmWAqB0XMXmPCKenP2FydicJ0Gspq03 ItDkP4YjE/Hk/SH8BXRir0+EVbSyUi4R7qslZ7PsLFRlMk5ZmOgXJ+kQAquVkncYJVs2 rsEw== 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=MlmWOxwc9B5om1qcXX6Sgk8MRmGPoyaBAHrPiH+sPck=; b=3sFhTSr/HkfWNuB4gKrxZRQB+NvVKZlBrZ9kzkGIoGdlJgF0OKIFJpED1MvvKGSgEh M6vHZ1lksBg9iWN53MYBZ5u5/2lL88IyFQh+OeJJUxrsj74Fc/z9oXctexcJpxJ6HcrF d8YtTl0mzrZTaxhH28Cb1/k8wiuweHZHXOA8sYJ+rbD6nsihlcXTXV2OfdYwxR2JwhPw quB7ZZB+Cqlg0/XClFvJMo0VWdWHl6cdKKy6rx/HIWRcmJ/FDiz6fzp4zxsOiH2VvC6x jRT+sDhfmV14royii7NuiGPQVgyuEhZ7bHOO3M8kDHaHyFHazTpA0cTfnKrJaZ7Wzzx0 PHyA== X-Gm-Message-State: AJIora85zXfCaz7QhyW0Tv42LrwYmqqSYxJxXl+FqaccdgKHrBeHseFm ixINSCofN78hBfqqza+kxqg= X-Received: by 2002:a05:651c:178a:b0:25a:44ab:593 with SMTP id bn10-20020a05651c178a00b0025a44ab0593mr7385359ljb.358.1656072448258; Fri, 24 Jun 2022 05:07:28 -0700 (PDT) Received: from gmail.com (82-209-154-112.cust.bredband2.com. [82.209.154.112]) by smtp.gmail.com with ESMTPSA id v5-20020a2ea605000000b0025a96e2ab0csm261845ljp.133.2022.06.24.05.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 05:07:27 -0700 (PDT) Date: Fri, 24 Jun 2022 14:09:17 +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 06/10] iio: adc: mcp3911: add support for oversampling ratio Message-ID: References: <20220623170844.2189814-1-marcus.folkesson@gmail.com> <20220623170844.2189814-6-marcus.folkesson@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mjYFCl1wg8k8qrkO" 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 --mjYFCl1wg8k8qrkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 23, 2022 at 09:20:01PM +0200, Andy Shevchenko wrote: > On Thu, Jun 23, 2022 at 9:08 PM Marcus Folkesson > wrote: > > > > The chip support oversampling ratio so expose it to userspace. >=20 > supports >=20 > ratio, so >=20 > ... Thanks >=20 > > +static const int mcp3911_osr_table[] =3D {32, 64, 128, 256, 512, 1024,= 2048, 4096}; >=20 > Spaces inside {}. Not sure what you mean? >=20 > ... >=20 > > } > > > > + >=20 > Unwanted blank line. >=20 > ... Removed >=20 > > + switch (val) { > > + case 4096: > > + val =3D FIELD_PREP(MCP3911_CONFIG_OSR, 0x07); > > + break; > > + case 2048: > > + val =3D FIELD_PREP(MCP3911_CONFIG_OSR, 0x06); > > + break; > > + case 1024: > > + val =3D FIELD_PREP(MCP3911_CONFIG_OSR, 0x05); > > + break; > > + case 512: > > + val =3D FIELD_PREP(MCP3911_CONFIG_OSR, 0x04); > > + break; > > + case 256: > > + val =3D FIELD_PREP(MCP3911_CONFIG_OSR, 0x03); > > + break; > > + case 128: > > + val =3D FIELD_PREP(MCP3911_CONFIG_OSR, 0x02); > > + break; > > + case 64: > > + val =3D FIELD_PREP(MCP3911_CONFIG_OSR, 0x01); > > + break; > > + case 32: > > + val =3D FIELD_PREP(MCP3911_CONFIG_OSR, 0x00); > > + break; > > + default: > > + ret =3D -EINVAL; > > + goto out; > > + } >=20 > I understood why the table above, but this is a waste of resources. > Use that table Yep, I will use the table instead >=20 > ... >=20 > > + ret =3D mcp3911_update(adc, MCP3911_REG_CONFIG, > > + MCP3911_CONFIG_OSR, > > + val, 2); >=20 > sizeof() ? sizeof() what? Thanks, Marcus Folkesson --mjYFCl1wg8k8qrkO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEBVGi6LZstU1kwSxliIBOb1ldUjIFAmK1qWgACgkQiIBOb1ld UjLRIhAAxjpsZF7muOuTgCKiTvY0MQGsqb059NkGOLpiiiB39A0g4r+Oj3yHDdZk RmynAm/qheM70moQNU2GUDKUm96bHVHrPmbpl8TpOZ0QldlPanXs3gZ+vBeGlO95 t0s4NPLVHnxKusVRDSMeWa5EETjm0DWTfwbwE/tDp5Gd9U56+vsJ+fndhIwolLo3 4kjkDo1oPXlFeJUwAHOZ9HNp+987NVoS0u9SDotb/CkWK63hNfpP9aL6Knk07cby PgtLzefWXf47NVOAErZIfE0UzNQkRTP7ijH20JcX+CLYKavovEYbrMXyhVwQky4c NrWFjHYy1DhW6WKMc2qW76q1vPrQgQo4y/rsbLlF/25TWCfN3ruFOdpGzijPkDku r4buN5L2C7M+MOdfT6R+4Uo2RzQoeK7ZuheU51rn9B/8FQbtldD99mCoBARoEdEq JSzIpdnheTmQwZH4BNgzEoe6/NrG08fAtG9oET+7NvCK4fA+h+KasgZ+Ixo/MbOw jD8B3m0nNGd1RBRm41/KGUnO4IFzDWmLZAwIHGTRIMpJ3cT5BxR84mmi48EcngS6 x42I5s1LmfvwCh1k+YXcUWhttZEK/qv6NiEPFRdlK/GomREs4aVDqviveRy0TLnA cscGoik2YWh0sOAkmxoOmPhuiNLwL3IW7YhybhrYiTh95p1lrTE= =3t6v -----END PGP SIGNATURE----- --mjYFCl1wg8k8qrkO--