From 3f17ada8f38c57b6c81d41db6d911932b280d5b5 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Mon, 10 Feb 2020 15:26:01 +0200 Subject: iio: imu: adis: add unlocked __adis_initial_startup() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change splits the __adis_initial_startup() away from adis_initial_startup(). The unlocked version can be used in certain calls during probe, where races won't happen since the ADIS driver may not be registered yet with IIO. Signed-off-by: Nuno Sá Signed-off-by: Alexandru Ardelean Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'drivers/iio/imu/adis.c') diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c index 022bb54fb748..e4897dad34ab 100644 --- a/drivers/iio/imu/adis.c +++ b/drivers/iio/imu/adis.c @@ -365,7 +365,7 @@ static int adis_self_test(struct adis *adis) } /** - * adis_inital_startup() - Performs device self-test + * __adis_initial_startup() - Device initial setup * @adis: The adis device * * Returns 0 if the device is operational, a negative error code otherwise. @@ -373,28 +373,22 @@ static int adis_self_test(struct adis *adis) * This function should be called early on in the device initialization sequence * to ensure that the device is in a sane and known state and that it is usable. */ -int adis_initial_startup(struct adis *adis) +int __adis_initial_startup(struct adis *adis) { int ret; - mutex_lock(&adis->state_lock); - ret = adis_self_test(adis); if (ret) { dev_err(&adis->spi->dev, "Self-test failed, trying reset.\n"); __adis_reset(adis); ret = adis_self_test(adis); - if (ret) { + if (ret) dev_err(&adis->spi->dev, "Second self-test failed, giving up.\n"); - goto out_unlock; - } } -out_unlock: - mutex_unlock(&adis->state_lock); return ret; } -EXPORT_SYMBOL_GPL(adis_initial_startup); +EXPORT_SYMBOL_GPL(__adis_initial_startup); /** * adis_single_conversion() - Performs a single sample conversion -- cgit v1.2.3