Skip to contentSkip to conversation

Fix buffers registrations in order to use generic IIO trigger

PATCH Applied Denis CIOCCA 3 participants 12 messages Sep 18, 2013 – Sep 23, 2013 IIO

lore
Share & tools
lore
#0 lore raw

Hi All,

This patches fix buffers registrations in order to use generic IIO trigger. Thanks,

Denis

#1 lore raw

PATCH 1/4 iio:accel: Register buffer also without specific trigger

This patch fix buffer registration that allows to use generic IIO trigger.

---
 drivers/iio/accel/st_accel_core.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/iio/accel/st_accel_core.c +9 -10
index 1458343..1bbdc8f 100644
@@ -480,13 +480,13 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto st_accel_common_probe_error;
 
-	if (adata->get_irq_data_ready(indio_dev) > 0) {
-		err = st_accel_allocate_ring(indio_dev);
-		if (err < 0)
-			goto st_accel_common_probe_error;
+	err = st_accel_allocate_ring(indio_dev);
+	if (err < 0)
+		goto st_accel_common_probe_error;
 
+	if (adata->get_irq_data_ready(indio_dev) > 0) {
 		err = st_sensors_allocate_trigger(indio_dev,
-						 ST_ACCEL_TRIGGER_OPS);
+							ST_ACCEL_TRIGGER_OPS);
 		if (err < 0)
 			goto st_accel_probe_trigger_error;
 	}
@@ -501,8 +501,7 @@ st_accel_device_register_error:
 	if (adata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
 st_accel_probe_trigger_error:
-	if (adata->get_irq_data_ready(indio_dev) > 0)
-		st_accel_deallocate_ring(indio_dev);
+	st_accel_deallocate_ring(indio_dev);
 st_accel_common_probe_error:
 	return err;
 }
@@ -513,10 +512,10 @@ void st_accel_common_remove(struct iio_dev *indio_dev)
 	struct st_sensor_data *adata = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
-	if (adata->get_irq_data_ready(indio_dev) > 0) {
+	if (adata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
-		st_accel_deallocate_ring(indio_dev);
-	}
+
+	st_accel_deallocate_ring(indio_dev);
 }
 EXPORT_SYMBOL(st_accel_common_remove);
 
Signature · 1 line
1.7.9.5
maintainer Applied
#2 lore raw

Re: [PATCH 1/4] iio:accel: Register buffer also without specific trigger

Quoted 3 lines · Denis CIOCCA

This patch fix buffer registration that allows to use generic IIO trigger.

Applied to the togreg branch of iio.git with the tiny changes needed to make this apply on top of Lee's patch set.

Please do take a quick look to check I didn't mess it up!

Quoted 52 lines
---
 drivers/iio/accel/st_accel_core.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/iio/accel/st_accel_core.c +9 -10
index 1458343..1bbdc8f 100644
@@ -480,13 +480,13 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto st_accel_common_probe_error;
 
-	if (adata->get_irq_data_ready(indio_dev) > 0) {
-		err = st_accel_allocate_ring(indio_dev);
-		if (err < 0)
-			goto st_accel_common_probe_error;
+	err = st_accel_allocate_ring(indio_dev);
+	if (err < 0)
+		goto st_accel_common_probe_error;
 
+	if (adata->get_irq_data_ready(indio_dev) > 0) {
 		err = st_sensors_allocate_trigger(indio_dev,
-						 ST_ACCEL_TRIGGER_OPS);
+							ST_ACCEL_TRIGGER_OPS);
 		if (err < 0)
 			goto st_accel_probe_trigger_error;
 	}
@@ -501,8 +501,7 @@ st_accel_device_register_error:
 	if (adata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
 st_accel_probe_trigger_error:
-	if (adata->get_irq_data_ready(indio_dev) > 0)
-		st_accel_deallocate_ring(indio_dev);
+	st_accel_deallocate_ring(indio_dev);
 st_accel_common_probe_error:
 	return err;
 }
