From 0c61814544cfe0db7c4c4adf38e51d015c7175f9 Mon Sep 17 00:00:00 2001 From: Eric Curtin Date: Tue, 15 Sep 2015 21:27:20 +0100 Subject: tools: usbip: detach: avoid calling strlen() at each iteration Instead of calling strlen on every iteration of the for loop, just call it once and cache the result in a temporary local variable which will be used in the for loop instead. Signed-off-by: Eric Curtin Signed-off-by: Greg Kroah-Hartman --- tools/usb/usbip/src/usbip_detach.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c index 05c6d15856eb..9db9d21bb2ec 100644 --- a/tools/usb/usbip/src/usbip_detach.c +++ b/tools/usb/usbip/src/usbip_detach.c @@ -47,7 +47,9 @@ static int detach_port(char *port) uint8_t portnum; char path[PATH_MAX+1]; - for (unsigned int i = 0; i < strlen(port); i++) + unsigned int port_len = strlen(port); + + for (unsigned int i = 0; i < port_len; i++) if (!isdigit(port[i])) { err("invalid port %s", port); return -1; -- cgit v1.2.3-70-g09d2 From 0f286379ed72cfc2f9e9a4fd52e79b92d4edaa01 Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Tue, 1 Sep 2015 09:48:03 +0800 Subject: tools: usb: testusb: change the help text The 'length' is the transfer length, not the packet size, so change the help text. Acked-by: Michal Nazarewicz Cc: Michal Nazarewicz Signed-off-by: Peter Chen Signed-off-by: Felipe Balbi --- tools/usb/testusb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c index 879f9870a6bc..863d9e2b3424 100644 --- a/tools/usb/testusb.c +++ b/tools/usb/testusb.c @@ -454,10 +454,10 @@ usage: "\t-t testnum only run specified case\n" "\t-n no test running, show devices to be tested\n" "Case arguments:\n" - "\t-c iterations default 1000\n" - "\t-s packetsize default 512\n" - "\t-g sglen default 32\n" - "\t-v vary default 512\n", + "\t-c iterations default 1000\n" + "\t-s transfer length default 512\n" + "\t-g sglen default 32\n" + "\t-v vary default 512\n", argv[0]); return 1; } -- cgit v1.2.3-70-g09d2 From 9e44d194b90b2d9e6e26cd0381db856fa7cd7e19 Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Tue, 1 Sep 2015 09:48:04 +0800 Subject: tools: usb: testusb: change the default value for length from 512 to 1024 For ctrl out test, it needs length > vary, so in order to run it with default parameters, we do this change. Acked-by: Michal Nazarewicz Cc: Michal Nazarewicz Signed-off-by: Peter Chen Signed-off-by: Felipe Balbi --- tools/usb/testusb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c index 863d9e2b3424..0692d99b6d8f 100644 --- a/tools/usb/testusb.c +++ b/tools/usb/testusb.c @@ -394,7 +394,7 @@ int main (int argc, char **argv) * low speed, interrupt 8 * 1 = 8 */ param.iterations = 1000; - param.length = 512; + param.length = 1024; param.vary = 512; param.sglen = 32; @@ -455,7 +455,7 @@ usage: "\t-n no test running, show devices to be tested\n" "Case arguments:\n" "\t-c iterations default 1000\n" - "\t-s transfer length default 512\n" + "\t-s transfer length default 1024\n" "\t-g sglen default 32\n" "\t-v vary default 512\n", argv[0]); -- cgit v1.2.3-70-g09d2