Skip to contentSkip to conversation

iio: dac: ad3552r: use field_get() for power-down bit read

PATCH In review Piyush Patle 3 participants 4 messages Apr 11 – Apr 20

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: dac: ad3552r: use field_get() for power-down bit read

Use field_get() for the per-channel DAC power-down bit instead of an open-coded mask-and-shift sequence.

No functional change.

---
 drivers/iio/dac/ad3552r.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/dac/ad3552r.c +1 -2
index 93c33bc3e1be..f206bba3a701 100644
@@ -167,8 +167,7 @@ static int ad3552r_read_raw(struct iio_dev *indio_dev,
 		mutex_unlock(&dac->lock);
 		if (err < 0)
 			return err;
-		*val = !((tmp_val & AD3552R_MASK_CH_DAC_POWERDOWN(ch)) >>
-			  __ffs(AD3552R_MASK_CH_DAC_POWERDOWN(ch)));
+		*val = !field_get(AD3552R_MASK_CH_DAC_POWERDOWN(ch), tmp_val);
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_SCALE:
 		*val = dac->ch_data[ch].scale_int;
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Piyush Patle

Use field_get() for the per-channel DAC power-down bit instead of an open-coded mask-and-shift sequence.

No functional change.

---

Quoted 17 lines

 drivers/iio/dac/ad3552r.c | 3 +--

 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/dac/ad3552r.c +1 -2
index 93c33bc3e1be..f206bba3a701 100644
@@ -167,8 +167,7 @@ static int ad3552r_read_raw(struct iio_dev *indio_dev,
  		mutex_unlock(&dac->lock);
  		if (err < 0)
  			return err;
-		*val = !((tmp_val & AD3552R_MASK_CH_DAC_POWERDOWN(ch)) >>
-			  __ffs(AD3552R_MASK_CH_DAC_POWERDOWN(ch)));
+		*val = !field_get(AD3552R_MASK_CH_DAC_POWERDOWN(ch), tmp_val);
  		return IIO_VAL_INT;

  case IIO_CHAN_INFO_SCALE:
  *val = dac->ch_data[ch].scale_int;

#2 lore raw
Quoted 15 lines · Nuno Sá
Quoted 7 lines · Piyush Patle

Use field_get() for the per-channel DAC power-down bit instead of an open-coded mask-and-shift sequence.

No functional change.

---

Quoted 3 lines
 drivers/iio/dac/ad3552r.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 14 lines
Quoted 5 lines
drivers/iio/dac/ad3552r.c +0 -0
index 93c33bc3e1be..f206bba3a701 100644

drivers/iio/dac/ad3552r.c static int ad3552r_read_raw(struct iio_dev *indio_dev, · line 173

Quoted 9 lines
drivers/iio/dac/ad3552r.c +1 -2
@@ -167,8 +167,7 @@ static int ad3552r_read_raw(struct iio_dev *indio_dev,
              mutex_unlock(&dac->lock);
              if (err < 0)
                      return err;
-             *val = !((tmp_val & AD3552R_MASK_CH_DAC_POWERDOWN(ch)) >>
-                       __ffs(AD3552R_MASK_CH_DAC_POWERDOWN(ch)));
+             *val = !field_get(AD3552R_MASK_CH_DAC_POWERDOWN(ch), tmp_val);
              return IIO_VAL_INT;
      case IIO_CHAN_INFO_SCALE:
              *val = dac->ch_data[ch].scale_int;

Hi,
Gentle ping on this patch.

I’d appreciate any feedback whenever you get time, or let me know if I should resend/rework anything.

Regards,
Piyush

maintainer
#3 lore raw
Quoted 34 lines · On Sun, 19 Apr 2026 22:27:29 +0530 Piyush Patle <[email protected]>…
Quoted 15 lines · Nuno Sá
Quoted 7 lines · Piyush Patle

Use field_get() for the per-channel DAC power-down bit instead of an open-coded mask-and-shift sequence.

No functional change.

---

Quoted 3 lines
 drivers/iio/dac/ad3552r.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 14 lines
Quoted 5 lines
drivers/iio/dac/ad3552r.c +0 -0
index 93c33bc3e1be..f206bba3a701 100644

drivers/iio/dac/ad3552r.c static int ad3552r_read_raw(struct iio_dev *indio_dev, · line 173

Quoted 9 lines
drivers/iio/dac/ad3552r.c +1 -2
@@ -167,8 +167,7 @@ static int ad3552r_read_raw(struct iio_dev *indio_dev,
              mutex_unlock(&dac->lock);
              if (err < 0)
                      return err;
-             *val = !((tmp_val & AD3552R_MASK_CH_DAC_POWERDOWN(ch)) >>
-                       __ffs(AD3552R_MASK_CH_DAC_POWERDOWN(ch)));
+             *val = !field_get(AD3552R_MASK_CH_DAC_POWERDOWN(ch), tmp_val);
              return IIO_VAL_INT;
      case IIO_CHAN_INFO_SCALE:
              *val = dac->ch_data[ch].scale_int;  

Hi,
Gentle ping on this patch.

Quoted 2 lines

I’d appreciate any feedback whenever you get time, or let me know if I should resend/rework anything.

General rule is wait 2 weeks before this sort of email.
You can also check status in patchwork to see if I've gotten to it yet.
https://patchwork.kernel.org/project/linux-iio/list/?

On this particular occasion life got unusually busy so I'm a few weeks behind and working backwards through my backlog to catch up.

Applied to the testing branch of iio.git.

Jonathan

Quoted 4 lines

Regards,
Piyush