Skip to contentSkip to conversation

IIO: Mixed trivial fixes and cleanups

PATCH In review Jonathan Cameron 2 participants 8 messages Apr 10, 2012

Subsystems (4)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

cover IIO: Mixed trivial fixes and cleanups

Hi Greg,

This set have all been on the mailing list for over a month and no one seems to care. All straight forward enough that this doesn't bother me too much!

Original messages:

Nothing terribly interesting, but as ever all comments welcome. If no one shouts I'll assume these are trivial enough to send on to Greg sometime next week.

and

I have no idea how I managed to munge the previous patch related to this. Sorry all.

Jonathan Cameron (6):
staging:iio:buffer example fix typos staging:iio:adc:max1363 fix missing update_scan_mask callback. staging:iio fill in some missing docs
staging:iio:max1363 enable use with inkernel interfaces. staging:iio:accel:lis3l02dq add symmetry to check for presence of
trigger.
staging:iio: use spi->irq valid rather than querying available modes

 drivers/staging/iio/Documentation/generic_buffer.c |    4 ++--
 drivers/staging/iio/accel/lis3l02dq_core.c         |    2 +-
 drivers/staging/iio/adc/max1363_core.c             |   10 +++++++++-
 drivers/staging/iio/iio.h                          |    2 ++
 drivers/staging/iio/imu/adis16400_core.c           |    2 +-
 drivers/staging/iio/meter/ade7758_core.c           |    2 +-
 6 files changed, 16 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.9.4
author maintainer
#1 lore raw

PATCH 1/6 staging:iio:buffer example fix typos

I have no idea how I managed to munge the previous patch related to this. Sorry all.

---
 drivers/staging/iio/Documentation/generic_buffer.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/Documentation/generic_buffer.c +2 -2
index 69a05b9..bf55335 100644
@@ -60,9 +60,9 @@ void print2byte(int input, struct iio_channel_info *info)
 	/* First swap if incorrect endian */
 
 	if (info->be)
-		input = be16toh((uint_16t)input);
+		input = be16toh((uint16_t)input);
 	else
-		input = le16toh((uint_16t)input);
+		input = le16toh((uint16_t)input);
 
 	/* shift before conversion to avoid sign extension
 	   of left aligned data */
Signature · 1 line
1.7.9.4
author maintainer
#2 lore raw

PATCH 2/6 staging:iio:adc:max1363 fix missing update_scan_mask callback.

In reply to Jonathan Cameron

When moving over to the new sw_ring_preenable I managed to add this callback to only one of the two iio_info structures. As such only some devices will currently work.

---
 drivers/staging/iio/adc/max1363_core.c |    1 +
 1 file changed, 1 insertion(+)
