summaryrefslogtreecommitdiffstats
path: root/drivers/iio/imu/adis16475.c
diff options
context:
space:
mode:
authorNuno Sa <nuno.sa@analog.com>2021-02-18 12:40:39 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-03-11 20:47:12 +0000
commit15aacc980dcb326ef33dfc32772faea1067f9178 (patch)
tree82ee6c255be66febf1c567e94d8b31a1399ed41d /drivers/iio/imu/adis16475.c
parent3b15e6a532b30691e7c464e7d74c2d699c23d439 (diff)
downloadlinux-stable-15aacc980dcb326ef33dfc32772faea1067f9178.tar.gz
linux-stable-15aacc980dcb326ef33dfc32772faea1067f9178.tar.bz2
linux-stable-15aacc980dcb326ef33dfc32772faea1067f9178.zip
iio: adis: add helpers for locking
Add some helpers to lock and unlock the device. As this is such a simple change, we update all the users that were using the lock already in this patch. Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20210218114039.216091-5-nuno.sa@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/imu/adis16475.c')
-rw-r--r--drivers/iio/imu/adis16475.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/iio/imu/adis16475.c b/drivers/iio/imu/adis16475.c
index 5759cd8ffbef..8f6bea4b6608 100644
--- a/drivers/iio/imu/adis16475.c
+++ b/drivers/iio/imu/adis16475.c
@@ -263,7 +263,7 @@ static int adis16475_get_freq(struct adis16475 *st, u32 *freq)
u16 dec;
u32 sample_rate = st->clk_freq;
- mutex_lock(&st->adis.state_lock);
+ adis_dev_lock(&st->adis);
if (st->sync_mode == ADIS16475_SYNC_SCALED) {
u16 sync_scale;
@@ -279,13 +279,13 @@ static int adis16475_get_freq(struct adis16475 *st, u32 *freq)
if (ret)
goto error;
- mutex_unlock(&st->adis.state_lock);
+ adis_dev_unlock(&st->adis);
*freq = DIV_ROUND_CLOSEST(sample_rate, dec + 1);
return 0;
error:
- mutex_unlock(&st->adis.state_lock);
+ adis_dev_unlock(&st->adis);
return ret;
}
@@ -298,7 +298,7 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq)
if (!freq)
return -EINVAL;
- mutex_lock(&st->adis.state_lock);
+ adis_dev_lock(&st->adis);
/*
* When using sync scaled mode, the input clock needs to be scaled so that we have
* an IMU sample rate between (optimally) 1900 and 2100. After this, we can use the
@@ -366,7 +366,7 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq)
return 0;
error:
- mutex_unlock(&st->adis.state_lock);
+ adis_dev_unlock(&st->adis);
return ret;
}