[PATCH 09/19] staging:iio: Documentation, update iio_utils.h for the move to a bus

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jonathan Cameron
Date: Monday, April 26, 2010 - 12:31 pm

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/Documentation/iio_utils.h |   31 ++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h
index 74d3124..d24006a 100644
--- a/drivers/staging/iio/Documentation/iio_utils.h
+++ b/drivers/staging/iio/Documentation/iio_utils.h
@@ -47,7 +47,7 @@ inline char *find_ring_subelement(const char *directory, const char *subelement)
 
 char *find_type_by_name(const char *name, const char *type)
 {
-	const char *iio_dir = "/sys/class/iio/";
+	const char *iio_dir = "/sys/bus/iio/devices/";
 	const struct dirent *ent;
 	int cnt, pos, pos2;
 
@@ -112,6 +112,35 @@ int write_sysfs_int(char *filename, char *basedir, int val)
 	return 0;
 }
 
+int write_sysfs_int_and_verify(char *filename, char *basedir, int val)
+{
+	int ret;
+	FILE  *sysfsfp;
+	char temp[100];
+	int test;
+
+	sprintf(temp, "%s%s", basedir, filename);
+	sysfsfp = fopen(temp, "w");
+	if (sysfsfp == NULL)
+		return -1;
+	fprintf(sysfsfp, "%d", val);
+	fclose(sysfsfp);
+
+	sysfsfp = fopen(temp, "r");
+	if (sysfsfp == NULL)
+		return -1;
+	fscanf(sysfsfp, "%d", &test);
+	if (test != val) {
+		printf("Possible failure in int write %d to %s%s\n",
+		       val,
+		       basedir,
+		       filename);
+		return -1;
+	}
+
+	return 0;
+}
+
 /**
  * write_sysfs_string_and_verify() - string write, readback and verify
  * @filename: name of file to write to
-- 
1.6.4.4

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 02/19] staging:iio: Add new attrs for sampling freq ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 03/19] iio:staging:accelerometers move towards the ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 04/19] staging:iio: Support functions for scan mask ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 05/19] staging: iio: Move from class to bus, Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 06/19] staging:iio: Move event attributes into the ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 07/19] staging:iio: Clean out unused IIO_SCAN_EL an ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 08/19] staging:iio:max1363 move to new abi., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 09/19] staging:iio: Documentation, update iio_utils ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 10/19] staging:iio: ABI documentation (partial), Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 11/19] staging:iio: Directory name changes to match ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 12/19] staging:iio:tsl2563: change lux to illuminan ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 13/19] staging:iio: Remove naming via IDR's where n ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 14/19] staging:iio:max1363 add support for max11606 ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 15/19] staging:iio:max1363 add support for 8 bit eq ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 16/19] Staging: IIO: Fix uses of spinlocks prior to ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 17/19] staging:iio:ring_sw: Fix incorrect test on s ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 18/19] staging:iio:tsl2563 add a name attribute und ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)
[PATCH 19/19] staging:iio:Documentation: Rewrite example f ..., Jonathan Cameron, (Mon Apr 26, 12:31 pm)