@@ -513,10 +512,10 @@ void st_accel_common_remove(struct iio_dev *indio_dev)
 	struct st_sensor_data *adata = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
-	if (adata->get_irq_data_ready(indio_dev) > 0) {
+	if (adata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
-		st_accel_deallocate_ring(indio_dev);
-	}
+
+	st_accel_deallocate_ring(indio_dev);
 }
 EXPORT_SYMBOL(st_accel_common_remove);
 
#3 lore raw

PATCH 2/4 iio:gyro: Register buffer also without specific trigger

In reply to Denis CIOCCA

This patch fix buffer registration that allows to use generic IIO trigger.

---
 drivers/iio/gyro/st_gyro_core.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/iio/gyro/st_gyro_core.c +9 -10
index e13c2b0..8a45d43 100644
@@ -329,13 +329,13 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto st_gyro_common_probe_error;
 
-	if (gdata->get_irq_data_ready(indio_dev) > 0) {
-		err = st_gyro_allocate_ring(indio_dev);
-		if (err < 0)
-			goto st_gyro_common_probe_error;
+	err = st_gyro_allocate_ring(indio_dev);
+	if (err < 0)
+		goto st_gyro_common_probe_error;
 
+	if (gdata->get_irq_data_ready(indio_dev) > 0) {
 		err = st_sensors_allocate_trigger(indio_dev,
-						  ST_GYRO_TRIGGER_OPS);
+							ST_GYRO_TRIGGER_OPS);
 		if (err < 0)
 			goto st_gyro_probe_trigger_error;
 	}
@@ -350,8 +350,7 @@ st_gyro_device_register_error:
 	if (gdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
 st_gyro_probe_trigger_error:
-	if (gdata->get_irq_data_ready(indio_dev) > 0)
-		st_gyro_deallocate_ring(indio_dev);
+	st_gyro_deallocate_ring(indio_dev);
 st_gyro_common_probe_error:
 	return err;
 }
@@ -362,10 +361,10 @@ void st_gyro_common_remove(struct iio_dev *indio_dev)
 	struct st_sensor_data *gdata = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
-	if (gdata->get_irq_data_ready(indio_dev) > 0) {
+	if (gdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
-		st_gyro_deallocate_ring(indio_dev);
-	}
+
+	st_gyro_deallocate_ring(indio_dev);
 }
 EXPORT_SYMBOL(st_gyro_common_remove);
 
Signature · 1 line
1.7.9.5
maintainer
#4 lore raw

Re: [PATCH 2/4] iio:gyro: Register buffer also without specific trigger

Quoted 3 lines · Denis CIOCCA

This patch fix buffer registration that allows to use generic IIO trigger.

Forward ported and applied to the togreg branch of iio.git

Quoted 52 lines
---
 drivers/iio/gyro/st_gyro_core.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/iio/gyro/st_gyro_core.c +9 -10
index e13c2b0..8a45d43 100644
@@ -329,13 +329,13 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto st_gyro_common_probe_error;
 
-	if (gdata->get_irq_data_ready(indio_dev) > 0) {
-		err = st_gyro_allocate_ring(indio_dev);
-		if (err < 0)
-			goto st_gyro_common_probe_error;
+	err = st_gyro_allocate_ring(indio_dev);
+	if (err < 0)
+		goto st_gyro_common_probe_error;
 
+	if (gdata->get_irq_data_ready(indio_dev) > 0) {
 		err = st_sensors_allocate_trigger(indio_dev,
-						  ST_GYRO_TRIGGER_OPS);
+							ST_GYRO_TRIGGER_OPS);
 		if (err < 0)
 			goto st_gyro_probe_trigger_error;
 	}
@@ -350,8 +350,7 @@ st_gyro_device_register_error:
 	if (gdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
 st_gyro_probe_trigger_error:
-	if (gdata->get_irq_data_ready(indio_dev) > 0)
-		st_gyro_deallocate_ring(indio_dev);
+	st_gyro_deallocate_ring(indio_dev);
 st_gyro_common_probe_error:
 	return err;
 }
