Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] Replace manual bitfield manipulations with field_get
@ 2026-05-01  1:15 Rafael Lopes Santana
  2026-05-01 12:30 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Rafael Lopes Santana @ 2026-05-01  1:15 UTC (permalink / raw)
  To: jic23, dlechner, nuno.sa, andy; +Cc: Rafael Lopes Santana, linux-iio

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-05-05 16:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-01  1:15 [PATCH] Replace manual bitfield manipulations with field_get Rafael Lopes Santana
2026-05-01 12:30 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox