Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197222
b: refs/heads/master
c: eaf86ff
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed May 11, 2010
1 parent bf66e59 commit 098e2a4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 82020b0ef15de0cde1082ba0ff427c2f47a9a011
refs/heads/master: eaf86ff9390d4d9c34d88d75fc7bcb784afc697a
31 changes: 30 additions & 1 deletion trunk/drivers/staging/iio/Documentation/iio_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 098e2a4

Please sign in to comment.