@@ -362,10 +361,10 @@ void st_gyro_common_remove(struct iio_dev *indio_dev)
 	struct st_sensor_data *gdata = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
-	if (gdata->get_irq_data_ready(indio_dev) > 0) {
+	if (gdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
-		st_gyro_deallocate_ring(indio_dev);
-	}
+
+	st_gyro_deallocate_ring(indio_dev);
 }
 EXPORT_SYMBOL(st_gyro_common_remove);
 
#5 lore raw

PATCH 3/4 iio:magn: Register buffer also without specific trigger

In reply to Denis CIOCCA

This patch fix buffer registration that allows to use generic IIO trigger.

---
 drivers/iio/magnetometer/st_magn_core.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/iio/magnetometer/st_magn_core.c +8 -8
index e8d2849..0de49f8 100644
@@ -372,10 +372,11 @@ int st_magn_common_probe(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto st_magn_common_probe_error;
 
+	err = st_magn_allocate_ring(indio_dev);
+	if (err < 0)
+		goto st_magn_common_probe_error;
+
 	if (mdata->get_irq_data_ready(indio_dev) > 0) {
-		err = st_magn_allocate_ring(indio_dev);
-		if (err < 0)
-			goto st_magn_common_probe_error;
 		err = st_sensors_allocate_trigger(indio_dev, NULL);
 		if (err < 0)
 			goto st_magn_probe_trigger_error;
@@ -391,8 +392,7 @@ st_magn_device_register_error:
 	if (mdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
 st_magn_probe_trigger_error:
-	if (mdata->get_irq_data_ready(indio_dev) > 0)
-		st_magn_deallocate_ring(indio_dev);
+	st_magn_deallocate_ring(indio_dev);
 st_magn_common_probe_error:
 	return err;
 }
@@ -403,10 +403,10 @@ void st_magn_common_remove(struct iio_dev *indio_dev)
 	struct st_sensor_data *mdata = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
-	if (mdata->get_irq_data_ready(indio_dev) > 0) {
+	if (mdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
-		st_magn_deallocate_ring(indio_dev);
-	}
+
+	st_magn_deallocate_ring(indio_dev);
 }
 EXPORT_SYMBOL(st_magn_common_remove);
 
Signature · 1 line
1.7.9.5
maintainer
#6 lore raw

Re: [PATCH 3/4] iio:magn: Register buffer also without specific trigger

Quoted 3 lines · Denis CIOCCA

This patch fix buffer registration that allows to use generic IIO trigger.

Forward ported and applied to the togreg branch of iio.git

Thanks,

Jonathan

Quoted 48 lines
---
 drivers/iio/magnetometer/st_magn_core.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/iio/magnetometer/st_magn_core.c +8 -8
index e8d2849..0de49f8 100644
@@ -372,10 +372,11 @@ int st_magn_common_probe(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto st_magn_common_probe_error;
 
+	err = st_magn_allocate_ring(indio_dev);
+	if (err < 0)
+		goto st_magn_common_probe_error;
+
 	if (mdata->get_irq_data_ready(indio_dev) > 0) {
-		err = st_magn_allocate_ring(indio_dev);
-		if (err < 0)
-			goto st_magn_common_probe_error;
 		err = st_sensors_allocate_trigger(indio_dev, NULL);
 		if (err < 0)
 			goto st_magn_probe_trigger_error;
@@ -391,8 +392,7 @@ st_magn_device_register_error:
 	if (mdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
 st_magn_probe_trigger_error:
-	if (mdata->get_irq_data_ready(indio_dev) > 0)
-		st_magn_deallocate_ring(indio_dev);
+	st_magn_deallocate_ring(indio_dev);
 st_magn_common_probe_error:
 	return err;
 }
@@ -403,10 +403,10 @@ void st_magn_common_remove(struct iio_dev *indio_dev)
 	struct st_sensor_data *mdata = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
-	if (mdata->get_irq_data_ready(indio_dev) > 0) {
+	if (mdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
-		st_magn_deallocate_ring(indio_dev);
-	}
+
+	st_magn_deallocate_ring(indio_dev);
 }
 EXPORT_SYMBOL(st_magn_common_remove);
 
#7 lore raw

PATCH 4/4 iio:press: Register buffer also without specific trigger

In reply to Denis CIOCCA

This patch fix buffer registration that allows to use generic IIO trigger.

---
 drivers/iio/pressure/st_pressure_core.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/iio/pressure/st_pressure_core.c +8 -9
index 93bff9b..312a093 100644
@@ -262,11 +262,11 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto st_press_common_probe_error;
 
-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
-		err = st_press_allocate_ring(indio_dev);
-		if (err < 0)
-			goto st_press_common_probe_error;
+	err = st_press_allocate_ring(indio_dev);
+	if (err < 0)
+		goto st_press_common_probe_error;
 
+	if (pdata->get_irq_data_ready(indio_dev) > 0) {
 		err = st_sensors_allocate_trigger(indio_dev,
 							ST_PRESS_TRIGGER_OPS);
 		if (err < 0)
@@ -283,8 +283,7 @@ st_press_device_register_error:
 	if (pdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
 st_press_probe_trigger_error:
-	if (pdata->get_irq_data_ready(indio_dev) > 0)
-		st_press_deallocate_ring(indio_dev);
+	st_press_deallocate_ring(indio_dev);
 st_press_common_probe_error:
 	return err;
 }
@@ -295,10 +294,10 @@ void st_press_common_remove(struct iio_dev *indio_dev)
 	struct st_sensor_data *pdata = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
+	if (pdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
-		st_press_deallocate_ring(indio_dev);
-	}
+
+	st_press_deallocate_ring(indio_dev);
 }
 EXPORT_SYMBOL(st_press_common_remove);
 
Signature · 1 line
1.7.9.5
maintainer
#8 lore raw

Re: [PATCH 4/4] iio:press: Register buffer also without specific trigger

Quoted 3 lines · Denis CIOCCA

This patch fix buffer registration that allows to use generic IIO trigger.

Forward ported and applied to the togreg branch of iio.git Thanks,

Please do confirm I didn't do anything silly, but the port to the code Lee updated seemed trivial so I'd rather do it and clear the patches out of my queue ;)

Quoted 49 lines
---
 drivers/iio/pressure/st_pressure_core.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/iio/pressure/st_pressure_core.c +8 -9
index 93bff9b..312a093 100644
@@ -262,11 +262,11 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto st_press_common_probe_error;
 
-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
-		err = st_press_allocate_ring(indio_dev);
-		if (err < 0)
-			goto st_press_common_probe_error;
+	err = st_press_allocate_ring(indio_dev);
+	if (err < 0)
+		goto st_press_common_probe_error;
 
+	if (pdata->get_irq_data_ready(indio_dev) > 0) {
 		err = st_sensors_allocate_trigger(indio_dev,
 							ST_PRESS_TRIGGER_OPS);
 		if (err < 0)
@@ -283,8 +283,7 @@ st_press_device_register_error:
 	if (pdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
 st_press_probe_trigger_error:
-	if (pdata->get_irq_data_ready(indio_dev) > 0)
-		st_press_deallocate_ring(indio_dev);
+	st_press_deallocate_ring(indio_dev);
 st_press_common_probe_error:
 	return err;
 }
@@ -295,10 +294,10 @@ void st_press_common_remove(struct iio_dev *indio_dev)
 	struct st_sensor_data *pdata = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
+	if (pdata->get_irq_data_ready(indio_dev) > 0)
 		st_sensors_deallocate_trigger(indio_dev);
-		st_press_deallocate_ring(indio_dev);
-	}
+
+	st_press_deallocate_ring(indio_dev);
 }
 EXPORT_SYMBOL(st_press_common_remove);
 
#9 lore raw

Re: [PATCH 4/4] iio:press: Register buffer also without specific trigger

Thanks Jonathan!

all is fine...;)

Denis

Quoted 59 lines · Denis CIOCCA
Quoted 3 lines

This patch fix buffer registration that allows to use generic IIO trigger.

Forward ported and applied to the togreg branch of iio.git Thanks,

Please do confirm I didn't do anything silly, but the port to the code Lee updated seemed trivial so I'd rather do it and clear the patches out of my queue ;)

