Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1974070iog; Sun, 19 Jun 2022 04:02:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sk3y+uqJKmw/yzAbhcuKqBzBm8uvcwBVYP2B6BIN9OpqMhVPFWg8aqAvNlX4sMWlEJEc5F X-Received: by 2002:a17:907:3f9a:b0:722:abe4:ace7 with SMTP id hr26-20020a1709073f9a00b00722abe4ace7mr2148637ejc.241.1655636558043; Sun, 19 Jun 2022 04:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655636558; cv=none; d=google.com; s=arc-20160816; b=QlSqOSbAdV3YoCMQyS1B5lrTLothmTWfD8gyJeGTSLQQQp9BkbZPC7CT6IioqZDKcz MlVI/oRg5SZge/8ozW6bwmz5KiYpIpxMhJtE1SYyt2dfi4Be888YsXwwHfQeroXsBOTK aowRWTbqvtfgHhlS3v3u1HWBeaODNldLE7AGi0bj2GPrplGfUS0V8/gb0L4KUWwCGCOt j+MRK7SEpNmnCWJzQzejbeusKIzIYHhcw5il5+2Fyyw3l4ZwY4nCy4IM9a3bNbiT1EC/ +kSorCsjxRfGXP0OLsSR7VVIOdi1ePbM1EtEnczbBHOxv9RDO4/r/p45HH2bmZhLAn4C Nz1A== 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=DV/Vu1rR4R4LQ+sfVRhXpnfOyvQGyPcyzEmmdyz4QDY=; b=xV05OEfLE4wHCBzE2xdQ1cLlY7nkDKS2BaBySGepXDuPiRbafqw8Uq84ljAm00oYA1 rEqX5u4nlc3yMrcZT0rB77unrQN9RlqKq6oz2me8K7ehMsXKaURyDWiJnIzwx2mo0UiM SZ9AsEq322kUhBhV2iEpLz/u16Ob2jfOsPa+909VhGKxDhEu1nGsSbcII5R/Ca6cjUuO iVgdz4ZabLOY1CnIHHGF9xu6lUfKw6gSrzfo5k1c7HL0R8HzJ93mKhImIPDi+CkULG1b VUMrwI8dxP5cJFVxLAqohsF+8IzIUpCiefLY04CmiXOj1K+cg2l6D2NNGIk/H5+eIMrn DH0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rVQRKLTd; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020aa7cd0e000000b004357523b6a3si2772568edw.550.2022.06.19.04.02.10; Sun, 19 Jun 2022 04:02:38 -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=@kernel.org header.s=k20201202 header.b=rVQRKLTd; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235595AbiFSKwQ (ORCPT + 99 others); Sun, 19 Jun 2022 06:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232316AbiFSKwP (ORCPT ); Sun, 19 Jun 2022 06:52:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAEB510FE1; Sun, 19 Jun 2022 03:52:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9DF4AB80D22; Sun, 19 Jun 2022 10:52:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14CB1C34114; Sun, 19 Jun 2022 10:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655635932; bh=7OWf8G0jMiKkIOyazPpTYHLvbZq8teEs+PZVbvDwI6Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rVQRKLTdruRR6l4WvRrlC19nxkgW8EIkCQ2gqqYtXUUhFJiH1zLJwD6vbS//J8kC9 44D/E1gNGoxLsOgXOvx+MiE1CN+Y+r6FtHtkIVD8xoC48AFFXYLATO6VzXx/4dYDSy DCdoxxbLUKoFriC43ZMHV9Asit/4Lr9bCgl4B8w+sh3HIwdjK1u5RL9sUPDkuuMF0j idn0/fCc560VvXDkdCoAf47ghxKd+fgqtC/q4RKc7yhglIHtY+Np+LLTtcxPauJMxt wXJK5FbTrlA8UQVzC56+25tCg9ofu9tHQfbpV9jn2869QABEU+uGtTx462oCqgkbsH 142+V6S9BsF1Q== Date: Sun, 19 Jun 2022 12:01:26 +0100 From: Jonathan Cameron To: Chen-Yu Tsai Cc: Aidan MacDonald , Linus Walleij , Bartosz Golaszewski , Rob Herring , krzysztof.kozlowski+dt@linaro.org, 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" Subject: Re: [PATCH v3 10/16] iio: adc: axp20x_adc: Minor code cleanups Message-ID: <20220619120126.54d0b586@jic23-huawei> In-Reply-To: References: <20220618214009.2178567-1-aidanmacdonald.0x0@gmail.com> <20220618214009.2178567-11-aidanmacdonald.0x0@gmail.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Sun, 19 Jun 2022 11:56:56 +0800 Chen-Yu Tsai wrote: > 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 With Chen-Yu's suggested changes, Reviewed-by: Jonathan Cameron Thanks, Jonathan