aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-01 12:40:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-01 12:40:49 -0500
commite4ee8b85b7657d9c769b727038faabdc2e6a3412 (patch)
treee6b52a1e866ed77b09b267f60f8f1b5449228325 /tools
parent7109a04eae81c41ed529da9f3c48c3655ccea741 (diff)
parentd08dd3f3dd2ae351b793fc5b76abdbf0fd317b12 (diff)
Merge tag 'usb-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB/PHY updates from Greg KH: "Here is the big USB and PHY driver update for 4.16-rc1. Along with the normally expected XHCI, MUSB, and Gadget driver patches, there are some PHY driver fixes, license cleanups, sysfs attribute cleanups, usbip changes, and a raft of other smaller fixes and additions. Full details are in the shortlog. All of these have been in the linux-next tree for a long time with no reported issues" * tag 'usb-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (137 commits) USB: serial: pl2303: new device id for Chilitag USB: misc: fix up some remaining DEVICE_ATTR() usages USB: musb: fix up one odd DEVICE_ATTR() usage USB: atm: fix up some remaining DEVICE_ATTR() usage USB: move many drivers to use DEVICE_ATTR_WO USB: move many drivers to use DEVICE_ATTR_RO USB: move many drivers to use DEVICE_ATTR_RW USB: misc: chaoskey: Use true and false for boolean values USB: storage: remove old wording about how to submit a change USB: storage: remove invalid URL from drivers usb: ehci-omap: don't complain on -EPROBE_DEFER when no PHY found usbip: list: don't list devices attached to vhci_hcd usbip: prevent bind loops on devices attached to vhci_hcd USB: serial: remove redundant initializations of 'mos_parport' usb/gadget: Fix "high bandwidth" check in usb_gadget_ep_match_desc() usb: gadget: compress return logic into one line usbip: vhci_hcd: update 'status' file header and format USB: serial: simple: add Motorola Tetra driver CDC-ACM: apply quirk for card reader usb: option: Add support for FS040U modem ...
Diffstat (limited to 'tools')
-rw-r--r--tools/usb/usbip/libsrc/usbip_device_driver.c7
-rw-r--r--tools/usb/usbip/src/usbip_bind.c9
-rw-r--r--tools/usb/usbip/src/usbip_list.c9
-rw-r--r--tools/usb/usbip/src/usbipd.c2
4 files changed, 24 insertions, 3 deletions
diff --git a/tools/usb/usbip/libsrc/usbip_device_driver.c b/tools/usb/usbip/libsrc/usbip_device_driver.c
index e059b7d1ec5b..ec3a0b794f15 100644
--- a/tools/usb/usbip/libsrc/usbip_device_driver.c
+++ b/tools/usb/usbip/libsrc/usbip_device_driver.c
@@ -77,7 +77,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
77 const char *path, *name; 77 const char *path, *name;
78 char filepath[SYSFS_PATH_MAX]; 78 char filepath[SYSFS_PATH_MAX];
79 struct usb_device_descriptor descr; 79 struct usb_device_descriptor descr;
80 unsigned i; 80 unsigned int i;
81 FILE *fd = NULL; 81 FILE *fd = NULL;
82 struct udev_device *plat; 82 struct udev_device *plat;
83 const char *speed; 83 const char *speed;
@@ -92,7 +92,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
92 return -1; 92 return -1;
93 ret = fread((char *) &descr, sizeof(descr), 1, fd); 93 ret = fread((char *) &descr, sizeof(descr), 1, fd);
94 if (ret < 0) 94 if (ret < 0)
95 return -1; 95 goto err;
96 fclose(fd); 96 fclose(fd);
97 97
98 copy_descr_attr(dev, &descr, bDeviceClass); 98 copy_descr_attr(dev, &descr, bDeviceClass);
@@ -124,6 +124,9 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
124 name = udev_device_get_sysname(plat); 124 name = udev_device_get_sysname(plat);
125 strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE); 125 strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE);
126 return 0; 126 return 0;
127err:
128 fclose(fd);
129 return -1;
127} 130}
128 131
129static int is_my_device(struct udev_device *dev) 132static int is_my_device(struct udev_device *dev)
diff --git a/tools/usb/usbip/src/usbip_bind.c b/tools/usb/usbip/src/usbip_bind.c
index fa46141ae68b..e121cfb1746a 100644
--- a/tools/usb/usbip/src/usbip_bind.c
+++ b/tools/usb/usbip/src/usbip_bind.c
@@ -144,6 +144,7 @@ static int bind_device(char *busid)
144 int rc; 144 int rc;
145 struct udev *udev; 145 struct udev *udev;
146 struct udev_device *dev; 146 struct udev_device *dev;
147 const char *devpath;
147 148
148 /* Check whether the device with this bus ID exists. */ 149 /* Check whether the device with this bus ID exists. */
149 udev = udev_new(); 150 udev = udev_new();
@@ -152,8 +153,16 @@ static int bind_device(char *busid)
152 err("device with the specified bus ID does not exist"); 153 err("device with the specified bus ID does not exist");
153 return -1; 154 return -1;
154 } 155 }
156 devpath = udev_device_get_devpath(dev);
155 udev_unref(udev); 157 udev_unref(udev);
156 158
159 /* If the device is already attached to vhci_hcd - bail out */
160 if (strstr(devpath, USBIP_VHCI_DRV_NAME)) {
161 err("bind loop detected: device: %s is attached to %s\n",
162 devpath, USBIP_VHCI_DRV_NAME);
163 return -1;
164 }
165
157 rc = unbind_other(busid); 166 rc = unbind_other(busid);
158 if (rc == UNBIND_ST_FAILED) { 167 if (rc == UNBIND_ST_FAILED) {
159 err("could not unbind driver from device on busid %s", busid); 168 err("could not unbind driver from device on busid %s", busid);
diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c
index f1b38e866dd7..d65a9f444174 100644
--- a/tools/usb/usbip/src/usbip_list.c
+++ b/tools/usb/usbip/src/usbip_list.c
@@ -187,6 +187,7 @@ static int list_devices(bool parsable)
187 const char *busid; 187 const char *busid;
188 char product_name[128]; 188 char product_name[128];
189 int ret = -1; 189 int ret = -1;
190 const char *devpath;
190 191
191 /* Create libudev context. */ 192 /* Create libudev context. */
192 udev = udev_new(); 193 udev = udev_new();
@@ -209,6 +210,14 @@ static int list_devices(bool parsable)
209 path = udev_list_entry_get_name(dev_list_entry); 210 path = udev_list_entry_get_name(dev_list_entry);
210 dev = udev_device_new_from_syspath(udev, path); 211 dev = udev_device_new_from_syspath(udev, path);
211 212
213 /* Ignore devices attached to vhci_hcd */
214 devpath = udev_device_get_devpath(dev);
215 if (strstr(devpath, USBIP_VHCI_DRV_NAME)) {
216 dbg("Skip the device %s already attached to %s\n",
217 devpath, USBIP_VHCI_DRV_NAME);
218 continue;
219 }
220
212 /* Get device information. */ 221 /* Get device information. */
213 idVendor = udev_device_get_sysattr_value(dev, "idVendor"); 222 idVendor = udev_device_get_sysattr_value(dev, "idVendor");
214 idProduct = udev_device_get_sysattr_value(dev, "idProduct"); 223 idProduct = udev_device_get_sysattr_value(dev, "idProduct");
diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c
index 009afb4a3aae..c6dad2a13c80 100644
--- a/tools/usb/usbip/src/usbipd.c
+++ b/tools/usb/usbip/src/usbipd.c
@@ -456,7 +456,7 @@ static void set_signal(void)
456 sigaction(SIGTERM, &act, NULL); 456 sigaction(SIGTERM, &act, NULL);
457 sigaction(SIGINT, &act, NULL); 457 sigaction(SIGINT, &act, NULL);
458 act.sa_handler = SIG_IGN; 458 act.sa_handler = SIG_IGN;
459 sigaction(SIGCLD, &act, NULL); 459 sigaction(SIGCHLD, &act, NULL);
460} 460}
461 461
462static const char *pid_file; 462static const char *pid_file;