Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

greybus: loopback_test: Add -f argument to cancel all tests

To make sure tests on all devices, enabled or not, are cancelled,
specify -f when starting new loopback test.

Signed-off-by: Ryan Lim <limryan@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>

authored by

Ryan Lim and committed by
Greg Kroah-Hartman
346bae65 bf32654a

+10 -3
+10 -3
drivers/staging/greybus/tools/loopback_test.c
··· 91 91 int async_outstanding_operations; 92 92 int us_wait; 93 93 int file_output; 94 + int stop_all; 94 95 int poll_count; 95 96 char test_name[MAX_STR_LEN]; 96 97 char sysfs_prefix[MAX_SYSFS_PATH]; ··· 208 207 " -c Max number of outstanding operations for async operations\n" 209 208 " -w Wait in uSec between operations\n" 210 209 " -z Enable output to a CSV file (incompatible with -p)\n" 210 + " -f When starting new loopback test, stop currently running tests on all devices\n" 211 211 "Examples:\n" 212 212 " Send 10000 transfers with a packet size of 128 bytes to all active connections\n" 213 213 " loopback_test -t transfer -s 128 -i 10000 -S /sys/bus/greybus/devices/ -D /sys/kernel/debug/gb_loopback/\n" ··· 780 778 { 781 779 int i; 782 780 783 - /* Cancel any running tests */ 781 + /* Cancel any running tests on enabled devices. If 782 + * stop_all option is given, stop test on all devices. 783 + */ 784 784 for (i = 0; i < t->device_count; i++) 785 - if (device_enabled(t, i)) 785 + if (t->stop_all || device_enabled(t, i)) 786 786 write_sysfs_val(t->devices[i].sysfs_entry, "type", 0); 787 787 788 788 ··· 905 901 memset(&t, 0, sizeof(t)); 906 902 907 903 while ((o = getopt(argc, argv, 908 - "t:s:i:S:D:m:v::d::r::p::a::l::x::o:O:c:w:z::")) != -1) { 904 + "t:s:i:S:D:m:v::d::r::p::a::l::x::o:O:c:w:z::f::")) != -1) { 909 905 switch (o) { 910 906 case 't': 911 907 snprintf(t.test_name, MAX_STR_LEN, "%s", optarg); ··· 960 956 break; 961 957 case 'z': 962 958 t.file_output = 1; 959 + break; 960 + case 'f': 961 + t.stop_all = 1; 963 962 break; 964 963 default: 965 964 usage();