From 2861e2079081a156b0b731e1f6acb2aaf5605c5e Mon Sep 17 00:00:00 2001 From: Ryan Lim Date: Wed, 20 Jul 2016 08:14:02 -0700 Subject: [PATCH] greybus: loopback_test: Cancel only the tests running on selected devices When starting a loopback test, it cancels all currently running tests on all loopback devices. When -m argument is given, which runs the test on specific loopback devices, only the tests running on the selected devices need to be cancelled before starting new tests. Signed-off-by: Ryan Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/tools/loopback_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c index 25035f666372..ec448920b8e9 100644 --- a/drivers/staging/greybus/tools/loopback_test.c +++ b/drivers/staging/greybus/tools/loopback_test.c @@ -780,7 +780,8 @@ static void prepare_devices(struct loopback_test *t) /* Cancel any running tests */ for (i = 0; i < t->device_count; i++) - write_sysfs_val(t->devices[i].sysfs_entry, "type", 0); + if (device_enabled(t, i)) + write_sysfs_val(t->devices[i].sysfs_entry, "type", 0); for (i = 0; i < t->device_count; i++) {