All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] blue part 1: IIO Misc fixes.
@ 2011-07-25 13:04 Jonathan Cameron
  2011-07-25 13:04 ` [PATCH 1/3] staging:iio:gyro:adxrs450 fix: wrong variable for IIO_TEMP reading Jonathan Cameron
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jonathan Cameron @ 2011-07-25 13:04 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Hi All,

This series and the following are all in the iio-blue.git reposistory.

The max1363 has been posted before and is included here for completeness.

Thanks,

Jonathan



Jonathan Cameron (3):
  staging:iio:gyro:adxrs450 fix: wrong variable for IIO_TEMP reading.
  staging:iio:adc: max1363 fix 2 raw sysfs issues.
  staging:iio:core simplify and fix a bug in
    iio_device_(un)register_event_set.

 drivers/staging/iio/adc/max1363_core.c   |    4 ++-
 drivers/staging/iio/gyro/adxrs450_core.c |    2 +-
 drivers/staging/iio/industrialio-core.c  |   40 +++++++++++++++---------------
 3 files changed, 24 insertions(+), 22 deletions(-)

-- 
1.7.3.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] staging:iio:gyro:adxrs450 fix: wrong variable for IIO_TEMP reading.
  2011-07-25 13:04 [PATCH 0/3] blue part 1: IIO Misc fixes Jonathan Cameron
@ 2011-07-25 13:04 ` Jonathan Cameron
  2011-07-25 13:04 ` [PATCH 2/3] staging:iio:adc: max1363 fix 2 raw sysfs issues Jonathan Cameron
  2011-07-25 13:04 ` [PATCH 3/3] staging:iio:core simplify and fix a bug in iio_device_(un)register_event_set Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2011-07-25 13:04 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Silly mistake during chan_spec conversion.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/gyro/adxrs450_core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/gyro/adxrs450_core.c b/drivers/staging/iio/gyro/adxrs450_core.c
index 196c172..f65ad49 100644
--- a/drivers/staging/iio/gyro/adxrs450_core.c
+++ b/drivers/staging/iio/gyro/adxrs450_core.c
@@ -279,7 +279,7 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev,
 						       ADXRS450_TEMP1, &ut);
 			if (ret)
 				break;
-			*val = t;
+			*val = ut;
 			ret = IIO_VAL_INT;
 			break;
 		default:
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] staging:iio:adc: max1363 fix 2 raw sysfs issues.
  2011-07-25 13:04 [PATCH 0/3] blue part 1: IIO Misc fixes Jonathan Cameron
  2011-07-25 13:04 ` [PATCH 1/3] staging:iio:gyro:adxrs450 fix: wrong variable for IIO_TEMP reading Jonathan Cameron
@ 2011-07-25 13:04 ` Jonathan Cameron
  2011-07-25 13:04 ` [PATCH 3/3] staging:iio:core simplify and fix a bug in iio_device_(un)register_event_set Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2011-07-25 13:04 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

indio_dev->channels was accidentally removed thus preventing any sysfs
registrations occuring for direct reading.  That hid the other issue.

Unfortunately the incorrect handling leads to misspresentation of data
in sysfs reads.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/adc/max1363_core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index 3fee89e..9525aec 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -254,7 +254,7 @@ static int max1363_read_raw(struct iio_dev *indio_dev,
 	switch (m) {
 	case 0:
 		ret = max1363_read_single_chan(indio_dev, chan, val, m);
-		if (ret)
+		if (ret < 0)
 			return ret;
 		return IIO_VAL_INT;
 	case (1 << IIO_CHAN_INFO_SCALE_SHARED):
@@ -1306,6 +1306,8 @@ static int __devinit max1363_probe(struct i2c_client *client,
 
 	indio_dev->info = st->chip_info->info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
+	indio_dev->channels = st->chip_info->channels;
+	indio_dev->num_channels = st->chip_info->num_channels;
 	ret = max1363_initial_setup(st);
 	if (ret < 0)
 		goto error_free_available_scan_masks;
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] staging:iio:core simplify and fix a bug in iio_device_(un)register_event_set.
  2011-07-25 13:04 [PATCH 0/3] blue part 1: IIO Misc fixes Jonathan Cameron
  2011-07-25 13:04 ` [PATCH 1/3] staging:iio:gyro:adxrs450 fix: wrong variable for IIO_TEMP reading Jonathan Cameron
  2011-07-25 13:04 ` [PATCH 2/3] staging:iio:adc: max1363 fix 2 raw sysfs issues Jonathan Cameron
@ 2011-07-25 13:04 ` Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2011-07-25 13:04 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