Quoted 49 lines
---
  drivers/iio/pressure/st_pressure_core.c |   17 ++++++++---------
  1 file changed, 8 insertions(+), 9 deletions(-)
drivers/iio/pressure/st_pressure_core.c +8 -9
index 93bff9b..312a093 100644
@@ -262,11 +262,11 @@ int st_press_common_probe(struct iio_dev *indio_dev,
  	if (err < 0)
  		goto st_press_common_probe_error;
 
-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
-		err = st_press_allocate_ring(indio_dev);
-		if (err < 0)
-			goto st_press_common_probe_error;
+	err = st_press_allocate_ring(indio_dev);
+	if (err < 0)
+		goto st_press_common_probe_error;
 
+	if (pdata->get_irq_data_ready(indio_dev) > 0) {
  		err = st_sensors_allocate_trigger(indio_dev,
  							ST_PRESS_TRIGGER_OPS);
  		if (err < 0)
@@ -283,8 +283,7 @@ st_press_device_register_error:
  	if (pdata->get_irq_data_ready(indio_dev) > 0)
  		st_sensors_deallocate_trigger(indio_dev);
  st_press_probe_trigger_error:
-	if (pdata->get_irq_data_ready(indio_dev) > 0)
-		st_press_deallocate_ring(indio_dev);
+	st_press_deallocate_ring(indio_dev);
  st_press_common_probe_error:
  	return err;
  }
@@ -295,10 +294,10 @@ void st_press_common_remove(struct iio_dev *indio_dev)
  	struct st_sensor_data *pdata = iio_priv(indio_dev);
 
  	iio_device_unregister(indio_dev);
-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
+	if (pdata->get_irq_data_ready(indio_dev) > 0)
  		st_sensors_deallocate_trigger(indio_dev);
-		st_press_deallocate_ring(indio_dev);
-	}
+
+	st_press_deallocate_ring(indio_dev);
  }
  EXPORT_SYMBOL(st_press_common_remove);
 
