Linux IIO development
 help / color / mirror / Atom feed
From: "Maxwell Doose" <m32285159@gmail.com>
To: "Caio Groff" <caio.groff@usp.br>, <nuno.sa@analog.com>,
	<Michael.Hennerich@analog.com>, <marcelo.schmitt@analog.com>,
	<antoniu.miclaus@analog.com>, <jic23@kernel.org>,
	<dlechner@baylibre.com>, <andy@kernel.org>
Cc: <linux@analog.com>, <linux-iio@vger.kernel.org>
Subject: Re: [PATCH] iio: accel: adxl372: replace manual bitfield ops with FIELD_GET()
Date: Tue, 07 Jul 2026 21:50:58 -0500	[thread overview]
Message-ID: <DJSUK8KQCYNB.1G3P4VAWBFBD1@gmail.com> (raw)
In-Reply-To: <20260708013002.1377142-1-caio.groff@usp.br>

[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]

On Tue Jul 7, 2026 at 8:29 PM CDT
Caio Groff <caio.groff@usp.br> wrote:

> From: Caio Groff <caio.groff@usp.br>
>
> Replace manual bit shifting and masking with FIELD_GET()
> macros for clarity and consistency with kernel coding style.
>
> Signed-off-by: Caio Groff <caio.groff@usp.br>
> ---
>  drivers/iio/accel/adxl372.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/accel/adxl372.c b/drivers/iio/accel/adxl372.c
> index e375d068a3f5..fb985bfeb19f 100644
> --- a/drivers/iio/accel/adxl372.c
> +++ b/drivers/iio/accel/adxl372.c
> @@ -150,6 +150,11 @@
>  #define ADXL372_Y_AXIS_EN(x)			((x) & BIT(1))
>  #define ADXL372_Z_AXIS_EN(x)			((x) & BIT(2))
>  
> +/* ADXL372_TIME_INACT */
> +#define ADXL372_TIME_INACT_MASK_H  GENMASK(15, 8)
> +#define ADXL372_TIME_INACT_MASK_L  GENMASK(7, 0)
> +
> +
>  /*
>   * At +/- 200g with 12-bit resolution, scale is computed as:
>   * (200 + 200) * 9.81 / (2^12 - 1) = 0.958241
> @@ -577,9 +582,8 @@ static int adxl372_set_inactivity_time_ms(struct adxl372_state *st,
>  		scale_factor = st->chip_info->inact_time_scale_low_ms;
>  
>  	res = DIV_ROUND_CLOSEST(inact_time_ms, scale_factor);
> -	reg_val_h = (res >> 8) & 0xFF;
> -	reg_val_l = res & 0xFF;
> -
> +	reg_val_h = FIELD_GET(ADXL372_TIME_INACT_MASK_H, res);
> +	reg_val_l = FIELD_GET(ADXL372_TIME_INACT_MASK_L, res);
+ missing a blank line.
>  	ret = regmap_write(st->regmap, ADXL372_TIME_INACT_H, reg_val_h);
>  	if (ret < 0)
>  		return ret;

Regardless,

Reviewed-by: Maxwell Doose <m32285159@gmail.com>

-- 
best regards,
max

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

  reply	other threads:[~2026-07-08  2:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  1:29 [PATCH] iio: accel: adxl372: replace manual bitfield ops with FIELD_GET() Caio Groff
2026-07-08  2:50 ` Maxwell Doose [this message]
2026-07-08  6:26 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DJSUK8KQCYNB.1G3P4VAWBFBD1@gmail.com \
    --to=m32285159@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=caio.groff@usp.br \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox