Linux IIO development
 help / color / mirror / Atom feed
From: Rafael Lopes Santana <santanarl@usp.br>
To: jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org
Cc: Rafael Lopes Santana <santanarl@usp.br>, linux-iio@vger.kernel.org
Subject: [PATCH] Replace manual bitfield manipulations with field_get
Date: Thu, 30 Apr 2026 22:15:46 -0300	[thread overview]
Message-ID: <20260501011548.15369-1-santanarl@usp.br> (raw)

From: Rafael Lopes Santana <santanarl@usp.br>

Signed-off-by: Rafael Lopes Santana <santanarl@usp.br>
---
 drivers/iio/proximity/aw96103.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/proximity/aw96103.c b/drivers/iio/proximity/aw96103.c
index 3472a2c36e44..a8a6ae02438a 100644
--- a/drivers/iio/proximity/aw96103.c
+++ b/drivers/iio/proximity/aw96103.c
@@ -591,7 +591,7 @@ static void aw96103_cfg_update(const struct firmware *fw, void *data)
 	}
 
 	for (i = 0; i < aw96103->max_channels; i++) {
-		if ((aw96103->chan_en >> i) & 0x01)
+		if ((field_get(BIT(i), aw96103->chan_en)))
 			aw96103->channels_arr[i].used = true;
 		else
 			aw96103->channels_arr[i].used = false;
@@ -643,10 +643,10 @@ static irqreturn_t aw96103_irq(int irq, void *data)
 		if (!aw96103->channels_arr[i].used)
 			continue;
 
-		curr_status = (((curr_status_val >> (24 + i)) & 0x1)) |
-			      (((curr_status_val >> (16 + i)) & 0x1) << 1) |
-			      (((curr_status_val >> (8 + i)) & 0x1) << 2) |
-			      (((curr_status_val >> i) & 0x1) << 3);
+		curr_status = (field_get(BIT(24+i), curr_status_val)) |
+			      ((field_get(BIT(16+i), curr_status_val)) << 1) |
+			      ((field_get(BIT(8+i), curr_status_val)) << 2) |
+			      ((field_get(BIT(i), curr_status_val)) << 3);
 		if (aw96103->channels_arr[i].old_irq_status == curr_status)
 			continue;
 
-- 
2.53.0


             reply	other threads:[~2026-05-01  1:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01  1:15 Rafael Lopes Santana [this message]
2026-05-01 12:30 ` [PATCH] Replace manual bitfield manipulations with field_get Andy Shevchenko
2026-05-01 14:34 ` Joshua Crofts
2026-05-01 14:38   ` Joshua Crofts
2026-05-01 18:18     ` Andy Shevchenko
2026-05-01 18:41       ` Joshua Crofts
2026-05-01 18:47         ` Andy Shevchenko
2026-05-05 12:16 ` Jonathan Cameron
2026-05-05 13:52   ` David Lechner
2026-05-05 16:14     ` Jonathan Cameron

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=20260501011548.15369-1-santanarl@usp.br \
    --to=santanarl@usp.br \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --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