summaryrefslogtreecommitdiffstats
path: root/drivers/iio/imu/adis.c
diff options
context:
space:
mode:
authorAlexandru Ardelean <alexandru.ardelean@analog.com>2019-11-22 15:24:11 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-11-23 11:53:10 +0000
commit6a9afcb198b4de323485c0ee94ff09f653012d4b (patch)
tree45ddd7b79aa92fa9ab0f4c24a5cb1802575492fc /drivers/iio/imu/adis.c
parenta33db9475a3c7b6855c67d144dfa93a623b66cec (diff)
downloadlinux-stable-6a9afcb198b4de323485c0ee94ff09f653012d4b.tar.gz
linux-stable-6a9afcb198b4de323485c0ee94ff09f653012d4b.tar.bz2
linux-stable-6a9afcb198b4de323485c0ee94ff09f653012d4b.zip
iio: imu: adis: rename txrx_lock -> state_lock
The lock can be extended a bit to protect other elements that are not particular to just TX/RX. Another idea would have been to just add a new `state_lock`, but that would mean 2 locks which would be redundant, and probably cause more potential for dead-locks. What will be done in the next patches, will be to add some unlocked versions for read/write_reg functions. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/imu/adis.c')
-rw-r--r--drivers/iio/imu/adis.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
index 85de565a4e80..db562fec79b2 100644
--- a/drivers/iio/imu/adis.c
+++ b/drivers/iio/imu/adis.c
@@ -70,7 +70,7 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
},
};
- mutex_lock(&adis->txrx_lock);
+ mutex_lock(&adis->state_lock);
spi_message_init(&msg);
@@ -114,7 +114,7 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
}
out_unlock:
- mutex_unlock(&adis->txrx_lock);
+ mutex_unlock(&adis->state_lock);
return ret;
}
@@ -166,7 +166,7 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
},
};
- mutex_lock(&adis->txrx_lock);
+ mutex_lock(&adis->state_lock);
spi_message_init(&msg);
if (adis->current_page != page) {
@@ -211,7 +211,7 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
}
out_unlock:
- mutex_unlock(&adis->txrx_lock);
+ mutex_unlock(&adis->state_lock);
return ret;
}
@@ -438,7 +438,7 @@ EXPORT_SYMBOL_GPL(adis_single_conversion);
int adis_init(struct adis *adis, struct iio_dev *indio_dev,
struct spi_device *spi, const struct adis_data *data)
{
- mutex_init(&adis->txrx_lock);
+ mutex_init(&adis->state_lock);
adis->spi = spi;
adis->data = data;
iio_device_set_drvdata(indio_dev, adis);