drivers/staging/iio/adc/max1363_core.c +1 -0
index cf3e2ca..2536b63 100644
@@ -830,6 +830,7 @@ static struct attribute_group max1363_event_attribute_group = {
 static const struct iio_info max1238_info = {
 	.read_raw = &max1363_read_raw,
 	.driver_module = THIS_MODULE,
+	.update_scan_mode = &max1363_update_scan_mode,
 };
 
 static const struct iio_info max1363_info = {
Signature · 1 line
1.7.9.4
author maintainer
#3 lore raw

PATCH 3/6 staging:iio fill in some missing docs

In reply to Jonathan Cameron
---
 drivers/staging/iio/iio.h |    2 ++
 1 file changed, 2 insertions(+)
drivers/staging/iio/iio.h +2 -0
index b9cd454..833a849 100644
@@ -331,6 +331,8 @@ struct iio_buffer_setup_ops {
  * @name:		[DRIVER] name of the device.
  * @info:		[DRIVER] callbacks and constant info from driver
  * @info_exist_lock:	[INTERN] lock to prevent use during removal
+ * @setup_ops:		[DRIVER] callbacks to call before and after buffer
+ *			enable/disable
  * @chrdev:		[INTERN] associated character device
  * @groups:		[INTERN] attribute groups
  * @groupcounter:	[INTERN] index of next attribute group
Signature · 1 line
1.7.9.4
author maintainer
#4 lore raw

PATCH 4/6 staging:iio:max1363 enable use with inkernel interfaces.

In reply to Jonathan Cameron
---
 drivers/staging/iio/adc/max1363_core.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/staging/iio/adc/max1363_core.c +8 -1
index 2536b63..9d7db7f 100644
@@ -36,6 +36,7 @@
 #include "../sysfs.h"
 #include "../events.h"
 #include "../buffer.h"
+#include "../driver.h"
 
 #include "max1363.h"
 
@@ -1290,6 +1291,9 @@ static int __devinit max1363_probe(struct i2c_client *client,
 		ret = -ENOMEM;
 		goto error_disable_reg;
 	}
+	ret = iio_map_array_register(indio_dev, client->dev.platform_data);
+	if (ret < 0)
+		goto error_free_device;
 	st = iio_priv(indio_dev);
 	st->reg = reg;
 	/* this is only used for device removal purposes */
@@ -1300,7 +1304,7 @@ static int __devinit max1363_probe(struct i2c_client *client,
 
 	ret = max1363_alloc_scan_masks(indio_dev);
 	if (ret)
-		goto error_free_device;
+		goto error_unregister_map;
 
 	/* Estabilish that the iio_dev is a child of the i2c device */
 	indio_dev->dev.parent = &client->dev;
@@ -1350,6 +1354,8 @@ error_cleanup_ring:
 	max1363_ring_cleanup(indio_dev);
 error_free_available_scan_masks:
 	kfree(indio_dev->available_scan_masks);
+error_unregister_map:
+	iio_map_array_unregister(indio_dev, client->dev.platform_data);
 error_free_device:
 	iio_free_device(indio_dev);
 error_disable_reg:
@@ -1376,6 +1382,7 @@ static int max1363_remove(struct i2c_client *client)
 		regulator_disable(reg);
 		regulator_put(reg);
 	}
+	iio_map_array_unregister(indio_dev, client->dev.platform_data);
 	iio_free_device(indio_dev);
 
 	return 0;
Signature · 1 line
1.7.9.4
author maintainer
#5 lore raw

PATCH 5/6 staging:iio:accel:lis3l02dq add symmetry to check for presence of trigger.

In reply to Jonathan Cameron

Checking indio_dev->modes is uggly and not symmetric with the conditions on whether triggers are allowed in the first place.

---
 drivers/staging/iio/accel/lis3l02dq_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/accel/lis3l02dq_core.c +1 -1
index 376da51..bcf4712 100644
@@ -724,7 +724,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)
 	return 0;
 
 error_remove_trigger:
-	if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
+	if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)))
 		lis3l02dq_remove_trigger(indio_dev);
 error_free_interrupt:
 	if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0)
Signature · 1 line
1.7.9.4
author maintainer
#6 lore raw

PATCH 6/6 staging:iio: use spi->irq valid rather than querying available modes

In reply to Jonathan Cameron

Given these drivers only try to add the trigger if a valid irq is present it is clearer to check the same condition when deciding whether to remove it on a later trigger.

---
 drivers/staging/iio/imu/adis16400_core.c |    2 +-
 drivers/staging/iio/meter/ade7758_core.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/imu/adis16400_core.c +1 -1
index e73ad78..a027d6d 100644
@@ -1172,7 +1172,7 @@ static int __devinit adis16400_probe(struct spi_device *spi)
 	return 0;
 
 error_remove_trigger:
-	if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
+	if (spi->irq)
 		adis16400_remove_trigger(indio_dev);
 error_uninitialize_ring:
 	iio_buffer_unregister(indio_dev);
drivers/staging/iio/meter/ade7758_core.c +1 -1
index dcb2029..9374d6b 100644
@@ -800,7 +800,7 @@ static int __devinit ade7758_probe(struct spi_device *spi)
 	return 0;
 
 error_remove_trigger:
-	if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
+	if (spi->irq)
 		ade7758_remove_trigger(indio_dev);
 error_uninitialize_ring:
 	ade7758_uninitialize_ring(indio_dev);
Signature · 1 line
1.7.9.4
#7 lore raw
In reply to Jonathan Cameron
Quoted 8 lines · Jonathan Cameron

Hi Greg,

This set have all been on the mailing list for over a month and no one seems to care. All straight forward enough that this doesn't bother me too much!

Original messages:

Quoted 8 lines

Nothing terribly interesting, but as ever all comments welcome. If no one shouts I'll assume these are trivial enough to send on to Greg sometime next week.

and

I have no idea how I managed to munge the previous patch related to this. Sorry all.

All applied, thanks.

greg k-h