[PATCH 6/8] iio:magnetometer:bmc150_magn: protect runtime_resume with mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Protect bmc150_magn_runtime_resume() with a mutex, as done with other
suspend/resume functions.

Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx>
---
 drivers/iio/magnetometer/bmc150_magn.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c
index e1f804b2b244..ac0cdbde813b 100644
--- a/drivers/iio/magnetometer/bmc150_magn.c
+++ b/drivers/iio/magnetometer/bmc150_magn.c
@@ -1052,9 +1052,14 @@ static int bmc150_magn_runtime_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct bmc150_magn_data *data = iio_priv(indio_dev);
+	int ret;
 
-	return bmc150_magn_set_power_mode(data, BMC150_MAGN_POWER_MODE_NORMAL,
-					  true);
+	mutex_lock(&data->mutex);
+	ret = bmc150_magn_set_power_mode(data, BMC150_MAGN_POWER_MODE_NORMAL,
+					 true);
+	mutex_unlock(&data->mutex);
+
+	return ret;
 }
 #endif
 
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux