Skip to content

Commit

Permalink
tools: iio: iio_generic_buffer: rename and change type of force variable
Browse files Browse the repository at this point in the history
Replace the type of 'force' flag from int to bool and at the same time
rename it to 'force_autochannels' for better readability.

Suggested-by: Peter Meerwald-Stadler <[email protected]>
Signed-off-by: Eva Rachel Retuya <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
eraretuya authored and jic23 committed Oct 23, 2016
1 parent 0b0feb3 commit 71ccbe5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/iio/iio_generic_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ int main(int argc, char **argv)
int noevents = 0;
int notrigger = 0;
char *dummy;
int force = 0;
bool force_autochannels = false;

struct iio_channel_info *channels = NULL;

Expand All @@ -362,7 +362,7 @@ int main(int argc, char **argv)
break;
case 'A':
autochannels = AUTOCHANNELS_ENABLED;
force = 1;
force_autochannels = true;
break;
case 'c':
errno = 0;
Expand Down Expand Up @@ -526,14 +526,15 @@ int main(int argc, char **argv)
"diag %s\n", dev_dir_name);
goto error;
}
if ((num_channels && autochannels == AUTOCHANNELS_ENABLED) && !force) {
if ((num_channels && autochannels == AUTOCHANNELS_ENABLED) &&
!force_autochannels) {
fprintf(stderr, "Auto-channels selected but some channels "
"are already activated in sysfs\n");
fprintf(stderr, "Proceeding without activating any channels\n");
}

if ((!num_channels && autochannels == AUTOCHANNELS_ENABLED) ||
((autochannels == AUTOCHANNELS_ENABLED) && force)) {
((autochannels == AUTOCHANNELS_ENABLED) && force_autochannels)) {
fprintf(stderr, "Enabling all channels\n");

ret = enable_disable_all_channels(dev_dir_name, 1);
Expand Down

0 comments on commit 71ccbe5

Please sign in to comment.