[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGb2v65PLTcy53zjHA83qAaNq4y-Mmxfv4xvSuwqRLGBiwgjDQ@mail.gmail.com>
Date: Sun, 19 Jun 2022 11:56:56 +0800
From: Chen-Yu Tsai <wens@...e.org>
To: Aidan MacDonald <aidanmacdonald.0x0@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Rob Herring <robh+dt@...nel.org>,
krzysztof.kozlowski+dt@...aro.org,
Jonathan Cameron <jic23@...nel.org>,
Lee Jones <lee.jones@...aro.org>,
Sebastian Reichel <sre@...nel.org>,
Mark Brown <broonie@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Liam Girdwood <lgirdwood@...il.com>,
Lars-Peter Clausen <lars@...afoo.de>,
"Rafael J . Wysocki" <rafael@...nel.org>, quic_gurus@...cinc.com,
sebastian.reichel@...labora.com,
Andy Shevchenko <andy.shevchenko@...il.com>, michael@...le.cc,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-iio@...r.kernel.org,
"open list:THERMAL" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v3 10/16] iio: adc: axp20x_adc: Minor code cleanups
On Sun, Jun 19, 2022 at 5:40 AM Aidan MacDonald
<aidanmacdonald.0x0@...il.com> 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 <jic23@...nel.org>
> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@...il.com>
> ---
> 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 <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/thermal.h>
> +#include <linux/bitfield.h>
Sort this group of headers alphabetically please.
>
> #include <linux/iio/iio.h>
> #include <linux/iio/driver.h>
> @@ -22,20 +23,20 @@
> #include <linux/mfd/axp20x.h>
>
> #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 <wens@...e.org>
Powered by blists - more mailing lists