Commit a9d7acc8 authored by Hartmut Knaack's avatar Hartmut Knaack Committed by Jonathan Cameron

tools:iio: rename variables

Use more appropriate/common variable names:
  * namepf instead of nameFile in iio_utils.c
  * ret instead of retval in lsiio.c
Signed-off-by: default avatarHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 7663a4aa
...@@ -561,7 +561,7 @@ int find_type_by_name(const char *name, const char *type) ...@@ -561,7 +561,7 @@ int find_type_by_name(const char *name, const char *type)
const struct dirent *ent; const struct dirent *ent;
int number, numstrlen, ret; int number, numstrlen, ret;
FILE *nameFile; FILE *namefp;
DIR *dp; DIR *dp;
char thisname[IIO_MAX_NAME_LENGTH]; char thisname[IIO_MAX_NAME_LENGTH];
char *filename; char *filename;
...@@ -607,20 +607,20 @@ int find_type_by_name(const char *name, const char *type) ...@@ -607,20 +607,20 @@ int find_type_by_name(const char *name, const char *type)
goto error_close_dir; goto error_close_dir;
} }
nameFile = fopen(filename, "r"); namefp = fopen(filename, "r");
if (!nameFile) { if (!namefp) {
free(filename); free(filename);
continue; continue;
} }
free(filename); free(filename);
errno = 0; errno = 0;
if (fscanf(nameFile, "%s", thisname) != 1) { if (fscanf(namefp, "%s", thisname) != 1) {
ret = errno ? -errno : -ENODATA; ret = errno ? -errno : -ENODATA;
goto error_close_dir; goto error_close_dir;
} }
if (fclose(nameFile)) { if (fclose(namefp)) {
ret = -errno; ret = -errno;
goto error_close_dir; goto error_close_dir;
} }
......
...@@ -61,16 +61,16 @@ static int dump_one_device(const char *dev_dir_name) ...@@ -61,16 +61,16 @@ static int dump_one_device(const char *dev_dir_name)
{ {
char name[IIO_MAX_NAME_LENGTH]; char name[IIO_MAX_NAME_LENGTH];
int dev_idx; int dev_idx;
int retval; int ret;
retval = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_device), ret = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_device), "%i",
"%i", &dev_idx); &dev_idx);
if (retval != 1) if (ret != 1)
return -EINVAL; return -EINVAL;
retval = read_sysfs_string("name", dev_dir_name, name); ret = read_sysfs_string("name", dev_dir_name, name);
if (retval) if (ret)
return retval; return ret;
printf("Device %03d: %s\n", dev_idx, name); printf("Device %03d: %s\n", dev_idx, name);
...@@ -84,16 +84,16 @@ static int dump_one_trigger(const char *dev_dir_name) ...@@ -84,16 +84,16 @@ static int dump_one_trigger(const char *dev_dir_name)
{ {
char name[IIO_MAX_NAME_LENGTH]; char name[IIO_MAX_NAME_LENGTH];
int dev_idx; int dev_idx;
int retval; int ret;
retval = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_trigger), ret = sscanf(dev_dir_name + strlen(iio_dir) + strlen(type_trigger),
"%i", &dev_idx); "%i", &dev_idx);
if (retval != 1) if (ret != 1)
return -EINVAL; return -EINVAL;
retval = read_sysfs_string("name", dev_dir_name, name); ret = read_sysfs_string("name", dev_dir_name, name);
if (retval) if (ret)
return retval; return ret;
printf("Trigger %03d: %s\n", dev_idx, name); printf("Trigger %03d: %s\n", dev_idx, name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment