From 6a4d6a7d6588d8c15501542da786ebff6602475c Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 22 Nov 2019 15:24:14 +0200 Subject: iio: imu: adis: create an unlocked version of adis_check_status() This one also gets re-used in certain operations, so it makes sense to have an unlocked version of this to group it with other reads/writes/operations to have a single lock for the whole state change. Signed-off-by: Alexandru Ardelean Signed-off-by: Jonathan Cameron --- include/linux/iio/imu/adis.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include/linux/iio') diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index 38ebe41092e1..db759957e1c1 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -267,7 +267,18 @@ static inline int adis_read_reg_32(struct adis *adis, unsigned int reg, } int adis_enable_irq(struct adis *adis, bool enable); -int adis_check_status(struct adis *adis); +int __adis_check_status(struct adis *adis); + +static inline int adis_check_status(struct adis *adis) +{ + int ret; + + mutex_lock(&adis->state_lock); + ret = __adis_check_status(adis); + mutex_unlock(&adis->state_lock); + + return ret; +} int adis_initial_startup(struct adis *adis); -- cgit v1.2.3