summaryrefslogtreecommitdiffstats
path: root/tools/iio/iio_utils.c
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-05-31 14:40:36 +0200
committerJonathan Cameron <jic23@kernel.org>2015-06-01 08:40:26 +0100
commit9d4752544d17a10a40be5fc5ef68edcae5363599 (patch)
tree16730c7cb8cd89c1d19d0635e496e5977a93baa9 /tools/iio/iio_utils.c
parente06e3d7112f2ec5494d2d934a8641a53885003ee (diff)
downloadlinux-stable-9d4752544d17a10a40be5fc5ef68edcae5363599.tar.gz
linux-stable-9d4752544d17a10a40be5fc5ef68edcae5363599.tar.bz2
linux-stable-9d4752544d17a10a40be5fc5ef68edcae5363599.zip
tools:iio:iio_utils: pass strings as const
Mark strings, which are not supposed to be changed (basedir, filename, value), as const in function parameters. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio/iio_utils.c')
-rw-r--r--tools/iio/iio_utils.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index dfee1a3f3f63..ec9ab7f9ae4c 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -634,7 +634,8 @@ error_close_dir:
return ret;
}
-static int _write_sysfs_int(char *filename, char *basedir, int val, int verify)
+static int _write_sysfs_int(const char *filename, const char *basedir, int val,
+ int verify)
{
int ret = 0;
FILE *sysfsfp;
@@ -707,7 +708,7 @@ error_free:
*
* Returns a value >= 0 on success, otherwise a negative error code.
**/
-int write_sysfs_int(char *filename, char *basedir, int val)
+int write_sysfs_int(const char *filename, const char *basedir, int val)
{
return _write_sysfs_int(filename, basedir, val, 0);
}
@@ -721,13 +722,14 @@ int write_sysfs_int(char *filename, char *basedir, int val)
*
* Returns a value >= 0 on success, otherwise a negative error code.
**/
-int write_sysfs_int_and_verify(char *filename, char *basedir, int val)
+int write_sysfs_int_and_verify(const char *filename, const char *basedir,
+ int val)
{
return _write_sysfs_int(filename, basedir, val, 1);
}
-static int _write_sysfs_string(char *filename, char *basedir, char *val,
- int verify)
+static int _write_sysfs_string(const char *filename, const char *basedir,
+ const char *val, int verify)
{
int ret = 0;
FILE *sysfsfp;
@@ -805,7 +807,8 @@ error_free:
*
* Returns a value >= 0 on success, otherwise a negative error code.
**/
-int write_sysfs_string_and_verify(char *filename, char *basedir, char *val)
+int write_sysfs_string_and_verify(const char *filename, const char *basedir,
+ const char *val)
{
return _write_sysfs_string(filename, basedir, val, 1);
}
@@ -818,7 +821,8 @@ int write_sysfs_string_and_verify(char *filename, char *basedir, char *val)
*
* Returns a value >= 0 on success, otherwise a negative error code.
**/
-int write_sysfs_string(char *filename, char *basedir, char *val)
+int write_sysfs_string(const char *filename, const char *basedir,
+ const char *val)
{
return _write_sysfs_string(filename, basedir, val, 0);
}
@@ -831,7 +835,7 @@ int write_sysfs_string(char *filename, char *basedir, char *val)
* Returns the read integer value >= 0 on success, otherwise a negative error
* code.
**/
-int read_sysfs_posint(char *filename, char *basedir)
+int read_sysfs_posint(const char *filename, const char *basedir)
{
int ret;
FILE *sysfsfp;
@@ -875,7 +879,7 @@ error_free:
*
* Returns a value >= 0 on success, otherwise a negative error code.
**/
-int read_sysfs_float(char *filename, char *basedir, float *val)
+int read_sysfs_float(const char *filename, const char *basedir, float *val)
{
int ret = 0;
FILE *sysfsfp;