tools: gpio: rename nlines to num_lines
Rename nlines to num_lines to be consistent with other usage for fields describing the number of entries in an array. Signed-off-by: Kent Gibson <warthog618@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:

committed by
Bartosz Golaszewski

parent
e86a863b33
commit
ed60aee0ed
@@ -22,7 +22,7 @@
|
||||
#include <linux/gpio.h>
|
||||
#include "gpio-utils.h"
|
||||
|
||||
int hammer_device(const char *device_name, unsigned int *lines, int nlines,
|
||||
int hammer_device(const char *device_name, unsigned int *lines, int num_lines,
|
||||
unsigned int loops)
|
||||
{
|
||||
struct gpiohandle_data data;
|
||||
@@ -33,7 +33,7 @@ int hammer_device(const char *device_name, unsigned int *lines, int nlines,
|
||||
unsigned int iteration = 0;
|
||||
|
||||
memset(&data.values, 0, sizeof(data.values));
|
||||
ret = gpiotools_request_linehandle(device_name, lines, nlines,
|
||||
ret = gpiotools_request_linehandle(device_name, lines, num_lines,
|
||||
GPIOHANDLE_REQUEST_OUTPUT, &data,
|
||||
"gpio-hammer");
|
||||
if (ret < 0)
|
||||
@@ -46,15 +46,15 @@ int hammer_device(const char *device_name, unsigned int *lines, int nlines,
|
||||
goto exit_close_error;
|
||||
|
||||
fprintf(stdout, "Hammer lines [");
|
||||
for (i = 0; i < nlines; i++) {
|
||||
for (i = 0; i < num_lines; i++) {
|
||||
fprintf(stdout, "%d", lines[i]);
|
||||
if (i != (nlines - 1))
|
||||
if (i != (num_lines - 1))
|
||||
fprintf(stdout, ", ");
|
||||
}
|
||||
fprintf(stdout, "] on %s, initial states: [", device_name);
|
||||
for (i = 0; i < nlines; i++) {
|
||||
for (i = 0; i < num_lines; i++) {
|
||||
fprintf(stdout, "%d", data.values[i]);
|
||||
if (i != (nlines - 1))
|
||||
if (i != (num_lines - 1))
|
||||
fprintf(stdout, ", ");
|
||||
}
|
||||
fprintf(stdout, "]\n");
|
||||
@@ -63,7 +63,7 @@ int hammer_device(const char *device_name, unsigned int *lines, int nlines,
|
||||
j = 0;
|
||||
while (1) {
|
||||
/* Invert all lines so we blink */
|
||||
for (i = 0; i < nlines; i++)
|
||||
for (i = 0; i < num_lines; i++)
|
||||
data.values[i] = !data.values[i];
|
||||
|
||||
ret = gpiotools_set_values(fd, &data);
|
||||
@@ -81,9 +81,9 @@ int hammer_device(const char *device_name, unsigned int *lines, int nlines,
|
||||
j = 0;
|
||||
|
||||
fprintf(stdout, "[");
|
||||
for (i = 0; i < nlines; i++) {
|
||||
for (i = 0; i < num_lines; i++) {
|
||||
fprintf(stdout, "%d: %d", lines[i], data.values[i]);
|
||||
if (i != (nlines - 1))
|
||||
if (i != (num_lines - 1))
|
||||
fprintf(stdout, ", ");
|
||||
}
|
||||
fprintf(stdout, "]\r");
|
||||
@@ -121,7 +121,7 @@ int main(int argc, char **argv)
|
||||
const char *device_name = NULL;
|
||||
unsigned int lines[GPIOHANDLES_MAX];
|
||||
unsigned int loops = 0;
|
||||
int nlines;
|
||||
int num_lines;
|
||||
int c;
|
||||
int i;
|
||||
|
||||
@@ -158,11 +158,11 @@ int main(int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
nlines = i;
|
||||
num_lines = i;
|
||||
|
||||
if (!device_name || !nlines) {
|
||||
if (!device_name || !num_lines) {
|
||||
print_usage();
|
||||
return -1;
|
||||
}
|
||||
return hammer_device(device_name, lines, nlines, loops);
|
||||
return hammer_device(device_name, lines, num_lines, loops);
|
||||
}
|
||||
|
Reference in New Issue
Block a user