#10 lore raw
In reply to Denis CIOCCA
Quoted 2 lines

This patches fix buffers registrations in order to use generic IIO trigger. Thanks,

I don't know Jonathan would like to deal with this, but please note that all of these patches will conflict with my patch-set.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#11 lore raw

Pj4gVGhpcyBwYXRjaGVzIGZpeCBidWZmZXJzIHJlZ2lzdHJhdGlvbnMgaW4gb3JkZXIgdG8gdXNl IGdlbmVyaWMgSUlPIHRyaWdnZXIuDQo+PiBUaGFua3MsDQo+IEkgZG9uJ3Qga25vdyBKb25hdGhh biB3b3VsZCBsaWtlIHRvIGRlYWwgd2l0aCB0aGlzLCBidXQgcGxlYXNlIG5vdGUNCj4gdGhhdCBh bGwgb2YgdGhlc2UgcGF0Y2hlcyB3aWxsIGNvbmZsaWN0IHdpdGggbXkgcGF0Y2gtc2V0Lg0KPg0K SSBjYW4gcmViYXNlIHRoZSBwYXRjaGVzIHdoZW4geW91ciB3aWxsIGJlIGFwcGxpZWQhDQpJIHNl bnQgbm93IHRoZSBtYWlsIGZvciB5b3VyIGZlZWRiYWNrLi4uDQoNClRoYW5rcw==