Skip to contentSkip to conversation

patch "iio:st_sensors: Fix oops when probing SPI devices" added to staging-linus

PATCH [email protected] 1 participant 1 message May 13, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

iio:st_sensors: Fix oops when probing SPI devices

to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 8e71c04f863a1754f21b27fb8ecb773d680a0a80 Mon Sep 17 00:00:00 2001

From: Alban Bedel <[email protected]>
Date: Mon, 20 Apr 2015 13:57:18 +0200
Subject: iio:st_sensors: Fix oops when probing SPI devices

In SPI mode the transfer buffer is locked with a mutex. However this mutex is only initilized after the probe, but some transfer needs to be done in the probe.

To fix this bug we move the mutex initialization at the beginning of the device probe.

---
 drivers/iio/accel/st_accel_core.c               | 1 +
 drivers/iio/common/st_sensors/st_sensors_core.c | 2 --
 drivers/iio/gyro/st_gyro_core.c                 | 1 +
 drivers/iio/magnetometer/st_magn_core.c         | 1 +
 drivers/iio/pressure/st_pressure_core.c         | 1 +
 5 files changed, 4 insertions(+), 2 deletions(-)
drivers/iio/accel/st_accel_core.c +1 -0
index 58d1d13d552a..211b13271c61 100644
@@ -546,6 +546,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &accel_info;
+	mutex_init(&adata->tb.buf_lock);
 
 	st_sensors_power_enable(indio_dev);
 
drivers/iio/common/st_sensors/st_sensors_core.c +0 -2
index edd13d2b4121..8dd0477e201c 100644
@@ -304,8 +304,6 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 	struct st_sensors_platform_data *of_pdata;
 	int err = 0;
 
-	mutex_init(&sdata->tb.buf_lock);
-
 	/* If OF/DT pdata exists, it will take precedence of anything else */
 	of_pdata = st_sensors_of_probe(indio_dev->dev.parent, pdata);
 	if (of_pdata)
drivers/iio/gyro/st_gyro_core.c +1 -0
index 21395f26d227..ffe96642b6d0 100644
@@ -400,6 +400,7 @@ int st_gyro_common_probe(struct iio_dev *indio_dev)
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &gyro_info;
+	mutex_init(&gdata->tb.buf_lock);
 
 	st_sensors_power_enable(indio_dev);
 
drivers/iio/magnetometer/st_magn_core.c +1 -0
index 8ade473f99fe..2e56f812a644 100644
@@ -369,6 +369,7 @@ int st_magn_common_probe(struct iio_dev *indio_dev)
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &magn_info;
+	mutex_init(&mdata->tb.buf_lock);
 
 	st_sensors_power_enable(indio_dev);
 
drivers/iio/pressure/st_pressure_core.c +1 -0
index 97baf40d424b..e881fa6291e9 100644
@@ -417,6 +417,7 @@ int st_press_common_probe(struct iio_dev *indio_dev)
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &press_info;
+	mutex_init(&press_data->tb.buf_lock);
 
 	st_sensors_power_enable(indio_dev);
 
Signature · 1 line
2.4.0