From 15aacc980dcb326ef33dfc32772faea1067f9178 Mon Sep 17 00:00:00 2001 From: Nuno Sa Date: Thu, 18 Feb 2021 12:40:39 +0100 Subject: 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 Link: https://lore.kernel.org/r/20210218114039.216091-5-nuno.sa@analog.com Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis16475.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/iio/imu/adis16475.c') 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; } -- cgit v1.2.3