Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1795757iog; Sat, 18 Jun 2022 21:41:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tqI9NuWy+30fXWBe1MIoX2BRkcvrEZWJRcHJA5y3rvrG2mJid1hRuAbefrdIe/4nuQl1KG X-Received: by 2002:a17:90b:4f47:b0:1e3:38c7:70b5 with SMTP id pj7-20020a17090b4f4700b001e338c770b5mr31286070pjb.32.1655613691448; Sat, 18 Jun 2022 21:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655613691; cv=none; d=google.com; s=arc-20160816; b=RRxWg8Qk4C9J56r0g4/Z3D9I4EnTn41DXonPZKzHnqd91ha3C6HFmEs1Pw/tKxzKki WL+7xdhaBRJI7MAexWiYjMPkmJcK0BEftxHftTCGJ3A6NSD6oTPioeu8byjWTSN/PaGy reSv5jaqAzhl4OodgA4fTZF4TcoblJHMDP+A6u6fBF/YT3QmtF6kzTCNr8qCg5/9mj7U 3nQyp0f6PuVO/zKWZKPNyRISvMsW0a0pGamABtPofVNZNd2R0tZ2yfJFKOJOOecX0lEy k2c97VZtVe6aOCH8IYyDkK0j6GlVoEb+Wb4hvNfi3lfW8e65hxFTFk7c3gm6XuzxW46l xGuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version; bh=GbS9TDOHV4jf2htfhwIeIm8TpA0asWaDoPdyofcHL38=; b=uUmb1FjIkZq+5oDdPRuVMPDySdzp0Al3A/GHq9qXB8f2ZbpC7dPD4gE4EuEwuWGHKH PkhjLUvlmTVyJAAa6/uGxIVtXYXhtbjP4uM2mkhOPRYWyUwzAWyPUeFKyqafK09eMwSo /KQZLKhAAyxLMbeMaS2Vr1WvDKdZ2iyrUBPX5Hk3U95s5cTc6jGST12dDr2tBTR4tjGw 22DtnKM1vZgi1kMfC3I0FeKqhY22EnJZpB02kJcAGVxvz3fWlKq4sKHy7xhs/1LOq/BF 58adBkoVIrohte4QTy09S9TspBKf1PfFhg6WVwK0NB8Gc2yydJvqfja8F8fu/dWrHkgd vTjw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a631f0a000000b003fc69d0de65si11440202pgf.431.2022.06.18.21.40.52; Sat, 18 Jun 2022 21:41:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234019AbiFSD5M (ORCPT + 99 others); Sat, 18 Jun 2022 23:57:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbiFSD5K (ORCPT ); Sat, 18 Jun 2022 23:57:10 -0400 Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A76911C01; Sat, 18 Jun 2022 20:57:09 -0700 (PDT) Received: by mail-vs1-f43.google.com with SMTP id d39so7594267vsv.7; Sat, 18 Jun 2022 20:57:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=GbS9TDOHV4jf2htfhwIeIm8TpA0asWaDoPdyofcHL38=; b=N7ZoypqMi1X63sj47YYzSqMlx18uwKWNrZZKoTFBfrqRA5Z8n9VIm+O+bB7WyRBzy9 ZbsS6jtzS6hufj6HZIUvgiseKETZSjywPqOsInvgF38FvnlsTdhUiWLaMZDDuKS2xAyg Z81u0R+yDvsKCxkjdOKDKotE9B9No6gJgVYjqicBV+pqBUzMkFD/EUdNRQlRmuWuoSyX 8q1SSHpTGTzRkftVSxPDe01aX4+HiLqeCPVsVqvBuIOycWjdWA/GlmAvWyWzq+GpKR5e +f5rIQkUkFD87nnCiVIoIswT41JVmtsbml89P8Q1vUW+VRyqDVOOxp0F7ZjSWIMN/sDp XEew== X-Gm-Message-State: AJIora8Gn/TdOPDm2AWbY9+4m2P7qb+bnIJ4Wn1slinwrUNGUrUJ3OyZ 6Qnf7hUs/9iiMFnIWoKH9SPdmYOmOvSTcg== X-Received: by 2002:a05:6102:32c8:b0:34c:2358:1824 with SMTP id o8-20020a05610232c800b0034c23581824mr8083413vss.65.1655611028583; Sat, 18 Jun 2022 20:57:08 -0700 (PDT) Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com. [209.85.222.45]) by smtp.gmail.com with ESMTPSA id k26-20020ab0715a000000b0037f029bcf0bsm809913uao.21.2022.06.18.20.57.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Jun 2022 20:57:08 -0700 (PDT) Received: by mail-ua1-f45.google.com with SMTP id r15so2852271uaf.13; Sat, 18 Jun 2022 20:57:08 -0700 (PDT) X-Received: by 2002:a9f:37a2:0:b0:379:2023:a630 with SMTP id q31-20020a9f37a2000000b003792023a630mr6647474uaq.73.1655611028267; Sat, 18 Jun 2022 20:57:08 -0700 (PDT) MIME-Version: 1.0 References: <20220618214009.2178567-1-aidanmacdonald.0x0@gmail.com> <20220618214009.2178567-11-aidanmacdonald.0x0@gmail.com> In-Reply-To: <20220618214009.2178567-11-aidanmacdonald.0x0@gmail.com> Reply-To: wens@csie.org From: Chen-Yu Tsai Date: Sun, 19 Jun 2022 11:56:56 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 10/16] iio: adc: axp20x_adc: Minor code cleanups To: Aidan MacDonald Cc: Linus Walleij , Bartosz Golaszewski , Rob Herring , krzysztof.kozlowski+dt@linaro.org, Jonathan Cameron , Lee Jones , Sebastian Reichel , Mark Brown , Greg Kroah-Hartman , Liam Girdwood , Lars-Peter Clausen , "Rafael J . Wysocki" , quic_gurus@quicinc.com, sebastian.reichel@collabora.com, Andy Shevchenko , michael@walle.cc, "open list:GPIO SUBSYSTEM" , devicetree , linux-kernel , linux-iio@vger.kernel.org, "open list:THERMAL" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Sun, Jun 19, 2022 at 5:40 AM Aidan MacDonald wrote: > > The code may be clearer if parameters are not re-purposed to hold > temporary results like register values, so introduce local variables > as necessary to avoid that. Also, use the common FIELD_PREP macro > instead of a hand-rolled version. > > Suggested-by: Jonathan Cameron > Signed-off-by: Aidan MacDonald > --- > drivers/iio/adc/axp20x_adc.c | 61 +++++++++++++++++++----------------- > 1 file changed, 33 insertions(+), 28 deletions(-) > > diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c > index 53bf7d4899d2..041511280e1e 100644 > --- a/drivers/iio/adc/axp20x_adc.c > +++ b/drivers/iio/adc/axp20x_adc.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include Sort this group of headers alphabetically please. > > #include > #include > @@ -22,20 +23,20 @@ > #include > > #define AXP20X_ADC_EN1_MASK GENMASK(7, 0) > - > #define AXP20X_ADC_EN2_MASK (GENMASK(3, 2) | BIT(7)) > + > #define AXP22X_ADC_EN1_MASK (GENMASK(7, 5) | BIT(0)) > > #define AXP20X_GPIO10_IN_RANGE_GPIO0 BIT(0) > #define AXP20X_GPIO10_IN_RANGE_GPIO1 BIT(1) > -#define AXP20X_GPIO10_IN_RANGE_GPIO0_VAL(x) ((x) & BIT(0)) > -#define AXP20X_GPIO10_IN_RANGE_GPIO1_VAL(x) (((x) & BIT(0)) << 1) > > #define AXP20X_ADC_RATE_MASK GENMASK(7, 6) > -#define AXP813_V_I_ADC_RATE_MASK GENMASK(5, 4) > -#define AXP813_ADC_RATE_MASK (AXP20X_ADC_RATE_MASK | AXP813_V_I_ADC_RATE_MASK) > #define AXP20X_ADC_RATE_HZ(x) ((ilog2((x) / 25) << 6) & AXP20X_ADC_RATE_MASK) > + > #define AXP22X_ADC_RATE_HZ(x) ((ilog2((x) / 100) << 6) & AXP20X_ADC_RATE_MASK) > + > +#define AXP813_V_I_ADC_RATE_MASK GENMASK(5, 4) > +#define AXP813_ADC_RATE_MASK (AXP20X_ADC_RATE_MASK | AXP813_V_I_ADC_RATE_MASK) Please also mention "grouping macros based on chip type" in the commit log. Otherwise, Reviewed-by: Chen-Yu Tsai