Re: [PATCH 3/3] tools: iio: Add ARRAY_SIZE macro

2015-07-19 Thread Jonathan Cameron
On 13/07/15 19:49, Hartmut Knaack wrote:
> Cristina Opriceana schrieb am 13.07.2015 um 15:20:
>> Calculation of the length of an array can be done with the ARRAY_SIZE
>> macro to make code more abstract and remove the associated
>> checkpatch.pl warning.
>>
>> Signed-off-by: Cristina Opriceana 
> Acked-by: Hartmut Knaack 
Applied to the togreg branch of iio.git and initially pushed out as
testing.  Good patch set, thanks!

Jonathan
>> ---
>>  tools/iio/iio_utils.c | 2 +-
>>  tools/iio/iio_utils.h | 2 ++
>>  2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
>> index 4a7e480..e177f40 100644
>> --- a/tools/iio/iio_utils.c
>> +++ b/tools/iio/iio_utils.c
>> @@ -39,7 +39,7 @@ int iioutils_break_up_name(const char *full_name, char 
>> **generic_name)
>>  char *working, *prefix = "";
>>  int i, ret;
>>  
>> -for (i = 0; i < sizeof(iio_direction) / sizeof(iio_direction[0]); i++)
>> +for (i = 0; i < ARRAY_SIZE(iio_direction); i++)
>>  if (!strncmp(full_name, iio_direction[i],
>>   strlen(iio_direction[i]))) {
>>  prefix = iio_direction[i];
>> diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h
>> index 0866101..f30a109 100644
>> --- a/tools/iio/iio_utils.h
>> +++ b/tools/iio/iio_utils.h
>> @@ -18,6 +18,8 @@
>>  #define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements"
>>  #define FORMAT_TYPE_FILE "%s_type"
>>  
>> +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
>> +
>>  extern const char *iio_dir;
>>  
>>  /**
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] tools: iio: Add ARRAY_SIZE macro

2015-07-19 Thread Jonathan Cameron
On 13/07/15 19:49, Hartmut Knaack wrote:
 Cristina Opriceana schrieb am 13.07.2015 um 15:20:
 Calculation of the length of an array can be done with the ARRAY_SIZE
 macro to make code more abstract and remove the associated
 checkpatch.pl warning.

 Signed-off-by: Cristina Opriceana cristina.oprice...@gmail.com
 Acked-by: Hartmut Knaack knaac...@gmx.de
Applied to the togreg branch of iio.git and initially pushed out as
testing.  Good patch set, thanks!

Jonathan
 ---
  tools/iio/iio_utils.c | 2 +-
  tools/iio/iio_utils.h | 2 ++
  2 files changed, 3 insertions(+), 1 deletion(-)

 diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
 index 4a7e480..e177f40 100644
 --- a/tools/iio/iio_utils.c
 +++ b/tools/iio/iio_utils.c
 @@ -39,7 +39,7 @@ int iioutils_break_up_name(const char *full_name, char 
 **generic_name)
  char *working, *prefix = ;
  int i, ret;
  
 -for (i = 0; i  sizeof(iio_direction) / sizeof(iio_direction[0]); i++)
 +for (i = 0; i  ARRAY_SIZE(iio_direction); i++)
  if (!strncmp(full_name, iio_direction[i],
   strlen(iio_direction[i]))) {
  prefix = iio_direction[i];
 diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h
 index 0866101..f30a109 100644
 --- a/tools/iio/iio_utils.h
 +++ b/tools/iio/iio_utils.h
 @@ -18,6 +18,8 @@
  #define FORMAT_SCAN_ELEMENTS_DIR %s/scan_elements
  #define FORMAT_TYPE_FILE %s_type
  
 +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
 +
  extern const char *iio_dir;
  
  /**

 
 --
 To unsubscribe from this list: send the line unsubscribe linux-iio in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] tools: iio: Add ARRAY_SIZE macro

2015-07-13 Thread Hartmut Knaack
Cristina Opriceana schrieb am 13.07.2015 um 15:20:
> Calculation of the length of an array can be done with the ARRAY_SIZE
> macro to make code more abstract and remove the associated
> checkpatch.pl warning.
> 
> Signed-off-by: Cristina Opriceana 
Acked-by: Hartmut Knaack 
> ---
>  tools/iio/iio_utils.c | 2 +-
>  tools/iio/iio_utils.h | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
> index 4a7e480..e177f40 100644
> --- a/tools/iio/iio_utils.c
> +++ b/tools/iio/iio_utils.c
> @@ -39,7 +39,7 @@ int iioutils_break_up_name(const char *full_name, char 
> **generic_name)
>   char *working, *prefix = "";
>   int i, ret;
>  
> - for (i = 0; i < sizeof(iio_direction) / sizeof(iio_direction[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(iio_direction); i++)
>   if (!strncmp(full_name, iio_direction[i],
>strlen(iio_direction[i]))) {
>   prefix = iio_direction[i];
> diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h
> index 0866101..f30a109 100644
> --- a/tools/iio/iio_utils.h
> +++ b/tools/iio/iio_utils.h
> @@ -18,6 +18,8 @@
>  #define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements"
>  #define FORMAT_TYPE_FILE "%s_type"
>  
> +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
> +
>  extern const char *iio_dir;
>  
>  /**
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] tools: iio: Add ARRAY_SIZE macro

2015-07-13 Thread Cristina Opriceana
Calculation of the length of an array can be done with the ARRAY_SIZE
macro to make code more abstract and remove the associated
checkpatch.pl warning.

Signed-off-by: Cristina Opriceana 
---
 tools/iio/iio_utils.c | 2 +-
 tools/iio/iio_utils.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index 4a7e480..e177f40 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -39,7 +39,7 @@ int iioutils_break_up_name(const char *full_name, char 
**generic_name)
char *working, *prefix = "";
int i, ret;
 
-   for (i = 0; i < sizeof(iio_direction) / sizeof(iio_direction[0]); i++)
+   for (i = 0; i < ARRAY_SIZE(iio_direction); i++)
if (!strncmp(full_name, iio_direction[i],
 strlen(iio_direction[i]))) {
prefix = iio_direction[i];
diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h
index 0866101..f30a109 100644
--- a/tools/iio/iio_utils.h
+++ b/tools/iio/iio_utils.h
@@ -18,6 +18,8 @@
 #define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements"
 #define FORMAT_TYPE_FILE "%s_type"
 
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+
 extern const char *iio_dir;
 
 /**
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] tools: iio: Add ARRAY_SIZE macro

2015-07-13 Thread Cristina Opriceana
Calculation of the length of an array can be done with the ARRAY_SIZE
macro to make code more abstract and remove the associated
checkpatch.pl warning.

Signed-off-by: Cristina Opriceana cristina.oprice...@gmail.com
---
 tools/iio/iio_utils.c | 2 +-
 tools/iio/iio_utils.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index 4a7e480..e177f40 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -39,7 +39,7 @@ int iioutils_break_up_name(const char *full_name, char 
**generic_name)
char *working, *prefix = ;
int i, ret;
 
-   for (i = 0; i  sizeof(iio_direction) / sizeof(iio_direction[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(iio_direction); i++)
if (!strncmp(full_name, iio_direction[i],
 strlen(iio_direction[i]))) {
prefix = iio_direction[i];
diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h
index 0866101..f30a109 100644
--- a/tools/iio/iio_utils.h
+++ b/tools/iio/iio_utils.h
@@ -18,6 +18,8 @@
 #define FORMAT_SCAN_ELEMENTS_DIR %s/scan_elements
 #define FORMAT_TYPE_FILE %s_type
 
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+
 extern const char *iio_dir;
 
 /**
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] tools: iio: Add ARRAY_SIZE macro

2015-07-13 Thread Hartmut Knaack
Cristina Opriceana schrieb am 13.07.2015 um 15:20:
 Calculation of the length of an array can be done with the ARRAY_SIZE
 macro to make code more abstract and remove the associated
 checkpatch.pl warning.
 
 Signed-off-by: Cristina Opriceana cristina.oprice...@gmail.com
Acked-by: Hartmut Knaack knaac...@gmx.de
 ---
  tools/iio/iio_utils.c | 2 +-
  tools/iio/iio_utils.h | 2 ++
  2 files changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
 index 4a7e480..e177f40 100644
 --- a/tools/iio/iio_utils.c
 +++ b/tools/iio/iio_utils.c
 @@ -39,7 +39,7 @@ int iioutils_break_up_name(const char *full_name, char 
 **generic_name)
   char *working, *prefix = ;
   int i, ret;
  
 - for (i = 0; i  sizeof(iio_direction) / sizeof(iio_direction[0]); i++)
 + for (i = 0; i  ARRAY_SIZE(iio_direction); i++)
   if (!strncmp(full_name, iio_direction[i],
strlen(iio_direction[i]))) {
   prefix = iio_direction[i];
 diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h
 index 0866101..f30a109 100644
 --- a/tools/iio/iio_utils.h
 +++ b/tools/iio/iio_utils.h
 @@ -18,6 +18,8 @@
  #define FORMAT_SCAN_ELEMENTS_DIR %s/scan_elements
  #define FORMAT_TYPE_FILE %s_type
  
 +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
 +
  extern const char *iio_dir;
  
  /**
 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/