The unwinding index was j, not i and it is much simpler to do these as a single
loop unwinding those elements necessary in before jumping to the error handler.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/industrialio-core.c |   40 +++++++++++++++---------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 51115b4..7f4d183 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -1063,7 +1063,7 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
 		if (ret) {
 			dev_err(&dev_info->dev,
 				"Could not get chrdev interface\n");
-			goto error_free_setup_ev_ints;
+			goto error_free_setup_event_lines;
 		}
 
 		dev_set_drvdata(&dev_info->event_interfaces[i].dev,
@@ -1079,31 +1079,33 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
 		if (ret) {
 			dev_err(&dev_info->dev,
 				"Failed to register sysfs for event attrs");
-			goto error_remove_sysfs_interfaces;
+			iio_free_ev_int(&dev_info->event_interfaces[i]);
+			goto error_free_setup_event_lines;
 		}
-	}
-
-	for (i = 0; i < dev_info->info->num_interrupt_lines; i++) {
 		ret = __iio_add_event_config_attrs(dev_info, i);
-		if (ret)
-			goto error_unregister_config_attrs;
+		if (ret) {
+			if (dev_info->info->event_attrs != NULL)
+				sysfs_remove_group(&dev_info
+						   ->event_interfaces[i]
+						   .dev.kobj,
+						   &dev_info->info
+						   ->event_attrs[i]);
+			iio_free_ev_int(&dev_info->event_interfaces[i]);
+			goto error_free_setup_event_lines;
+		}
 	}
 
 	return 0;
 
-error_unregister_config_attrs:
-	for (j = 0; j < i; j++)
-		__iio_remove_event_config_attrs(dev_info, i);
-	i = dev_info->info->num_interrupt_lines - 1;
-error_remove_sysfs_interfaces:
-	for (j = 0; j < i; j++)
+error_free_setup_event_lines:
+	for (j = 0; j < i; j++) {
+		__iio_remove_event_config_attrs(dev_info, j);
 		if (dev_info->info->event_attrs != NULL)
 			sysfs_remove_group(&dev_info
-				   ->event_interfaces[j].dev.kobj,
-				   &dev_info->info->event_attrs[j]);
-error_free_setup_ev_ints:
-	for (j = 0; j < i; j++)
+					   ->event_interfaces[j].dev.kobj,
+					   &dev_info->info->event_attrs[j]);
 		iio_free_ev_int(&dev_info->event_interfaces[j]);
+	}
 	kfree(dev_info->event_interfaces);
 error_ret:
 
@@ -1122,10 +1124,8 @@ static void iio_device_unregister_eventset(struct iio_dev *dev_info)
 			sysfs_remove_group(&dev_info
 					   ->event_interfaces[i].dev.kobj,
 					   &dev_info->info->event_attrs[i]);
-	}
-
-	for (i = 0; i < dev_info->info->num_interrupt_lines; i++)
 		iio_free_ev_int(&dev_info->event_interfaces[i]);
+	}
 	kfree(dev_info->event_interfaces);
 }
 
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-25 13:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25 13:04 [PATCH 0/3] blue part 1: IIO Misc fixes Jonathan Cameron
2011-07-25 13:04 ` [PATCH 1/3] staging:iio:gyro:adxrs450 fix: wrong variable for IIO_TEMP reading Jonathan Cameron
2011-07-25 13:04 ` [PATCH 2/3] staging:iio:adc: max1363 fix 2 raw sysfs issues Jonathan Cameron
2011-07-25 13:04 ` [PATCH 3/3] staging:iio:core simplify and fix a bug in iio_device_(un)register_event_set Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.