Commit c5485a5d authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron

iio: imu: adis: group single conversion under a single state lock

The single conversion function does a series of reads + writes. This change
extends the use of the state_lock for the entire set of operations.
Previously, indio_dev's mlock was used. This change also removes the use of
this lock.
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent cb5a07f1
...@@ -404,15 +404,15 @@ int adis_single_conversion(struct iio_dev *indio_dev, ...@@ -404,15 +404,15 @@ int adis_single_conversion(struct iio_dev *indio_dev,
unsigned int uval; unsigned int uval;
int ret; int ret;
mutex_lock(&indio_dev->mlock); mutex_lock(&adis->state_lock);
ret = adis_read_reg(adis, chan->address, &uval, ret = __adis_read_reg(adis, chan->address, &uval,
chan->scan_type.storagebits / 8); chan->scan_type.storagebits / 8);
if (ret) if (ret)
goto err_unlock; goto err_unlock;
if (uval & error_mask) { if (uval & error_mask) {
ret = adis_check_status(adis); ret = __adis_check_status(adis);
if (ret) if (ret)
goto err_unlock; goto err_unlock;
} }
...@@ -424,7 +424,7 @@ int adis_single_conversion(struct iio_dev *indio_dev, ...@@ -424,7 +424,7 @@ int adis_single_conversion(struct iio_dev *indio_dev,
ret = IIO_VAL_INT; ret = IIO_VAL_INT;
err_unlock: err_unlock:
mutex_unlock(&indio_dev->mlock); mutex_unlock(&adis->state_lock);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(adis_single_conversion); EXPORT_SYMBOL_GPL(adis_single_conversion);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment