usbip-devel Mailing List for The USB/IP Project (Page 3)
Status: Alpha
Brought to you by:
hirofuchi
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2007 |
Jan
(9) |
Feb
|
Mar
(5) |
Apr
|
May
(3) |
Jun
(4) |
Jul
(8) |
Aug
(7) |
Sep
(6) |
Oct
|
Nov
(5) |
Dec
(10) |
2008 |
Jan
(2) |
Feb
(2) |
Mar
(1) |
Apr
(30) |
May
(26) |
Jun
(12) |
Jul
(26) |
Aug
(14) |
Sep
(20) |
Oct
(9) |
Nov
(19) |
Dec
(36) |
2009 |
Jan
(16) |
Feb
(18) |
Mar
(18) |
Apr
(24) |
May
(52) |
Jun
(69) |
Jul
(44) |
Aug
(12) |
Sep
(9) |
Oct
(1) |
Nov
(3) |
Dec
(4) |
2010 |
Jan
(12) |
Feb
(34) |
Mar
(6) |
Apr
(14) |
May
(9) |
Jun
(33) |
Jul
(18) |
Aug
(8) |
Sep
(3) |
Oct
(3) |
Nov
|
Dec
(8) |
2011 |
Jan
(11) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(69) |
Jun
(22) |
Jul
(11) |
Aug
(12) |
Sep
(13) |
Oct
(10) |
Nov
(2) |
Dec
(4) |
2012 |
Jan
(13) |
Feb
(5) |
Mar
(16) |
Apr
(21) |
May
(8) |
Jun
(10) |
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
(17) |
Nov
(4) |
Dec
(2) |
2013 |
Jan
|
Feb
(19) |
Mar
(5) |
Apr
(22) |
May
(4) |
Jun
(5) |
Jul
|
Aug
(2) |
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
2014 |
Jan
(3) |
Feb
(8) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
(2) |
Oct
(5) |
Nov
(1) |
Dec
|
2015 |
Jan
(5) |
Feb
(1) |
Mar
(9) |
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(3) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
(2) |
Aug
(4) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:09:18
|
From: Kurt Kanzenbach <ly8...@ci...> The command `usbip attach' uses --host for specifing the remote host, while `usbip list' uses --remote. This is confusing and this patch adapts this. In Addition changed the manpage and README accordingly. Before: $ usbip attach --host <host> -b <busid> $ usbip list --remote <host> Now: $ usbip attach --remote <host> -b <busid> $ usbip list --remote <host> Signed-off-by: Kurt Kanzenbach <ly8...@ci...> Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/userspace/README | 4 ++-- drivers/staging/usbip/userspace/doc/usbip.8 | 4 ++-- drivers/staging/usbip/userspace/src/usbip_attach.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/usbip/userspace/README b/drivers/staging/usbip/userspace/README index 233d1d7..00a1658 100644 --- a/drivers/staging/usbip/userspace/README +++ b/drivers/staging/usbip/userspace/README @@ -54,7 +54,7 @@ client:# usbip list --remote <host> - List exported USB devices on the <host>. - client:# usbip attach --host <host> --busid 1-2 + client:# usbip attach --remote <host> --busid 1-2 - Connect the remote USB device. client:# usbip port @@ -163,7 +163,7 @@ exportable on the host. Attach a remote USB device: - deux:# usbip attach --host 10.0.0.3 --busid 1-1 + deux:# usbip attach --remote 10.0.0.3 --busid 1-1 port 0 attached Show the devices attached to this client: diff --git a/drivers/staging/usbip/userspace/doc/usbip.8 b/drivers/staging/usbip/userspace/doc/usbip.8 index 6e0d745..ccdadc8 100644 --- a/drivers/staging/usbip/userspace/doc/usbip.8 +++ b/drivers/staging/usbip/userspace/doc/usbip.8 @@ -38,7 +38,7 @@ then exit. .PP .HP -\fBattach\fR \-\-host=<\fIhost\fR> \-\-busid=<\fIbus_id\fR> +\fBattach\fR \-\-remote=<\fIhost\fR> \-\-busid=<\fIbus_id\fR> .IP Attach a remote USB device. .PP @@ -79,7 +79,7 @@ List local USB devices. client:# usbip list --remote=server - List exportable usb devices on the server. - client:# usbip attach --host=server --busid=1-2 + client:# usbip attach --remote=server --busid=1-2 - Connect the remote USB device. client:# usbip detach --port=0 diff --git a/drivers/staging/usbip/userspace/src/usbip_attach.c b/drivers/staging/usbip/userspace/src/usbip_attach.c index 2da4e44..0ec16e5 100644 --- a/drivers/staging/usbip/userspace/src/usbip_attach.c +++ b/drivers/staging/usbip/userspace/src/usbip_attach.c @@ -36,7 +36,7 @@ static const char usbip_attach_usage_string[] = "usbip attach <args>\n" - " -h, --host=<host> The machine with exported USB devices\n" + " -r, --remote=<host> The machine with exported USB devices\n" " -b, --busid=<busid> Busid of the device on <host>\n"; void usbip_attach_usage(void) @@ -201,9 +201,9 @@ static int attach_device(char *host, char *busid) int usbip_attach(int argc, char *argv[]) { static const struct option opts[] = { - { "host", required_argument, NULL, 'h' }, - { "busid", required_argument, NULL, 'b' }, - { NULL, 0, NULL, 0 } + { "remote", required_argument, NULL, 'r' }, + { "busid", required_argument, NULL, 'b' }, + { NULL, 0, NULL, 0 } }; char *host = NULL; char *busid = NULL; @@ -211,13 +211,13 @@ int usbip_attach(int argc, char *argv[]) int ret = -1; for (;;) { - opt = getopt_long(argc, argv, "h:b:", opts, NULL); + opt = getopt_long(argc, argv, "r:b:", opts, NULL); if (opt == -1) break; switch (opt) { - case 'h': + case 'r': host = optarg; break; case 'b': -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:09:11
|
From: Kurt Kanzenbach <ly8...@ci...> In each errorcase spin_unlock_irq is called and -EINVAL is returned. To simplify that I created a label called "err" doing that. On Success count will be returned. Signed-off-by: Kurt Kanzenbach <ly8...@ci...> Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/stub_dev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index 471cd2a..c75ae63 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -86,6 +86,7 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr, struct stub_device *sdev = dev_get_drvdata(dev); int sockfd = 0; struct socket *socket; + ssize_t err = -EINVAL; if (!sdev) { dev_err(dev, "sdev is null\n"); @@ -101,15 +102,13 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr, if (sdev->ud.status != SDEV_ST_AVAILABLE) { dev_err(dev, "not ready\n"); - spin_unlock_irq(&sdev->ud.lock); - return -EINVAL; + goto err; } socket = sockfd_to_socket(sockfd); - if (!socket) { - spin_unlock_irq(&sdev->ud.lock); - return -EINVAL; - } + if (!socket) + goto err; + sdev->ud.tcp_socket = socket; spin_unlock_irq(&sdev->ud.lock); @@ -127,16 +126,19 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr, dev_info(dev, "stub down\n"); spin_lock_irq(&sdev->ud.lock); - if (sdev->ud.status != SDEV_ST_USED) { - spin_unlock_irq(&sdev->ud.lock); - return -EINVAL; - } + if (sdev->ud.status != SDEV_ST_USED) + goto err; + spin_unlock_irq(&sdev->ud.lock); usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); } return count; + +err: + spin_unlock_irq(&sdev->ud.lock); + return err; } static DEVICE_ATTR(usbip_sockfd, S_IWUSR, NULL, store_sockfd); -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:09:07
|
From: Kurt Kanzenbach <ly8...@ci...> Since the names.c/names.h are taken from another project, some functions which names.c provides aren't used by usbipd. This patch fixes: - removed useless comments - unified debug/error messages by using the macros provided by usbip_common.h - removed unnused code The code cleanup includes: - remove unused data structures - remove code to create them - remove code to access them The file names.c is used to parse the `usb.ids' file. The parser stores a lot of information about usb devices that is never used. The `usb.ids' file has several sections. Some variables (like `lasthut') store the ID of the current section, and those variables are used to decide which section is currently being parsed (i.e. in which data structure the current line will be stored). We removed the code to read those IDs because they are never used anyway. We replaced them by the pseudo-ID `1' (instead of reading the ID from the file) to indicate that the parser is in a section that can be ignored. If the parser is in such a section, the current line (which contains sub-items for this section) is discarded. Signed-off-by: Kurt Kanzenbach <ly8...@ci...> Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/userspace/libsrc/names.c | 495 ++++--------------------- drivers/staging/usbip/userspace/libsrc/names.h | 21 +- 2 files changed, 67 insertions(+), 449 deletions(-) diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c index 72480fb..3c8d28b 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/drivers/staging/usbip/userspace/libsrc/names.c @@ -1,4 +1,3 @@ -/*****************************************************************************/ /* * names.c -- USB name database manipulation routines * @@ -19,15 +18,14 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * - */ - -/* + * + * + * * Copyright (C) 2005 Takahiro Hirofuchi * - names_deinit() is added. + * */ -/*****************************************************************************/ - #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -39,11 +37,8 @@ #include <stdio.h> #include <ctype.h> - #include "names.h" - - -/* ---------------------------------------------------------------------- */ +#include "usbip_common.h" struct vendor { struct vendor *next; @@ -75,19 +70,12 @@ struct protocol { char name[1]; }; -struct audioterminal { - struct audioterminal *next; - u_int16_t termt; - char name[1]; -}; - struct genericstrtable { struct genericstrtable *next; unsigned int num; char name[1]; }; -/* ---------------------------------------------------------------------- */ #define HASH1 0x10 #define HASH2 0x02 @@ -103,75 +91,12 @@ static unsigned int hashnum(unsigned int num) return num & (HASHSZ-1); } -/* ---------------------------------------------------------------------- */ static struct vendor *vendors[HASHSZ] = { NULL, }; static struct product *products[HASHSZ] = { NULL, }; static struct class *classes[HASHSZ] = { NULL, }; static struct subclass *subclasses[HASHSZ] = { NULL, }; static struct protocol *protocols[HASHSZ] = { NULL, }; -static struct audioterminal *audioterminals[HASHSZ] = { NULL, }; -static struct genericstrtable *hiddescriptors[HASHSZ] = { NULL, }; -static struct genericstrtable *reports[HASHSZ] = { NULL, }; -static struct genericstrtable *huts[HASHSZ] = { NULL, }; -static struct genericstrtable *biass[HASHSZ] = { NULL, }; -static struct genericstrtable *physdess[HASHSZ] = { NULL, }; -static struct genericstrtable *hutus[HASHSZ] = { NULL, }; -static struct genericstrtable *langids[HASHSZ] = { NULL, }; -static struct genericstrtable *countrycodes[HASHSZ] = { NULL, }; - -/* ---------------------------------------------------------------------- */ - -static const char *names_genericstrtable(struct genericstrtable *t[HASHSZ], - unsigned int index) -{ - struct genericstrtable *h; - - for (h = t[hashnum(index)]; h; h = h->next) - if (h->num == index) - return h->name; - return NULL; -} - -const char *names_hid(u_int8_t hidd) -{ - return names_genericstrtable(hiddescriptors, hidd); -} - -const char *names_reporttag(u_int8_t rt) -{ - return names_genericstrtable(reports, rt); -} - -const char *names_huts(unsigned int data) -{ - return names_genericstrtable(huts, data); -} - -const char *names_hutus(unsigned int data) -{ - return names_genericstrtable(hutus, data); -} - -const char *names_langid(u_int16_t langid) -{ - return names_genericstrtable(langids, langid); -} - -const char *names_physdes(u_int8_t ph) -{ - return names_genericstrtable(physdess, ph); -} - -const char *names_bias(u_int8_t b) -{ - return names_genericstrtable(biass, b); -} - -const char *names_countrycode(unsigned int countrycode) -{ - return names_genericstrtable(countrycodes, countrycode); -} const char *names_vendor(u_int16_t vendorid) { @@ -231,20 +156,7 @@ const char *names_protocol(u_int8_t classid, u_int8_t subclassid, return NULL; } -const char *names_audioterminal(u_int16_t termt) -{ - struct audioterminal *at; - - at = audioterminals[hashnum(termt)]; - for (; at; at = at->next) - if (at->termt == termt) - return at->name; - return NULL; -} - -/* ---------------------------------------------------------------------- */ /* add a cleanup function by takahiro */ - struct pool { struct pool *next; void *mem; @@ -291,8 +203,6 @@ void names_free(void) } } -/* ---------------------------------------------------------------------- */ - static int new_vendor(const char *name, u_int16_t vendorid) { struct vendor *v; @@ -396,87 +306,6 @@ static int new_protocol(const char *name, u_int8_t classid, u_int8_t subclassid, return 0; } -static int new_audioterminal(const char *name, u_int16_t termt) -{ - struct audioterminal *at; - unsigned int h = hashnum(termt); - - at = audioterminals[h]; - for (; at; at = at->next) - if (at->termt == termt) - return -1; - at = my_malloc(sizeof(struct audioterminal) + strlen(name)); - if (!at) - return -1; - strcpy(at->name, name); - at->termt = termt; - at->next = audioterminals[h]; - audioterminals[h] = at; - return 0; -} - -static int new_genericstrtable(struct genericstrtable *t[HASHSZ], - const char *name, unsigned int index) -{ - struct genericstrtable *g; - unsigned int h = hashnum(index); - - for (g = t[h]; g; g = g->next) - if (g->num == index) - return -1; - g = my_malloc(sizeof(struct genericstrtable) + strlen(name)); - if (!g) - return -1; - strcpy(g->name, name); - g->num = index; - g->next = t[h]; - t[h] = g; - return 0; -} - -static int new_hid(const char *name, u_int8_t hidd) -{ - return new_genericstrtable(hiddescriptors, name, hidd); -} - -static int new_reporttag(const char *name, u_int8_t rt) -{ - return new_genericstrtable(reports, name, rt); -} - -static int new_huts(const char *name, unsigned int data) -{ - return new_genericstrtable(huts, name, data); -} - -static int new_hutus(const char *name, unsigned int data) -{ - return new_genericstrtable(hutus, name, data); -} - -static int new_langid(const char *name, u_int16_t langid) -{ - return new_genericstrtable(langids, name, langid); -} - -static int new_physdes(const char *name, u_int8_t ph) -{ - return new_genericstrtable(physdess, name, ph); -} -static int new_bias(const char *name, u_int8_t b) -{ - return new_genericstrtable(biass, name, b); -} - -static int new_countrycode(const char *name, unsigned int countrycode) -{ - return new_genericstrtable(countrycodes, name, countrycode); -} - -/* ---------------------------------------------------------------------- */ - -#define DBG(x) - static void parse(FILE *f) { char buf[512], *cp; @@ -500,109 +329,27 @@ static void parse(FILE *f) if (buf[0] == '#' || !buf[0]) continue; cp = buf; - if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' - && buf[3] == 'S' && buf[4] == 'D' && buf[5] == 'E' - && buf[6] == 'S' && /*isspace(buf[7])*/ buf[7] == ' ') { - cp = buf + 8; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid Physdes type at line %u\n", - linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid Physdes type at line %u\n", - linectr); - continue; - } - if (new_physdes(cp, u)) - fprintf(stderr, "Duplicate Physdes type spec at line %u terminal type %04x %s\n", - linectr, u, cp); - DBG(printf("line %5u physdes type %02x %s\n", linectr, - u, cp)); + if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' && + buf[3] == 'S' && buf[4] == 'D' && + buf[5] == 'E' && buf[6] == 'S' && /*isspace(buf[7])*/ + buf[7] == ' ') { continue; - } - if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' - && /*isspace(buf[3])*/ buf[3] == ' ') { - cp = buf + 4; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid PHY type at line %u\n", - linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid PHY type at line %u\n", - linectr); - continue; - } - if (new_physdes(cp, u)) - fprintf(stderr, "Duplicate PHY type spec at line %u terminal type %04x %s\n", - linectr, u, cp); - DBG(printf("line %5u PHY type %02x %s\n", linectr, u, - cp)); + if (buf[0] == 'P' && buf[1] == 'H' && + buf[2] == 'Y' && /*isspace(buf[3])*/ buf[3] == ' ') { continue; - } - if (buf[0] == 'B' && buf[1] == 'I' && buf[2] == 'A' - && buf[3] == 'S' && /*isspace(buf[4])*/ buf[4] == ' ') { - cp = buf + 5; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid BIAS type at line %u\n", - linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid BIAS type at line %u\n", - linectr); - continue; - } - if (new_bias(cp, u)) - fprintf(stderr, "Duplicate BIAS type spec at line %u terminal type %04x %s\n", - linectr, u, cp); - DBG(printf("line %5u BIAS type %02x %s\n", linectr, u, - cp)); + if (buf[0] == 'B' && buf[1] == 'I' && buf[2] == 'A' && + buf[3] == 'S' && /*isspace(buf[4])*/ buf[4] == ' ') { continue; - } if (buf[0] == 'L' && /*isspace(buf[1])*/ buf[1] == ' ') { - cp = buf+2; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid LANGID spec at line %u\n", - linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid LANGID spec at line %u\n", - linectr); - continue; - } - if (new_langid(cp, u)) - fprintf(stderr, "Duplicate LANGID spec at line %u language-id %04x %s\n", - linectr, u, cp); - DBG(printf("line %5u LANGID %02x %s\n", linectr, u, - cp)); lasthut = lastclass = lastvendor = lastsubclass = -1; - lastlang = u; + /* + * set 1 as pseudo-id to indicate that the parser is + * in a `L' section. + */ + lastlang = 1; continue; } if (buf[0] == 'C' && /*isspace(buf[1])*/ buf[1] == ' ') { @@ -611,75 +358,31 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid class spec at line %u\n", - linectr); + err("Invalid class spec at line %u", linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid class spec at line %u\n", - linectr); + err("Invalid class spec at line %u", linectr); continue; } if (new_class(cp, u)) - fprintf(stderr, "Duplicate class spec at line %u class %04x %s\n", - linectr, u, cp); - DBG(printf("line %5u class %02x %s\n", linectr, u, cp)); + err("Duplicate class spec at line %u class %04x %s", + linectr, u, cp); + dbg("line %5u class %02x %s", linectr, u, cp); lasthut = lastlang = lastvendor = lastsubclass = -1; lastclass = u; continue; } if (buf[0] == 'A' && buf[1] == 'T' && isspace(buf[2])) { /* audio terminal type spec */ - cp = buf+3; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid audio terminal type at line %u\n", - linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid audio terminal type at line %u\n", - linectr); - continue; - } - if (new_audioterminal(cp, u)) - fprintf(stderr, "Duplicate audio terminal type spec at line %u terminal type %04x %s\n", - linectr, u, cp); - DBG(printf("line %5u audio terminal type %02x %s\n", - linectr, u, cp)); continue; } if (buf[0] == 'H' && buf[1] == 'C' && buf[2] == 'C' && isspace(buf[3])) { /* HID Descriptor bCountryCode */ - cp = buf+3; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid HID country code at line %u\n", - linectr); - continue; - } - u = strtoul(cp, &cp, 10); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid HID country code at line %u\n", - linectr); - continue; - } - if (new_countrycode(cp, u)) - fprintf(stderr, "Duplicate HID country code at line %u country %02u %s\n", - linectr, u, cp); - DBG(printf("line %5u keyboard country code %02u %s\n", - linectr, u, cp)); continue; } if (isxdigit(*cp)) { @@ -688,15 +391,13 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid vendor spec at line %u\n", - linectr); + err("Invalid vendor spec at line %u", linectr); continue; } if (new_vendor(cp, u)) - fprintf(stderr, "Duplicate vendor spec at line %u vendor %04x %s\n", - linectr, u, cp); - DBG(printf("line %5u vendor %04x %s\n", linectr, u, - cp)); + err("Duplicate vendor spec at line %u vendor %04x %s", + linectr, u, cp); + dbg("line %5u vendor %04x %s", linectr, u, cp); lastvendor = u; lasthut = lastlang = lastclass = lastsubclass = -1; continue; @@ -707,41 +408,37 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid product/subclass spec at line %u\n", - linectr); + err("Invalid product/subclass spec at line %u", + linectr); continue; } if (lastvendor != -1) { if (new_product(cp, lastvendor, u)) - fprintf(stderr, "Duplicate product spec at line %u product %04x:%04x %s\n", - linectr, lastvendor, u, cp); - DBG(printf("line %5u product %04x:%04x %s\n", - linectr, lastvendor, u, cp)); + err("Duplicate product spec at line %u product %04x:%04x %s", + linectr, lastvendor, u, cp); + dbg("line %5u product %04x:%04x %s", linectr, + lastvendor, u, cp); continue; } if (lastclass != -1) { if (new_subclass(cp, lastclass, u)) - fprintf(stderr, "Duplicate subclass spec at line %u class %02x:%02x %s\n", - linectr, lastclass, u, cp); - DBG(printf("line %5u subclass %02x:%02x %s\n", - linectr, lastclass, u, cp)); + err("Duplicate subclass spec at line %u class %02x:%02x %s", + linectr, lastclass, u, cp); + dbg("line %5u subclass %02x:%02x %s", linectr, + lastclass, u, cp); lastsubclass = u; continue; } if (lasthut != -1) { - if (new_hutus(cp, (lasthut << 16)+u)) - fprintf(stderr, "Duplicate HUT Usage Spec at line %u\n", - linectr); + /* do not store hut */ continue; } if (lastlang != -1) { - if (new_langid(cp, lastlang+(u<<10))) - fprintf(stderr, "Duplicate LANGID Usage Spec at line %u\n", - linectr); + /* do not store langid */ continue; } - fprintf(stderr, "Product/Subclass spec without prior Vendor/Class spec at line %u\n", - linectr); + err("Product/Subclass spec without prior Vendor/Class spec at line %u", + linectr); continue; } if (buf[0] == '\t' && buf[1] == '\t' && isxdigit(buf[2])) { @@ -750,110 +447,48 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid protocol spec at line %u\n", - linectr); + err("Invalid protocol spec at line %u", + linectr); continue; } if (lastclass != -1 && lastsubclass != -1) { - if (new_protocol(cp, lastclass, lastsubclass, u)) - fprintf(stderr, "Duplicate protocol spec at line %u class %02x:%02x:%02x %s\n", - linectr, lastclass, lastsubclass, u, cp); - DBG(printf("line %5u protocol %02x:%02x:%02x %s\n", - linectr, lastclass, lastsubclass, u, cp)); + if (new_protocol(cp, lastclass, lastsubclass, + u)) + err("Duplicate protocol spec at line %u class %02x:%02x:%02x %s", + linectr, lastclass, lastsubclass, + u, cp); + dbg("line %5u protocol %02x:%02x:%02x %s", + linectr, lastclass, lastsubclass, u, cp); continue; } - fprintf(stderr, "Protocol spec without prior Class and Subclass spec at line %u\n", - linectr); + err("Protocol spec without prior Class and Subclass spec at line %u", + linectr); continue; } - if (buf[0] == 'H' && buf[1] == 'I' && buf[2] == 'D' - && /*isspace(buf[3])*/ buf[3] == ' ') { - cp = buf + 4; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid HID type at line %u\n", - linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid HID type at line %u\n", - linectr); - continue; - } - if (new_hid(cp, u)) - fprintf(stderr, "Duplicate HID type spec at line %u terminal type %04x %s\n", - linectr, u, cp); - DBG(printf("line %5u HID type %02x %s\n", linectr, u, - cp)); + if (buf[0] == 'H' && buf[1] == 'I' && + buf[2] == 'D' && /*isspace(buf[3])*/ buf[3] == ' ') { continue; - } - if (buf[0] == 'H' && buf[1] == 'U' && buf[2] == 'T' - && /*isspace(buf[3])*/ buf[3] == ' ') { - cp = buf + 4; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid HUT type at line %u\n", - linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid HUT type at line %u\n", - linectr); - continue; - } - if (new_huts(cp, u)) - fprintf(stderr, "Duplicate HUT type spec at line %u terminal type %04x %s\n", - linectr, u, cp); + if (buf[0] == 'H' && buf[1] == 'U' && + buf[2] == 'T' && /*isspace(buf[3])*/ buf[3] == ' ') { lastlang = lastclass = lastvendor = lastsubclass = -1; - lasthut = u; - DBG(printf("line %5u HUT type %02x %s\n", linectr, u, - cp)); + /* + * set 1 as pseudo-id to indicate that the parser is + * in a `HUT' section. + */ + lasthut = 1; continue; - } - if (buf[0] == 'R' && buf[1] == ' ') { - cp = buf + 2; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid Report type at line %u\n", - linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid Report type at line %u\n", - linectr); - continue; - } - if (new_reporttag(cp, u)) - fprintf(stderr, "Duplicate Report type spec at line %u terminal type %04x %s\n", - linectr, u, cp); - DBG(printf("line %5u Report type %02x %s\n", linectr, - u, cp)); + if (buf[0] == 'R' && buf[1] == ' ') continue; - } - if (buf[0] == 'V' && buf[1] == 'T') { - /* add here */ + if (buf[0] == 'V' && buf[1] == 'T') continue; - } - fprintf(stderr, "Unknown line at line %u\n", linectr); + + err("Unknown line at line %u", linectr); } } -/* ---------------------------------------------------------------------- */ int names_init(char *n) { diff --git a/drivers/staging/usbip/userspace/libsrc/names.h b/drivers/staging/usbip/userspace/libsrc/names.h index 28dafc5..6809265 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.h +++ b/drivers/staging/usbip/userspace/libsrc/names.h @@ -1,5 +1,3 @@ -/*****************************************************************************/ - /* * names.h -- USB name database manipulation routines * @@ -20,39 +18,24 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * - */ - -/* + * * Copyright (C) 2005 Takahiro Hirofuchi * - names_free() is added. */ -/*****************************************************************************/ - #ifndef _NAMES_H #define _NAMES_H #include <sys/types.h> -/* ---------------------------------------------------------------------- */ - +/* used by usbip_common.c */ extern const char *names_vendor(u_int16_t vendorid); extern const char *names_product(u_int16_t vendorid, u_int16_t productid); extern const char *names_class(u_int8_t classid); extern const char *names_subclass(u_int8_t classid, u_int8_t subclassid); extern const char *names_protocol(u_int8_t classid, u_int8_t subclassid, u_int8_t protocolid); -extern const char *names_audioterminal(u_int16_t termt); -extern const char *names_hid(u_int8_t hidd); -extern const char *names_reporttag(u_int8_t rt); -extern const char *names_huts(unsigned int data); -extern const char *names_hutus(unsigned int data); -extern const char *names_langid(u_int16_t langid); -extern const char *names_physdes(u_int8_t ph); -extern const char *names_bias(u_int8_t b); -extern const char *names_countrycode(unsigned int countrycode); extern int names_init(char *n); extern void names_free(void); -/* ---------------------------------------------------------------------- */ #endif /* _NAMES_H */ -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:09:07
|
Call freeaddrinfo when connect/listen fails. Call usbip_host_driver_close on error. Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/userspace/src/usbip_network.c | 4 ++-- drivers/staging/usbip/userspace/src/usbipd.c | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/staging/usbip/userspace/src/usbip_network.c b/drivers/staging/usbip/userspace/src/usbip_network.c index 4cb76e5..b12448e 100644 --- a/drivers/staging/usbip/userspace/src/usbip_network.c +++ b/drivers/staging/usbip/userspace/src/usbip_network.c @@ -248,10 +248,10 @@ int usbip_net_tcp_connect(char *hostname, char *service) close(sockfd); } + freeaddrinfo(res); + if (!rp) return EAI_SYSTEM; - freeaddrinfo(res); - return sockfd; } diff --git a/drivers/staging/usbip/userspace/src/usbipd.c b/drivers/staging/usbip/userspace/src/usbipd.c index cc3be17..3f10c51 100644 --- a/drivers/staging/usbip/userspace/src/usbipd.c +++ b/drivers/staging/usbip/userspace/src/usbipd.c @@ -448,6 +448,7 @@ static int do_standalone_mode(int daemonize) if (daemonize) { if (daemon(0, 0) < 0) { err("daemonizing failed: %s", strerror(errno)); + usbip_host_driver_close(); return -1; } umask(0); @@ -456,14 +457,18 @@ static int do_standalone_mode(int daemonize) set_signal(); ai_head = do_getaddrinfo(NULL, PF_UNSPEC); - if (!ai_head) + if (!ai_head) { + usbip_host_driver_close(); return -1; + } info("starting " PROGNAME " (%s)", usbip_version_string); nsockfd = listen_all_addrinfo(ai_head, sockfdlist); if (nsockfd <= 0) { err("failed to open a listening socket"); + freeaddrinfo(ai_head); + usbip_host_driver_close(); return -1; } fds = calloc(nsockfd, sizeof(struct pollfd)); -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:09:07
|
From: Kurt Kanzenbach <ly8...@ci...> This patch simplified "stub_device_free" cleanup function: - changed return type to void, since the return value is not checked anywhere - kfree is NULL-safe, so removed if statement - deleted debug-message Signed-off-by: Kurt Kanzenbach <ly8...@ci...> Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/stub_dev.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index c75ae63..83d629a 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -327,15 +327,9 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev, return sdev; } -static int stub_device_free(struct stub_device *sdev) +static void stub_device_free(struct stub_device *sdev) { - if (!sdev) - return -EINVAL; - kfree(sdev); - pr_debug("kfree udev ok\n"); - - return 0; } /* -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:09:06
|
Fix an indent. Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/usbip_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c index 539fa57..7b97df6 100644 --- a/drivers/staging/usbip/usbip_common.c +++ b/drivers/staging/usbip/usbip_common.c @@ -389,7 +389,7 @@ int usbip_recv(struct socket *sock, void *buf, int size) pr_debug("receiving....\n"); usbip_dump_buffer(bp, osize); pr_debug("received, osize %d ret %d size %d total %d\n", - osize, result, size, total); + osize, result, size, total); } return total; -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:04:10
|
Remove broken preprocessor macro "hardware". It is unused and it references an element (pdev in vhci_hcd) that does not exist. Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/vhci.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/usbip/vhci.h b/drivers/staging/usbip/vhci.h index 5dddc4d..a863a98 100644 --- a/drivers/staging/usbip/vhci.h +++ b/drivers/staging/usbip/vhci.h @@ -95,7 +95,6 @@ struct vhci_hcd { extern struct vhci_hcd *the_controller; extern const struct attribute_group dev_attr_group; -#define hardware (&the_controller->pdev.dev) /* vhci_hcd.c */ void rh_port_connect(int rhport, enum usb_device_speed speed); -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:04:07
|
replace numbers in code by ascii text constants as suggested by Dan Carpenter: http://driverdev.linuxdriverproject.org/pipermail/devel/2013-February/035907.html Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/userspace/libsrc/names.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c index 3b151df..72480fb 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/drivers/staging/usbip/userspace/libsrc/names.c @@ -491,10 +491,10 @@ static void parse(FILE *f) while (fgets(buf, sizeof(buf), f)) { linectr++; /* remove line ends */ - cp = strchr(buf, 13); + cp = strchr(buf, '\r'); if (cp) *cp = 0; - cp = strchr(buf, 10); + cp = strchr(buf, '\n'); if (cp) *cp = 0; if (buf[0] == '#' || !buf[0]) -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:04:04
|
From: Kurt Kanzenbach <ly8...@ci...> Enumerations for one comment makes no sense. This is why this should be removed. Signed-off-by: Kurt Kanzenbach <ly8...@ci...> Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/stub_dev.c | 2 +- drivers/staging/usbip/stub_rx.c | 2 +- drivers/staging/usbip/vhci_rx.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index 0a70b8e..471cd2a 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -452,7 +452,7 @@ static void shutdown_busid(struct bus_id_priv *busid_priv) busid_priv->shutdown_busid = 1; usbip_event_add(&busid_priv->sdev->ud, SDEV_EVENT_REMOVED); - /* 2. wait for the stop of the event handler */ + /* wait for the stop of the event handler */ usbip_stop_eh(&busid_priv->sdev->ud); } } diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index 9fc62b3..db48a78 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c @@ -552,7 +552,7 @@ static void stub_rx_pdu(struct usbip_device *ud) memset(&pdu, 0, sizeof(pdu)); - /* 1. receive a pdu header */ + /* receive a pdu header */ ret = usbip_recv(ud->tcp_socket, &pdu, sizeof(pdu)); if (ret != sizeof(pdu)) { dev_err(dev, "recv a header, %d\n", ret); diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c index 50d6fd5..d07fcb5 100644 --- a/drivers/staging/usbip/vhci_rx.c +++ b/drivers/staging/usbip/vhci_rx.c @@ -206,7 +206,7 @@ static void vhci_rx_pdu(struct usbip_device *ud) memset(&pdu, 0, sizeof(pdu)); - /* 1. receive a pdu header */ + /* receive a pdu header */ ret = usbip_recv(ud->tcp_socket, &pdu, sizeof(pdu)); if (ret < 0) { if (ret == -ECONNRESET) -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:04:04
|
From: Kurt Kanzenbach <ly8...@ci...> Reformat function stub_recv_cmd_unlink() to improve readability. Signed-off-by: Kurt Kanzenbach <ly8...@ci...> Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/stub_rx.c | 98 ++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index 715e8a7..9fc62b3 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c @@ -228,61 +228,61 @@ static void tweak_special_requests(struct urb *urb) static int stub_recv_cmd_unlink(struct stub_device *sdev, struct usbip_header *pdu) { + int ret; unsigned long flags; - struct stub_priv *priv; spin_lock_irqsave(&sdev->priv_lock, flags); list_for_each_entry(priv, &sdev->priv_init, list) { - if (priv->seqnum == pdu->u.cmd_unlink.seqnum) { - int ret; - - dev_info(&priv->urb->dev->dev, "unlink urb %p\n", - priv->urb); - - /* - * This matched urb is not completed yet (i.e., be in - * flight in usb hcd hardware/driver). Now we are - * cancelling it. The unlinking flag means that we are - * now not going to return the normal result pdu of a - * submission request, but going to return a result pdu - * of the unlink request. - */ - priv->unlinking = 1; - - /* - * In the case that unlinking flag is on, prev->seqnum - * is changed from the seqnum of the cancelling urb to - * the seqnum of the unlink request. This will be used - * to make the result pdu of the unlink request. - */ - priv->seqnum = pdu->base.seqnum; - - spin_unlock_irqrestore(&sdev->priv_lock, flags); - - /* - * usb_unlink_urb() is now out of spinlocking to avoid - * spinlock recursion since stub_complete() is - * sometimes called in this context but not in the - * interrupt context. If stub_complete() is executed - * before we call usb_unlink_urb(), usb_unlink_urb() - * will return an error value. In this case, stub_tx - * will return the result pdu of this unlink request - * though submission is completed and actual unlinking - * is not executed. OK? - */ - /* In the above case, urb->status is not -ECONNRESET, - * so a driver in a client host will know the failure - * of the unlink request ? - */ - ret = usb_unlink_urb(priv->urb); - if (ret != -EINPROGRESS) - dev_err(&priv->urb->dev->dev, - "failed to unlink a urb %p, ret %d\n", - priv->urb, ret); - return 0; - } + if (priv->seqnum != pdu->u.cmd_unlink.seqnum) + continue; + + dev_info(&priv->urb->dev->dev, "unlink urb %p\n", + priv->urb); + + /* + * This matched urb is not completed yet (i.e., be in + * flight in usb hcd hardware/driver). Now we are + * cancelling it. The unlinking flag means that we are + * now not going to return the normal result pdu of a + * submission request, but going to return a result pdu + * of the unlink request. + */ + priv->unlinking = 1; + + /* + * In the case that unlinking flag is on, prev->seqnum + * is changed from the seqnum of the cancelling urb to + * the seqnum of the unlink request. This will be used + * to make the result pdu of the unlink request. + */ + priv->seqnum = pdu->base.seqnum; + + spin_unlock_irqrestore(&sdev->priv_lock, flags); + + /* + * usb_unlink_urb() is now out of spinlocking to avoid + * spinlock recursion since stub_complete() is + * sometimes called in this context but not in the + * interrupt context. If stub_complete() is executed + * before we call usb_unlink_urb(), usb_unlink_urb() + * will return an error value. In this case, stub_tx + * will return the result pdu of this unlink request + * though submission is completed and actual unlinking + * is not executed. OK? + */ + /* In the above case, urb->status is not -ECONNRESET, + * so a driver in a client host will know the failure + * of the unlink request ? + */ + ret = usb_unlink_urb(priv->urb); + if (ret != -EINPROGRESS) + dev_err(&priv->urb->dev->dev, + "failed to unlink a urb %p, ret %d\n", + priv->urb, ret); + + return 0; } usbip_dbg_stub_rx("seqnum %d is not pending\n", -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:04:04
|
Code cleanup for the usbip driver. - delete unused code - improve readability - improve usability of the command line tools Kurt and I did this work together. Kurt Kanzenbach (10): staging: usbip: reformat function stub_recv_cmd_unlink() staging: usbip: removed enumeration of comments staging: usbip: simplified errorhandling staging: usbip: removed unnecessary if-else-statements staging: usbip: removed unnecessary for loop staging: usbip: simplified cleanup function staging: usbip: userspace: removed unnecessary code staging: usbip: userspace: libsrc: cleanup parsing staging: usbip: userspace: unified command line arguments staging: usbip: userspace: show product name in `list -l' command Stefan Reif (5): staging: usbip: userspace: libsrc: replace numbers by ascii staging: usbip: reformat function pickup_urb_and_free_priv staging: usbip: remove unnused, broken macro staging: usbip: simple indent fix staging: usbip: userspace: avoid memory leaks drivers/staging/usbip/stub_dev.c | 32 +- drivers/staging/usbip/stub_main.c | 34 +- drivers/staging/usbip/stub_rx.c | 100 ++--- drivers/staging/usbip/usbip_common.c | 2 +- drivers/staging/usbip/userspace/README | 4 +- drivers/staging/usbip/userspace/doc/usbip.8 | 4 +- drivers/staging/usbip/userspace/libsrc/names.c | 499 +++------------------ drivers/staging/usbip/userspace/libsrc/names.h | 21 +- drivers/staging/usbip/userspace/src/usbip_attach.c | 12 +- drivers/staging/usbip/userspace/src/usbip_list.c | 12 + .../staging/usbip/userspace/src/usbip_network.c | 4 +- drivers/staging/usbip/userspace/src/usbipd.c | 11 +- drivers/staging/usbip/vhci.h | 1 - drivers/staging/usbip/vhci_rx.c | 56 +-- 14 files changed, 211 insertions(+), 581 deletions(-) -- 1.8.1 |
From: Stefan R. <ke4...@ci...> - 2013-04-04 14:04:03
|
re-indent funtion "pickup_urb_and_free_priv" to improve readability. Signed-off-by: Stefan Reif <ke4...@ci...> --- drivers/staging/usbip/vhci_rx.c | 54 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c index faf8e60..50d6fd5 100644 --- a/drivers/staging/usbip/vhci_rx.c +++ b/drivers/staging/usbip/vhci_rx.c @@ -31,33 +31,37 @@ struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, __u32 seqnum) int status; list_for_each_entry_safe(priv, tmp, &vdev->priv_rx, list) { - if (priv->seqnum == seqnum) { - urb = priv->urb; - status = urb->status; - - usbip_dbg_vhci_rx("find urb %p vurb %p seqnum %u\n", - urb, priv, seqnum); - - /* TODO: fix logic here to improve indent situtation */ - if (status != -EINPROGRESS) { - if (status == -ENOENT || - status == -ECONNRESET) - dev_info(&urb->dev->dev, - "urb %p was unlinked " - "%ssynchronuously.\n", urb, - status == -ENOENT ? "" : "a"); - else - dev_info(&urb->dev->dev, - "urb %p may be in a error, " - "status %d\n", urb, status); - } - - list_del(&priv->list); - kfree(priv); - urb->hcpriv = NULL; - + if (priv->seqnum != seqnum) + continue; + + urb = priv->urb; + status = urb->status; + + usbip_dbg_vhci_rx("find urb %p vurb %p seqnum %u\n", + urb, priv, seqnum); + + switch (status) { + case -ENOENT: + /* fall through */ + case -ECONNRESET: + dev_info(&urb->dev->dev, + "urb %p was unlinked %ssynchronuously.\n", urb, + status == -ENOENT ? "" : "a"); + break; + case -EINPROGRESS: + /* no info output */ break; + default: + dev_info(&urb->dev->dev, + "urb %p may be in a error, status %d\n", urb, + status); } + + list_del(&priv->list); + kfree(priv); + urb->hcpriv = NULL; + + break; } return urb; -- 1.8.1 |
From: Xiaofan C. <xia...@gm...> - 2013-03-15 01:28:36
|
On Fri, Mar 15, 2013 at 9:06 AM, B.Vinai Kumar <vin...@gm...> wrote: > Hello, > > Sorry for my incomplete last mail, It was sent accidentally. > > I have downloaded the USBIP windows sources from SVN trunk and > extended the USBIP windows application "usbip.exe" to enumerate it as > a soft device using the USBIP bus enumerator driver(no modifications > in bus driver). > The following soft device enumeration is successful by giving the > proper descriptors and after handling the class specific control > requests. > 1) HID "soft" device > 2) USB Audio "soft" device That is nice. Maybe you want to detail what you have changed in the Windows application. Microsoft used to have the Device Simulation Framework (up to WDK 7.1) to get "soft" device but dropped DSF in the latest Windows 8 WDK. > When I make it composite device, I'm seeing the crash on(Blue screen) > windows 7 PC. > > Windows Minidump is pointing to this line of code, > > file: busenum.c > function: proc_select_config() No so sure what is the problem, but just take note most of the Windows driver only deals with one USB configuration. And make sure your config descriptor is correct. You can try to post your descriptor for the USB Composite Device to see if there are something wrong with it or not. > on One PC it is pointing to this line of code > > ---> if(NULL==pdodata->dev_config){ > KdPrint(("Warning, select config when have no get config\n")); > return STATUS_INVALID_DEVICE_REQUEST; > } > > and on other PC the crash dump is pointing to different line > > ------> if(!RtlEqualMemory(pdodata->dev_config, > req->ConfigurationDescriptor, > sizeof(*req->ConfigurationDescriptor))){ > KdPrint(("Warning, not the same config desc\n")); > return STATUS_INVALID_DEVICE_REQUEST; > } > > and the error thrown on Blue screen is > "Page Fault on non Paged Area" > > Please help me in debugging this issue? I'm familiar to Linux drivers > but Windows development is new to me. > The standard way to debug Windows driver is to use a two-pc setup with IEEE1394 cable. I have not done that myself though since I am not a software developer. http://msdn.microsoft.com/en-us/library/windows/hardware/ff556866(v=vs.85).aspx There are other ways, like this. http://briolidz.wordpress.com/2012/03/28/windows-driver-debugging-with-windbg-and-vmware/ -- Xiaofan |
From: B.Vinai K. <vin...@gm...> - 2013-03-15 01:06:50
|
Hello, Sorry for my incomplete last mail, It was sent accidentally. I have downloaded the USBIP windows sources from SVN trunk and extended the USBIP windows application "usbip.exe" to enumerate it as a soft device using the USBIP bus enumerator driver(no modifications in bus driver). The following soft device enumeration is successful by giving the proper descriptors and after handling the class specific control requests. 1) HID "soft" device 2) USB Audio "soft" device When I make it composite device, I'm seeing the crash on(Blue screen) windows 7 PC. Windows Minidump is pointing to this line of code, file: busenum.c function: proc_select_config() on One PC it is pointing to this line of code ---> if(NULL==pdodata->dev_config){ KdPrint(("Warning, select config when have no get config\n")); return STATUS_INVALID_DEVICE_REQUEST; } and on other PC the crash dump is pointing to different line ------> if(!RtlEqualMemory(pdodata->dev_config, req->ConfigurationDescriptor, sizeof(*req->ConfigurationDescriptor))){ KdPrint(("Warning, not the same config desc\n")); return STATUS_INVALID_DEVICE_REQUEST; } and the error thrown on Blue screen is "Page Fault on non Paged Area" Please help me in debugging this issue? I'm familiar to Linux drivers but Windows development is new to me. Thank You, Vinai |
From: B.Vinai K. <vin...@gm...> - 2013-03-15 00:48:42
|
Hello, I have downloaded the USBIP windows sources from SVN trunk and extended the USBIP windows application "usbip.exe" to enumerate it as a soft device using the USBIP bus enumerator driver(no modifications in bus driver). Tried the following device enumeration by filling the appropriate descriptors, 1) HID soft device 2) USB Audio soft device When I make it composite device, I'm seeing the crash on(Blue screen) windows 7 PC. minidump is pointing to this line of code, file: busenum.c function: proc_select_config() if(NULL==pdodata->dev_config){ KdPrint(("Warning, select config when have no get config\n")); return STATUS_INVALID_DEVICE_REQUEST; } |
From: Dan C. <dan...@or...> - 2013-02-23 05:51:02
|
On Fri, Feb 22, 2013 at 12:13:30PM +0100, Kurt Kanzenbach wrote: > This patch fixes the following checkpatch error: > -ERROR: do not use assignment in if condition > > Signed-off-by: Kurt Kanzenbach <ly8...@ci...> > --- > drivers/staging/usbip/userspace/libsrc/names.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c > index a66f539..3b151df 100644 > --- a/drivers/staging/usbip/userspace/libsrc/names.c > +++ b/drivers/staging/usbip/userspace/libsrc/names.c > @@ -491,9 +491,11 @@ static void parse(FILE *f) > while (fgets(buf, sizeof(buf), f)) { > linectr++; > /* remove line ends */ > - if ((cp = strchr(buf, 13))) > + cp = strchr(buf, 13); This is for another patch but 13 is '\r' > + if (cp) > *cp = 0; > - if ((cp = strchr(buf, 10))) > + cp = strchr(buf, 10); and 10 is '\n'. regards, dan carpenter |
From: Dan C. <dan...@or...> - 2013-02-23 05:44:08
|
On Fri, Feb 22, 2013 at 12:13:28PM +0100, Kurt Kanzenbach wrote: > This patch fixes the following checkpatch error: > -ERROR: "(foo*)" should be "(foo *)" > > Signed-off-by: Kurt Kanzenbach <ly8...@ci...> > --- > drivers/staging/usbip/userspace/libsrc/vhci_driver.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c > index 7a5da58..b9c6e2a 100644 > --- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c > +++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c > @@ -36,7 +36,7 @@ static struct usbip_imported_device *imported_device_init(struct usbip_imported_ > goto err; > > memcpy(new_cdev, cdev, sizeof(*new_cdev)); > - dlist_unshift(idev->cdev_list, (void*) new_cdev); > + dlist_unshift(idev->cdev_list, (void *) new_cdev); Don't resend, but there shouldn't be a space after the cast: dlist_unshift(idev->cdev_list, (void *)new_cdev); Cast operations have a high precedence in C and keeping things close together makes it easier to remember. Also it looks less like a math operations. regards, dan carpenter |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:32
|
This patch fixes the following checkpatch errors: -ERROR: do not initialise statics to 0 or NULL -ERROR: do not initialise globals to 0 or NULL Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/userspace/libsrc/names.c | 2 +- drivers/staging/usbip/userspace/libsrc/usbip_common.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c index 448d09d..8fe932d 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/drivers/staging/usbip/userspace/libsrc/names.c @@ -246,7 +246,7 @@ struct pool { void *mem; }; -static struct pool *pool_head = NULL; +static struct pool *pool_head; static void *my_malloc(size_t size) { diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.c b/drivers/staging/usbip/userspace/libsrc/usbip_common.c index 154b4b1..98dc3df 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c +++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.c @@ -8,9 +8,9 @@ #undef PROGNAME #define PROGNAME "libusbip" -int usbip_use_syslog = 0; -int usbip_use_stderr = 0; -int usbip_use_debug = 0; +int usbip_use_syslog; +int usbip_use_stderr; +int usbip_use_debug; struct speed_string { int num; -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:32
|
Stefan and I fixed some coding style issues as reported by checkpatch.pl Kurt Kanzenbach (8): staging: usbip: userspace: libsrc: fix indention staging: usbip: userspace: libsrc: do not init static/globals to 0 staging: usbip: userspace: libsrc: spaces required around that '=' staging: usbip: userspace: libsrc: (foo*) should be (foo *) staging: usbip: userspace: libsrc: replaced lines over 80 characters staging: usbip: userspace: libsrc: removed assignments in if conditions staging: usbip: userspace: libsrc: added missing space staging: usbip: removed lines over 80 characters Stefan Reif (2): staging: usbip: remove unnecessary braces staging: usbip: userspace: fix whitespace errors drivers/staging/usbip/stub_dev.c | 6 +- drivers/staging/usbip/userspace/libsrc/names.c | 532 +++++++++++--------- drivers/staging/usbip/userspace/libsrc/names.h | 3 +- .../staging/usbip/userspace/libsrc/usbip_common.c | 28 +- .../staging/usbip/userspace/libsrc/usbip_common.h | 11 +- .../staging/usbip/userspace/libsrc/vhci_driver.c | 40 +- drivers/staging/usbip/userspace/src/usbip_detach.c | 2 +- .../staging/usbip/userspace/src/usbip_network.c | 2 +- .../staging/usbip/userspace/src/usbip_network.h | 4 +- drivers/staging/usbip/userspace/src/usbipd.c | 4 +- drivers/staging/usbip/vhci_hcd.c | 5 +- 11 files changed, 365 insertions(+), 272 deletions(-) -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:32
|
This patch fixes the following checkpatch error: -ERROR: spaces required around that '=' Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/userspace/libsrc/names.c | 2 +- drivers/staging/usbip/userspace/libsrc/usbip_common.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c index 8fe932d..8ee370b 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/drivers/staging/usbip/userspace/libsrc/names.c @@ -472,7 +472,7 @@ static void parse(FILE *f) { char buf[512], *cp; unsigned int linectr = 0; - int lastvendor = -1, lastclass = -1, lastsubclass = -1, lasthut=-1, lastlang=-1; + int lastvendor = -1, lastclass = -1, lastsubclass = -1, lasthut = -1, lastlang = -1; unsigned int u; while (fgets(buf, sizeof(buf), f)) { diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.c b/drivers/staging/usbip/userspace/libsrc/usbip_common.c index 98dc3df..b55df81 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c +++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.c @@ -44,7 +44,7 @@ static struct portst_string portst_strings[] = { const char *usbip_status_string(int32_t status) { - for (int i=0; portst_strings[i].desc != NULL; i++) + for (int i = 0; portst_strings[i].desc != NULL; i++) if (portst_strings[i].num == status) return portst_strings[i].desc; @@ -53,7 +53,7 @@ const char *usbip_status_string(int32_t status) const char *usbip_speed_string(int num) { - for (int i=0; speed_strings[i].speed != NULL; i++) + for (int i = 0; speed_strings[i].speed != NULL; i++) if (speed_strings[i].num == num) return speed_strings[i].desc; @@ -172,7 +172,7 @@ int read_attr_speed(struct sysfs_device *dev) err: sysfs_close_attribute(attr); - for (int i=0; speed_strings[i].speed != NULL; i++) { + for (int i = 0; speed_strings[i].speed != NULL; i++) { if (!strcmp(speed, speed_strings[i].speed)) return speed_strings[i].num; } -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:24
|
This patch fixes the following checkpatch error: -ERROR: do not use assignment in if condition Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/userspace/libsrc/names.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c index a66f539..3b151df 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/drivers/staging/usbip/userspace/libsrc/names.c @@ -491,9 +491,11 @@ static void parse(FILE *f) while (fgets(buf, sizeof(buf), f)) { linectr++; /* remove line ends */ - if ((cp = strchr(buf, 13))) + cp = strchr(buf, 13); + if (cp) *cp = 0; - if ((cp = strchr(buf, 10))) + cp = strchr(buf, 10); + if (cp) *cp = 0; if (buf[0] == '#' || !buf[0]) continue; @@ -857,9 +859,10 @@ int names_init(char *n) { FILE *f; - if (!(f = fopen(n, "r"))) { + f = fopen(n, "r"); + if (!f) return errno; - } + parse(f); fclose(f); return 0; -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:21
|
This patch fixes the following checkpatch warning: -ERROR: code indent should use tabs where possible -WARNING: suspect code indent for conditional statements Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/userspace/libsrc/names.c | 380 ++++++++++---------- .../staging/usbip/userspace/libsrc/vhci_driver.c | 20 +- 2 files changed, 200 insertions(+), 200 deletions(-) diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c index b4de18b..448d09d 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/drivers/staging/usbip/userspace/libsrc/names.c @@ -22,8 +22,8 @@ */ /* - * Copyright (C) 2005 Takahiro Hirofuchi - * - names_deinit() is added. + * Copyright (C) 2005 Takahiro Hirofuchi + * - names_deinit() is added. */ /*****************************************************************************/ @@ -82,9 +82,9 @@ struct audioterminal { }; struct genericstrtable { - struct genericstrtable *next; - unsigned int num; - char name[1]; + struct genericstrtable *next; + unsigned int num; + char name[1]; }; /* ---------------------------------------------------------------------- */ @@ -124,12 +124,12 @@ static struct genericstrtable *countrycodes[HASHSZ] = { NULL, }; static const char *names_genericstrtable(struct genericstrtable *t[HASHSZ], unsigned int index) { - struct genericstrtable *h; + struct genericstrtable *h; - for (h = t[hashnum(index)]; h; h = h->next) - if (h->num == index) - return h->name; - return NULL; + for (h = t[hashnum(index)]; h; h = h->next) + if (h->num == index) + return h->name; + return NULL; } const char *names_hid(u_int8_t hidd) @@ -409,20 +409,20 @@ static int new_audioterminal(const char *name, u_int16_t termt) static int new_genericstrtable(struct genericstrtable *t[HASHSZ], const char *name, unsigned int index) { - struct genericstrtable *g; + struct genericstrtable *g; unsigned int h = hashnum(index); - for (g = t[h]; g; g = g->next) - if (g->num == index) - return -1; - g = my_malloc(sizeof(struct genericstrtable) + strlen(name)); - if (!g) - return -1; - strcpy(g->name, name); - g->num = index; - g->next = t[h]; - t[h] = g; - return 0; + for (g = t[h]; g; g = g->next) + if (g->num == index) + return -1; + g = my_malloc(sizeof(struct genericstrtable) + strlen(name)); + if (!g) + return -1; + strcpy(g->name, name); + g->num = index; + g->next = t[h]; + t[h] = g; + return 0; } static int new_hid(const char *name, u_int8_t hidd) @@ -485,92 +485,92 @@ static void parse(FILE *f) if (buf[0] == '#' || !buf[0]) continue; cp = buf; - if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' && buf[3] == 'S' && buf[4] == 'D' && - buf[5] == 'E' && buf[6] == 'S' && /*isspace(buf[7])*/ buf[7] == ' ') { - cp = buf + 8; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid Physdes type at line %u\n", linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid Physdes type at line %u\n", linectr); - continue; - } - if (new_physdes(cp, u)) - fprintf(stderr, "Duplicate Physdes type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u physdes type %02x %s\n", linectr, u, cp)); - continue; - - } - if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' && /*isspace(buf[3])*/ buf[3] == ' ') { - cp = buf + 4; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid PHY type at line %u\n", linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid PHY type at line %u\n", linectr); - continue; - } - if (new_physdes(cp, u)) - fprintf(stderr, "Duplicate PHY type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u PHY type %02x %s\n", linectr, u, cp)); - continue; - - } - if (buf[0] == 'B' && buf[1] == 'I' && buf[2] == 'A' && buf[3] == 'S' && /*isspace(buf[4])*/ buf[4] == ' ') { - cp = buf + 5; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid BIAS type at line %u\n", linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid BIAS type at line %u\n", linectr); - continue; - } - if (new_bias(cp, u)) - fprintf(stderr, "Duplicate BIAS type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u BIAS type %02x %s\n", linectr, u, cp)); - continue; - - } - if (buf[0] == 'L' && /*isspace(buf[1])*/ buf[1] == ' ') { - cp = buf+2; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid LANGID spec at line %u\n", linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid LANGID spec at line %u\n", linectr); - continue; - } - if (new_langid(cp, u)) - fprintf(stderr, "Duplicate LANGID spec at line %u language-id %04x %s\n", linectr, u, cp); - DBG(printf("line %5u LANGID %02x %s\n", linectr, u, cp)); - lasthut = lastclass = lastvendor = lastsubclass = -1; - lastlang = u; - continue; - } + if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' && buf[3] == 'S' && buf[4] == 'D' && + buf[5] == 'E' && buf[6] == 'S' && /*isspace(buf[7])*/ buf[7] == ' ') { + cp = buf + 8; + while (isspace(*cp)) + cp++; + if (!isxdigit(*cp)) { + fprintf(stderr, "Invalid Physdes type at line %u\n", linectr); + continue; + } + u = strtoul(cp, &cp, 16); + while (isspace(*cp)) + cp++; + if (!*cp) { + fprintf(stderr, "Invalid Physdes type at line %u\n", linectr); + continue; + } + if (new_physdes(cp, u)) + fprintf(stderr, "Duplicate Physdes type spec at line %u terminal type %04x %s\n", linectr, u, cp); + DBG(printf("line %5u physdes type %02x %s\n", linectr, u, cp)); + continue; + + } + if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' && /*isspace(buf[3])*/ buf[3] == ' ') { + cp = buf + 4; + while (isspace(*cp)) + cp++; + if (!isxdigit(*cp)) { + fprintf(stderr, "Invalid PHY type at line %u\n", linectr); + continue; + } + u = strtoul(cp, &cp, 16); + while (isspace(*cp)) + cp++; + if (!*cp) { + fprintf(stderr, "Invalid PHY type at line %u\n", linectr); + continue; + } + if (new_physdes(cp, u)) + fprintf(stderr, "Duplicate PHY type spec at line %u terminal type %04x %s\n", linectr, u, cp); + DBG(printf("line %5u PHY type %02x %s\n", linectr, u, cp)); + continue; + + } + if (buf[0] == 'B' && buf[1] == 'I' && buf[2] == 'A' && buf[3] == 'S' && /*isspace(buf[4])*/ buf[4] == ' ') { + cp = buf + 5; + while (isspace(*cp)) + cp++; + if (!isxdigit(*cp)) { + fprintf(stderr, "Invalid BIAS type at line %u\n", linectr); + continue; + } + u = strtoul(cp, &cp, 16); + while (isspace(*cp)) + cp++; + if (!*cp) { + fprintf(stderr, "Invalid BIAS type at line %u\n", linectr); + continue; + } + if (new_bias(cp, u)) + fprintf(stderr, "Duplicate BIAS type spec at line %u terminal type %04x %s\n", linectr, u, cp); + DBG(printf("line %5u BIAS type %02x %s\n", linectr, u, cp)); + continue; + + } + if (buf[0] == 'L' && /*isspace(buf[1])*/ buf[1] == ' ') { + cp = buf+2; + while (isspace(*cp)) + cp++; + if (!isxdigit(*cp)) { + fprintf(stderr, "Invalid LANGID spec at line %u\n", linectr); + continue; + } + u = strtoul(cp, &cp, 16); + while (isspace(*cp)) + cp++; + if (!*cp) { + fprintf(stderr, "Invalid LANGID spec at line %u\n", linectr); + continue; + } + if (new_langid(cp, u)) + fprintf(stderr, "Duplicate LANGID spec at line %u language-id %04x %s\n", linectr, u, cp); + DBG(printf("line %5u LANGID %02x %s\n", linectr, u, cp)); + lasthut = lastclass = lastvendor = lastsubclass = -1; + lastlang = u; + continue; + } if (buf[0] == 'C' && /*isspace(buf[1])*/ buf[1] == ' ') { /* class spec */ cp = buf+2; @@ -617,24 +617,24 @@ static void parse(FILE *f) } if (buf[0] == 'H' && buf[1] == 'C' && buf[2] == 'C' && isspace(buf[3])) { /* HID Descriptor bCountryCode */ - cp = buf+3; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid HID country code at line %u\n", linectr); - continue; - } - u = strtoul(cp, &cp, 10); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid HID country code at line %u\n", linectr); - continue; - } - if (new_countrycode(cp, u)) - fprintf(stderr, "Duplicate HID country code at line %u country %02u %s\n", linectr, u, cp); - DBG(printf("line %5u keyboard country code %02u %s\n", linectr, u, cp)); - continue; + cp = buf+3; + while (isspace(*cp)) + cp++; + if (!isxdigit(*cp)) { + fprintf(stderr, "Invalid HID country code at line %u\n", linectr); + continue; + } + u = strtoul(cp, &cp, 10); + while (isspace(*cp)) + cp++; + if (!*cp) { + fprintf(stderr, "Invalid HID country code at line %u\n", linectr); + continue; + } + if (new_countrycode(cp, u)) + fprintf(stderr, "Duplicate HID country code at line %u country %02u %s\n", linectr, u, cp); + DBG(printf("line %5u keyboard country code %02u %s\n", linectr, u, cp)); + continue; } if (isxdigit(*cp)) { /* vendor */ @@ -680,10 +680,10 @@ static void parse(FILE *f) continue; } if (lastlang != -1) { - if (new_langid(cp, lastlang+(u<<10))) - fprintf(stderr, "Duplicate LANGID Usage Spec at line %u\n", linectr); - continue; - } + if (new_langid(cp, lastlang+(u<<10))) + fprintf(stderr, "Duplicate LANGID Usage Spec at line %u\n", linectr); + continue; + } fprintf(stderr, "Product/Subclass spec without prior Vendor/Class spec at line %u\n", linectr); continue; } @@ -707,70 +707,70 @@ static void parse(FILE *f) } if (buf[0] == 'H' && buf[1] == 'I' && buf[2] == 'D' && /*isspace(buf[3])*/ buf[3] == ' ') { cp = buf + 4; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid HID type at line %u\n", linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid HID type at line %u\n", linectr); - continue; - } - if (new_hid(cp, u)) - fprintf(stderr, "Duplicate HID type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u HID type %02x %s\n", linectr, u, cp)); - continue; + while (isspace(*cp)) + cp++; + if (!isxdigit(*cp)) { + fprintf(stderr, "Invalid HID type at line %u\n", linectr); + continue; + } + u = strtoul(cp, &cp, 16); + while (isspace(*cp)) + cp++; + if (!*cp) { + fprintf(stderr, "Invalid HID type at line %u\n", linectr); + continue; + } + if (new_hid(cp, u)) + fprintf(stderr, "Duplicate HID type spec at line %u terminal type %04x %s\n", linectr, u, cp); + DBG(printf("line %5u HID type %02x %s\n", linectr, u, cp)); + continue; } - if (buf[0] == 'H' && buf[1] == 'U' && buf[2] == 'T' && /*isspace(buf[3])*/ buf[3] == ' ') { - cp = buf + 4; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid HUT type at line %u\n", linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid HUT type at line %u\n", linectr); - continue; - } - if (new_huts(cp, u)) - fprintf(stderr, "Duplicate HUT type spec at line %u terminal type %04x %s\n", linectr, u, cp); + if (buf[0] == 'H' && buf[1] == 'U' && buf[2] == 'T' && /*isspace(buf[3])*/ buf[3] == ' ') { + cp = buf + 4; + while (isspace(*cp)) + cp++; + if (!isxdigit(*cp)) { + fprintf(stderr, "Invalid HUT type at line %u\n", linectr); + continue; + } + u = strtoul(cp, &cp, 16); + while (isspace(*cp)) + cp++; + if (!*cp) { + fprintf(stderr, "Invalid HUT type at line %u\n", linectr); + continue; + } + if (new_huts(cp, u)) + fprintf(stderr, "Duplicate HUT type spec at line %u terminal type %04x %s\n", linectr, u, cp); lastlang = lastclass = lastvendor = lastsubclass = -1; lasthut = u; - DBG(printf("line %5u HUT type %02x %s\n", linectr, u, cp)); - continue; - - } - if (buf[0] == 'R' && buf[1] == ' ') { - cp = buf + 2; - while (isspace(*cp)) - cp++; - if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid Report type at line %u\n", linectr); - continue; - } - u = strtoul(cp, &cp, 16); - while (isspace(*cp)) - cp++; - if (!*cp) { - fprintf(stderr, "Invalid Report type at line %u\n", linectr); - continue; - } - if (new_reporttag(cp, u)) - fprintf(stderr, "Duplicate Report type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u Report type %02x %s\n", linectr, u, cp)); - continue; - - } - if (buf[0] == 'V' && buf[1] == 'T') { + DBG(printf("line %5u HUT type %02x %s\n", linectr, u, cp)); + continue; + + } + if (buf[0] == 'R' && buf[1] == ' ') { + cp = buf + 2; + while (isspace(*cp)) + cp++; + if (!isxdigit(*cp)) { + fprintf(stderr, "Invalid Report type at line %u\n", linectr); + continue; + } + u = strtoul(cp, &cp, 16); + while (isspace(*cp)) + cp++; + if (!*cp) { + fprintf(stderr, "Invalid Report type at line %u\n", linectr); + continue; + } + if (new_reporttag(cp, u)) + fprintf(stderr, "Duplicate Report type spec at line %u terminal type %04x %s\n", linectr, u, cp); + DBG(printf("line %5u Report type %02x %s\n", linectr, u, cp)); + continue; + + } + if (buf[0] == 'V' && buf[1] == 'T') { /* add here */ continue; } diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c index 0958ba5..7a5da58 100644 --- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c +++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c @@ -289,25 +289,25 @@ static int get_nports(void) static int get_hc_busid(char *sysfs_mntpath, char *hc_busid) { - struct sysfs_driver *sdriver; - char sdriver_path[SYSFS_PATH_MAX]; + struct sysfs_driver *sdriver; + char sdriver_path[SYSFS_PATH_MAX]; struct sysfs_device *hc_dev; struct dlist *hc_devs; int found = 0; - snprintf(sdriver_path, SYSFS_PATH_MAX, "%s/%s/%s/%s/%s", sysfs_mntpath, - SYSFS_BUS_NAME, USBIP_VHCI_BUS_TYPE, SYSFS_DRIVERS_NAME, - USBIP_VHCI_DRV_NAME); + snprintf(sdriver_path, SYSFS_PATH_MAX, "%s/%s/%s/%s/%s", sysfs_mntpath, + SYSFS_BUS_NAME, USBIP_VHCI_BUS_TYPE, SYSFS_DRIVERS_NAME, + USBIP_VHCI_DRV_NAME); - sdriver = sysfs_open_driver_path(sdriver_path); - if (!sdriver) { + sdriver = sysfs_open_driver_path(sdriver_path); + if (!sdriver) { dbg("sysfs_open_driver_path failed: %s", sdriver_path); - dbg("make sure " USBIP_CORE_MOD_NAME ".ko and " + dbg("make sure " USBIP_CORE_MOD_NAME ".ko and " USBIP_VHCI_DRV_NAME ".ko are loaded!"); - return -1; - } + return -1; + } hc_devs = sysfs_get_driver_devices(sdriver); if (!hc_devs) { -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:20
|
This patch fixes the following checkpatch warning: -WARNING: line over 80 characters Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/stub_dev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index 67556ac..0a70b8e 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -114,8 +114,10 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr, spin_unlock_irq(&sdev->ud.lock); - sdev->ud.tcp_rx = kthread_get_run(stub_rx_loop, &sdev->ud, "stub_rx"); - sdev->ud.tcp_tx = kthread_get_run(stub_tx_loop, &sdev->ud, "stub_tx"); + sdev->ud.tcp_rx = kthread_get_run(stub_rx_loop, &sdev->ud, + "stub_rx"); + sdev->ud.tcp_tx = kthread_get_run(stub_tx_loop, &sdev->ud, + "stub_tx"); spin_lock_irq(&sdev->ud.lock); sdev->ud.status = SDEV_ST_USED; -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:18
|
This patch fixes the following checkpatch error: -ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/userspace/libsrc/vhci_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c index 7a5da58..b9c6e2a 100644 --- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c +++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c @@ -36,7 +36,7 @@ static struct usbip_imported_device *imported_device_init(struct usbip_imported_ goto err; memcpy(new_cdev, cdev, sizeof(*new_cdev)); - dlist_unshift(idev->cdev_list, (void*) new_cdev); + dlist_unshift(idev->cdev_list, (void *) new_cdev); } } -- 1.7.10.4 |
From: Kurt K. <ly8...@ci...> - 2013-02-22 11:33:12
|
This patch fixes some of the following checkpatch warnings: -WARNING: line over 80 characters We did not split format strings for readability. Signed-off-by: Kurt Kanzenbach <ly8...@ci...> --- drivers/staging/usbip/userspace/libsrc/names.c | 215 +++++++++++++------- drivers/staging/usbip/userspace/libsrc/names.h | 3 +- .../staging/usbip/userspace/libsrc/usbip_common.c | 16 +- .../staging/usbip/userspace/libsrc/usbip_common.h | 9 +- .../staging/usbip/userspace/libsrc/vhci_driver.c | 18 +- 5 files changed, 175 insertions(+), 86 deletions(-) diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c index 8ee370b..a66f539 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/drivers/staging/usbip/userspace/libsrc/names.c @@ -122,7 +122,8 @@ static struct genericstrtable *countrycodes[HASHSZ] = { NULL, }; /* ---------------------------------------------------------------------- */ -static const char *names_genericstrtable(struct genericstrtable *t[HASHSZ], unsigned int index) +static const char *names_genericstrtable(struct genericstrtable *t[HASHSZ], + unsigned int index) { struct genericstrtable *h; @@ -216,13 +217,16 @@ const char *names_subclass(u_int8_t classid, u_int8_t subclassid) return NULL; } -const char *names_protocol(u_int8_t classid, u_int8_t subclassid, u_int8_t protocolid) +const char *names_protocol(u_int8_t classid, u_int8_t subclassid, + u_int8_t protocolid) { struct protocol *p; - p = protocols[hashnum((classid << 16) | (subclassid << 8) | protocolid)]; + p = protocols[hashnum((classid << 16) | (subclassid << 8) + | protocolid)]; for (; p; p = p->next) - if (p->classid == classid && p->subclassid == subclassid && p->protocolid == protocolid) + if (p->classid == classid && p->subclassid == subclassid && + p->protocolid == protocolid) return p->name; return NULL; } @@ -308,7 +312,8 @@ static int new_vendor(const char *name, u_int16_t vendorid) return 0; } -static int new_product(const char *name, u_int16_t vendorid, u_int16_t productid) +static int new_product(const char *name, u_int16_t vendorid, + u_int16_t productid) { struct product *p; unsigned int h = hashnum((vendorid << 16) | productid); @@ -367,14 +372,17 @@ static int new_subclass(const char *name, u_int8_t classid, u_int8_t subclassid) return 0; } -static int new_protocol(const char *name, u_int8_t classid, u_int8_t subclassid, u_int8_t protocolid) +static int new_protocol(const char *name, u_int8_t classid, u_int8_t subclassid, + u_int8_t protocolid) { struct protocol *p; - unsigned int h = hashnum((classid << 16) | (subclassid << 8) | protocolid); + unsigned int h = hashnum((classid << 16) | (subclassid << 8) + | protocolid); p = protocols[h]; for (; p; p = p->next) - if (p->classid == classid && p->subclassid == subclassid && p->protocolid == protocolid) + if (p->classid == classid && p->subclassid == subclassid + && p->protocolid == protocolid) return -1; p = my_malloc(sizeof(struct protocol) + strlen(name)); if (!p) @@ -407,7 +415,8 @@ static int new_audioterminal(const char *name, u_int16_t termt) return 0; } -static int new_genericstrtable(struct genericstrtable *t[HASHSZ], const char *name, unsigned int index) +static int new_genericstrtable(struct genericstrtable *t[HASHSZ], + const char *name, unsigned int index) { struct genericstrtable *g; unsigned int h = hashnum(index); @@ -472,7 +481,11 @@ static void parse(FILE *f) { char buf[512], *cp; unsigned int linectr = 0; - int lastvendor = -1, lastclass = -1, lastsubclass = -1, lasthut = -1, lastlang = -1; + int lastvendor = -1; + int lastclass = -1; + int lastsubclass = -1; + int lasthut = -1; + int lastlang = -1; unsigned int u; while (fgets(buf, sizeof(buf), f)) { @@ -485,67 +498,82 @@ static void parse(FILE *f) if (buf[0] == '#' || !buf[0]) continue; cp = buf; - if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' && buf[3] == 'S' && buf[4] == 'D' && - buf[5] == 'E' && buf[6] == 'S' && /*isspace(buf[7])*/ buf[7] == ' ') { + if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' + && buf[3] == 'S' && buf[4] == 'D' && buf[5] == 'E' + && buf[6] == 'S' && /*isspace(buf[7])*/ buf[7] == ' ') { cp = buf + 8; while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid Physdes type at line %u\n", linectr); + fprintf(stderr, "Invalid Physdes type at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid Physdes type at line %u\n", linectr); + fprintf(stderr, "Invalid Physdes type at line %u\n", + linectr); continue; } if (new_physdes(cp, u)) - fprintf(stderr, "Duplicate Physdes type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u physdes type %02x %s\n", linectr, u, cp)); + fprintf(stderr, "Duplicate Physdes type spec at line %u terminal type %04x %s\n", + linectr, u, cp); + DBG(printf("line %5u physdes type %02x %s\n", linectr, + u, cp)); continue; } - if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' && /*isspace(buf[3])*/ buf[3] == ' ') { + if (buf[0] == 'P' && buf[1] == 'H' && buf[2] == 'Y' + && /*isspace(buf[3])*/ buf[3] == ' ') { cp = buf + 4; while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid PHY type at line %u\n", linectr); + fprintf(stderr, "Invalid PHY type at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid PHY type at line %u\n", linectr); + fprintf(stderr, "Invalid PHY type at line %u\n", + linectr); continue; } if (new_physdes(cp, u)) - fprintf(stderr, "Duplicate PHY type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u PHY type %02x %s\n", linectr, u, cp)); + fprintf(stderr, "Duplicate PHY type spec at line %u terminal type %04x %s\n", + linectr, u, cp); + DBG(printf("line %5u PHY type %02x %s\n", linectr, u, + cp)); continue; } - if (buf[0] == 'B' && buf[1] == 'I' && buf[2] == 'A' && buf[3] == 'S' && /*isspace(buf[4])*/ buf[4] == ' ') { + if (buf[0] == 'B' && buf[1] == 'I' && buf[2] == 'A' + && buf[3] == 'S' && /*isspace(buf[4])*/ buf[4] == ' ') { cp = buf + 5; while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid BIAS type at line %u\n", linectr); + fprintf(stderr, "Invalid BIAS type at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid BIAS type at line %u\n", linectr); + fprintf(stderr, "Invalid BIAS type at line %u\n", + linectr); continue; } if (new_bias(cp, u)) - fprintf(stderr, "Duplicate BIAS type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u BIAS type %02x %s\n", linectr, u, cp)); + fprintf(stderr, "Duplicate BIAS type spec at line %u terminal type %04x %s\n", + linectr, u, cp); + DBG(printf("line %5u BIAS type %02x %s\n", linectr, u, + cp)); continue; } @@ -554,19 +582,23 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid LANGID spec at line %u\n", linectr); + fprintf(stderr, "Invalid LANGID spec at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid LANGID spec at line %u\n", linectr); + fprintf(stderr, "Invalid LANGID spec at line %u\n", + linectr); continue; } if (new_langid(cp, u)) - fprintf(stderr, "Duplicate LANGID spec at line %u language-id %04x %s\n", linectr, u, cp); - DBG(printf("line %5u LANGID %02x %s\n", linectr, u, cp)); + fprintf(stderr, "Duplicate LANGID spec at line %u language-id %04x %s\n", + linectr, u, cp); + DBG(printf("line %5u LANGID %02x %s\n", linectr, u, + cp)); lasthut = lastclass = lastvendor = lastsubclass = -1; lastlang = u; continue; @@ -577,18 +609,21 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid class spec at line %u\n", linectr); + fprintf(stderr, "Invalid class spec at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid class spec at line %u\n", linectr); + fprintf(stderr, "Invalid class spec at line %u\n", + linectr); continue; } if (new_class(cp, u)) - fprintf(stderr, "Duplicate class spec at line %u class %04x %s\n", linectr, u, cp); + fprintf(stderr, "Duplicate class spec at line %u class %04x %s\n", + linectr, u, cp); DBG(printf("line %5u class %02x %s\n", linectr, u, cp)); lasthut = lastlang = lastvendor = lastsubclass = -1; lastclass = u; @@ -600,40 +635,49 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid audio terminal type at line %u\n", linectr); + fprintf(stderr, "Invalid audio terminal type at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid audio terminal type at line %u\n", linectr); + fprintf(stderr, "Invalid audio terminal type at line %u\n", + linectr); continue; } if (new_audioterminal(cp, u)) - fprintf(stderr, "Duplicate audio terminal type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u audio terminal type %02x %s\n", linectr, u, cp)); + fprintf(stderr, "Duplicate audio terminal type spec at line %u terminal type %04x %s\n", + linectr, u, cp); + DBG(printf("line %5u audio terminal type %02x %s\n", + linectr, u, cp)); continue; } - if (buf[0] == 'H' && buf[1] == 'C' && buf[2] == 'C' && isspace(buf[3])) { + if (buf[0] == 'H' && buf[1] == 'C' && buf[2] == 'C' + && isspace(buf[3])) { /* HID Descriptor bCountryCode */ cp = buf+3; while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid HID country code at line %u\n", linectr); + fprintf(stderr, "Invalid HID country code at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 10); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid HID country code at line %u\n", linectr); + fprintf(stderr, "Invalid HID country code at line %u\n", + linectr); continue; } if (new_countrycode(cp, u)) - fprintf(stderr, "Duplicate HID country code at line %u country %02u %s\n", linectr, u, cp); - DBG(printf("line %5u keyboard country code %02u %s\n", linectr, u, cp)); + fprintf(stderr, "Duplicate HID country code at line %u country %02u %s\n", + linectr, u, cp); + DBG(printf("line %5u keyboard country code %02u %s\n", + linectr, u, cp)); continue; } if (isxdigit(*cp)) { @@ -642,12 +686,15 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid vendor spec at line %u\n", linectr); + fprintf(stderr, "Invalid vendor spec at line %u\n", + linectr); continue; } if (new_vendor(cp, u)) - fprintf(stderr, "Duplicate vendor spec at line %u vendor %04x %s\n", linectr, u, cp); - DBG(printf("line %5u vendor %04x %s\n", linectr, u, cp)); + fprintf(stderr, "Duplicate vendor spec at line %u vendor %04x %s\n", + linectr, u, cp); + DBG(printf("line %5u vendor %04x %s\n", linectr, u, + cp)); lastvendor = u; lasthut = lastlang = lastclass = lastsubclass = -1; continue; @@ -658,33 +705,41 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid product/subclass spec at line %u\n", linectr); + fprintf(stderr, "Invalid product/subclass spec at line %u\n", + linectr); continue; } if (lastvendor != -1) { if (new_product(cp, lastvendor, u)) - fprintf(stderr, "Duplicate product spec at line %u product %04x:%04x %s\n", linectr, lastvendor, u, cp); - DBG(printf("line %5u product %04x:%04x %s\n", linectr, lastvendor, u, cp)); + fprintf(stderr, "Duplicate product spec at line %u product %04x:%04x %s\n", + linectr, lastvendor, u, cp); + DBG(printf("line %5u product %04x:%04x %s\n", + linectr, lastvendor, u, cp)); continue; } if (lastclass != -1) { if (new_subclass(cp, lastclass, u)) - fprintf(stderr, "Duplicate subclass spec at line %u class %02x:%02x %s\n", linectr, lastclass, u, cp); - DBG(printf("line %5u subclass %02x:%02x %s\n", linectr, lastclass, u, cp)); + fprintf(stderr, "Duplicate subclass spec at line %u class %02x:%02x %s\n", + linectr, lastclass, u, cp); + DBG(printf("line %5u subclass %02x:%02x %s\n", + linectr, lastclass, u, cp)); lastsubclass = u; continue; } if (lasthut != -1) { if (new_hutus(cp, (lasthut << 16)+u)) - fprintf(stderr, "Duplicate HUT Usage Spec at line %u\n", linectr); + fprintf(stderr, "Duplicate HUT Usage Spec at line %u\n", + linectr); continue; } if (lastlang != -1) { if (new_langid(cp, lastlang+(u<<10))) - fprintf(stderr, "Duplicate LANGID Usage Spec at line %u\n", linectr); + fprintf(stderr, "Duplicate LANGID Usage Spec at line %u\n", + linectr); continue; } - fprintf(stderr, "Product/Subclass spec without prior Vendor/Class spec at line %u\n", linectr); + fprintf(stderr, "Product/Subclass spec without prior Vendor/Class spec at line %u\n", + linectr); continue; } if (buf[0] == '\t' && buf[1] == '\t' && isxdigit(buf[2])) { @@ -693,59 +748,73 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid protocol spec at line %u\n", linectr); + fprintf(stderr, "Invalid protocol spec at line %u\n", + linectr); continue; } if (lastclass != -1 && lastsubclass != -1) { if (new_protocol(cp, lastclass, lastsubclass, u)) - fprintf(stderr, "Duplicate protocol spec at line %u class %02x:%02x:%02x %s\n", linectr, lastclass, lastsubclass, u, cp); - DBG(printf("line %5u protocol %02x:%02x:%02x %s\n", linectr, lastclass, lastsubclass, u, cp)); + fprintf(stderr, "Duplicate protocol spec at line %u class %02x:%02x:%02x %s\n", + linectr, lastclass, lastsubclass, u, cp); + DBG(printf("line %5u protocol %02x:%02x:%02x %s\n", + linectr, lastclass, lastsubclass, u, cp)); continue; } - fprintf(stderr, "Protocol spec without prior Class and Subclass spec at line %u\n", linectr); + fprintf(stderr, "Protocol spec without prior Class and Subclass spec at line %u\n", + linectr); continue; } - if (buf[0] == 'H' && buf[1] == 'I' && buf[2] == 'D' && /*isspace(buf[3])*/ buf[3] == ' ') { + if (buf[0] == 'H' && buf[1] == 'I' && buf[2] == 'D' + && /*isspace(buf[3])*/ buf[3] == ' ') { cp = buf + 4; while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid HID type at line %u\n", linectr); + fprintf(stderr, "Invalid HID type at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid HID type at line %u\n", linectr); + fprintf(stderr, "Invalid HID type at line %u\n", + linectr); continue; } if (new_hid(cp, u)) - fprintf(stderr, "Duplicate HID type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u HID type %02x %s\n", linectr, u, cp)); + fprintf(stderr, "Duplicate HID type spec at line %u terminal type %04x %s\n", + linectr, u, cp); + DBG(printf("line %5u HID type %02x %s\n", linectr, u, + cp)); continue; } - if (buf[0] == 'H' && buf[1] == 'U' && buf[2] == 'T' && /*isspace(buf[3])*/ buf[3] == ' ') { + if (buf[0] == 'H' && buf[1] == 'U' && buf[2] == 'T' + && /*isspace(buf[3])*/ buf[3] == ' ') { cp = buf + 4; while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid HUT type at line %u\n", linectr); + fprintf(stderr, "Invalid HUT type at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid HUT type at line %u\n", linectr); + fprintf(stderr, "Invalid HUT type at line %u\n", + linectr); continue; } if (new_huts(cp, u)) - fprintf(stderr, "Duplicate HUT type spec at line %u terminal type %04x %s\n", linectr, u, cp); + fprintf(stderr, "Duplicate HUT type spec at line %u terminal type %04x %s\n", + linectr, u, cp); lastlang = lastclass = lastvendor = lastsubclass = -1; lasthut = u; - DBG(printf("line %5u HUT type %02x %s\n", linectr, u, cp)); + DBG(printf("line %5u HUT type %02x %s\n", linectr, u, + cp)); continue; } @@ -754,19 +823,23 @@ static void parse(FILE *f) while (isspace(*cp)) cp++; if (!isxdigit(*cp)) { - fprintf(stderr, "Invalid Report type at line %u\n", linectr); + fprintf(stderr, "Invalid Report type at line %u\n", + linectr); continue; } u = strtoul(cp, &cp, 16); while (isspace(*cp)) cp++; if (!*cp) { - fprintf(stderr, "Invalid Report type at line %u\n", linectr); + fprintf(stderr, "Invalid Report type at line %u\n", + linectr); continue; } if (new_reporttag(cp, u)) - fprintf(stderr, "Duplicate Report type spec at line %u terminal type %04x %s\n", linectr, u, cp); - DBG(printf("line %5u Report type %02x %s\n", linectr, u, cp)); + fprintf(stderr, "Duplicate Report type spec at line %u terminal type %04x %s\n", + linectr, u, cp); + DBG(printf("line %5u Report type %02x %s\n", linectr, + u, cp)); continue; } diff --git a/drivers/staging/usbip/userspace/libsrc/names.h b/drivers/staging/usbip/userspace/libsrc/names.h index 3a269fe..28dafc5 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.h +++ b/drivers/staging/usbip/userspace/libsrc/names.h @@ -40,7 +40,8 @@ extern const char *names_vendor(u_int16_t vendorid); extern const char *names_product(u_int16_t vendorid, u_int16_t productid); extern const char *names_class(u_int8_t classid); extern const char *names_subclass(u_int8_t classid, u_int8_t subclassid); -extern const char *names_protocol(u_int8_t classid, u_int8_t subclassid, u_int8_t protocolid); +extern const char *names_protocol(u_int8_t classid, u_int8_t subclassid, + u_int8_t protocolid); extern const char *names_audioterminal(u_int16_t termt); extern const char *names_hid(u_int8_t hidd); extern const char *names_reporttag(u_int8_t rt); diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.c b/drivers/staging/usbip/userspace/libsrc/usbip_common.c index b55df81..17e08e0 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c +++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.c @@ -109,7 +109,8 @@ void dump_usb_device(struct usbip_usb_device *udev) } -int read_attr_value(struct sysfs_device *dev, const char *name, const char *format) +int read_attr_value(struct sysfs_device *dev, const char *name, + const char *format) { char attrpath[SYSFS_PATH_MAX]; struct sysfs_attribute *attr; @@ -180,8 +181,11 @@ err: return USB_SPEED_UNKNOWN; } -#define READ_ATTR(object, type, dev, name, format)\ - do { (object)->name = (type) read_attr_value(dev, to_string(name), format); } while (0) +#define READ_ATTR(object, type, dev, name, format) \ + do { \ + (object)->name = (type) read_attr_value(dev, to_string(name), \ + format); \ + } while (0) int read_usb_device(struct sysfs_device *sdev, struct usbip_usb_device *udev) @@ -245,7 +249,8 @@ void usbip_names_free() names_free(); } -void usbip_names_get_product(char *buff, size_t size, uint16_t vendor, uint16_t product) +void usbip_names_get_product(char *buff, size_t size, uint16_t vendor, + uint16_t product) { const char *prod, *vend; @@ -261,7 +266,8 @@ void usbip_names_get_product(char *buff, size_t size, uint16_t vendor, uint16_t snprintf(buff, size, "%s : %s (%04x:%04x)", vend, prod, vendor, product); } -void usbip_names_get_class(char *buff, size_t size, uint8_t class, uint8_t subclass, uint8_t protocol) +void usbip_names_get_class(char *buff, size_t size, uint8_t class, + uint8_t subclass, uint8_t protocol) { const char *c, *s, *p; diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.h b/drivers/staging/usbip/userspace/libsrc/usbip_common.h index eedefbd..0b2f370 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.h +++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.h @@ -132,7 +132,8 @@ struct usbip_usb_device { void dump_usb_interface(struct usbip_usb_interface *); void dump_usb_device(struct usbip_usb_device *); int read_usb_device(struct sysfs_device *sdev, struct usbip_usb_device *udev); -int read_attr_value(struct sysfs_device *dev, const char *name, const char *format); +int read_attr_value(struct sysfs_device *dev, const char *name, + const char *format); int read_usb_interface(struct usbip_usb_device *udev, int i, struct usbip_usb_interface *uinf); @@ -141,7 +142,9 @@ const char *usbip_status_string(int32_t status); int usbip_names_init(char *); void usbip_names_free(void); -void usbip_names_get_product(char *buff, size_t size, uint16_t vendor, uint16_t product); -void usbip_names_get_class(char *buff, size_t size, uint8_t class, uint8_t subclass, uint8_t protocol); +void usbip_names_get_product(char *buff, size_t size, uint16_t vendor, + uint16_t product); +void usbip_names_get_class(char *buff, size_t size, uint8_t class, + uint8_t subclass, uint8_t protocol); #endif /* __USBIP_COMMON_H */ diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c index b9c6e2a..25e62e9 100644 --- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c +++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c @@ -10,7 +10,8 @@ struct usbip_vhci_driver *vhci_driver; -static struct usbip_imported_device *imported_device_init(struct usbip_imported_device *idev, char *busid) +static struct usbip_imported_device * +imported_device_init(struct usbip_imported_device *idev, char *busid) { struct sysfs_device *sudev; @@ -29,8 +30,10 @@ static struct usbip_imported_device *imported_device_init(struct usbip_imported_ if (!strncmp(cdev->dev_path, idev->udev.path, strlen(idev->udev.path))) { struct usbip_class_device *new_cdev; - - /* alloc and copy because dlist is linked from only one list */ + /* + * alloc and copy because dlist is linked + * from only one list + */ new_cdev = calloc(1, sizeof(*new_cdev)); if (!new_cdev) goto err; @@ -101,7 +104,8 @@ static int parse_status(char *value) return -1; } - if (idev->status != VDEV_ST_NULL && idev->status != VDEV_ST_NOTASSIGNED) { + if (idev->status != VDEV_ST_NULL + && idev->status != VDEV_ST_NOTASSIGNED) { idev = imported_device_init(idev, lbusid); if (!idev) { dbg("imported_device_init failed"); @@ -126,8 +130,10 @@ static int parse_status(char *value) static int check_usbip_device(struct sysfs_class_device *cdev) { - char class_path[SYSFS_PATH_MAX]; /* /sys/class/video4linux/video0/device */ - char dev_path[SYSFS_PATH_MAX]; /* /sys/devices/platform/vhci_hcd/usb6/6-1:1.1 */ + /* /sys/class/video4linux/video0/device */ + char class_path[SYSFS_PATH_MAX]; + /* /sys/devices/platform/vhci_hcd/usb6/6-1:1.1 */ + char dev_path[SYSFS_PATH_MAX]; int ret; struct usbip_class_device *usbip_cdev; -- 1.7.10.4 |