Skip to contentSkip to conversation

staging: adis16203: Remove locking on raw reads of IIO_CHAN_INFO_CALIBBIAS

PATCH RESEND In review Gargi Sharma 2 participants 2 messages Mar 21, 2017

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

PATCH RESEND 1/1 staging: adis16203: Remove locking on raw reads of IIO_CHAN_INFO_CALIBBIAS

adis16203_read_raw does not need lock for IIO_CHAN_INFO_CALIBBIAS since adis_read_reg_16 is already atomic and nothing else needs to be protected.

---
 drivers/staging/iio/accel/adis16203.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/iio/accel/adis16203.c +0 -3
index 68189ad..14fe2d3 100644
@@ -203,17 +203,14 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_CALIBBIAS:
 		bits = 14;
-		mutex_lock(&indio_dev->mlock);
 		addr = adis16203_addresses[chan->scan_index];
 		ret = adis_read_reg_16(st, addr, &val16);
 		if (ret) {
-			mutex_unlock(&indio_dev->mlock);
 			return ret;
 		}
 		val16 &= (1 << bits) - 1;
 		val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
 		*val = val16;
-		mutex_unlock(&indio_dev->mlock);
 		return IIO_VAL_INT;
 	default:
 		return -EINVAL;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Gargi Sharma

adis16203_read_raw does not need lock for IIO_CHAN_INFO_CALIBBIAS since adis_read_reg_16 is already atomic and nothing else needs to be protected.

Just sent yesterday too!

Quoted 35 lines
---
 drivers/staging/iio/accel/adis16203.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/iio/accel/adis16203.c +0 -3
index 68189ad..14fe2d3 100644
@@ -203,17 +203,14 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_CALIBBIAS:
 		bits = 14;
-		mutex_lock(&indio_dev->mlock);
 		addr = adis16203_addresses[chan->scan_index];
 		ret = adis_read_reg_16(st, addr, &val16);
 		if (ret) {
-			mutex_unlock(&indio_dev->mlock);
 			return ret;
 		}
 		val16 &= (1 << bits) - 1;
 		val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
 		*val = val16;
-		mutex_unlock(&indio_dev->mlock);
 		return IIO_VAL_INT;
 	default:
 		return -EINVAL;
Signature · 8 lines
2.7.4

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1490112126-30265-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.