aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/config.c1
-rw-r--r--drivers/usb/core/devio.c174
-rw-r--r--drivers/usb/core/driver.c121
-rw-r--r--drivers/usb/core/hcd.c37
-rw-r--r--drivers/usb/core/hub.c97
-rw-r--r--drivers/usb/core/message.c7
-rw-r--r--drivers/usb/core/usb.h2
7 files changed, 346 insertions, 93 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 062967c90b2a..1ab4df1de2da 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -10,7 +10,6 @@
10 10
11 11
12#define USB_MAXALTSETTING 128 /* Hard limit */ 12#define USB_MAXALTSETTING 128 /* Hard limit */
13#define USB_MAXENDPOINTS 30 /* Hard limit */
14 13
15#define USB_MAXCONFIG 8 /* Arbitrary limit */ 14#define USB_MAXCONFIG 8 /* Arbitrary limit */
16 15
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 2a8afe6754b8..257876ea03a1 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -769,6 +769,88 @@ static int check_ctrlrecip(struct usb_dev_state *ps, unsigned int requesttype,
769 return ret; 769 return ret;
770} 770}
771 771
772static struct usb_host_endpoint *ep_to_host_endpoint(struct usb_device *dev,
773 unsigned char ep)
774{
775 if (ep & USB_ENDPOINT_DIR_MASK)
776 return dev->ep_in[ep & USB_ENDPOINT_NUMBER_MASK];
777 else
778 return dev->ep_out[ep & USB_ENDPOINT_NUMBER_MASK];
779}
780
781static int parse_usbdevfs_streams(struct usb_dev_state *ps,
782 struct usbdevfs_streams __user *streams,
783 unsigned int *num_streams_ret,
784 unsigned int *num_eps_ret,
785 struct usb_host_endpoint ***eps_ret,
786 struct usb_interface **intf_ret)
787{
788 unsigned int i, num_streams, num_eps;
789 struct usb_host_endpoint **eps;
790 struct usb_interface *intf = NULL;
791 unsigned char ep;
792 int ifnum, ret;
793
794 if (get_user(num_streams, &streams->num_streams) ||
795 get_user(num_eps, &streams->num_eps))
796 return -EFAULT;
797
798 if (num_eps < 1 || num_eps > USB_MAXENDPOINTS)
799 return -EINVAL;
800
801 /* The XHCI controller allows max 2 ^ 16 streams */
802 if (num_streams_ret && (num_streams < 2 || num_streams > 65536))
803 return -EINVAL;
804
805 eps = kmalloc(num_eps * sizeof(*eps), GFP_KERNEL);
806 if (!eps)
807 return -ENOMEM;
808
809 for (i = 0; i < num_eps; i++) {
810 if (get_user(ep, &streams->eps[i])) {
811 ret = -EFAULT;
812 goto error;
813 }
814 eps[i] = ep_to_host_endpoint(ps->dev, ep);
815 if (!eps[i]) {
816 ret = -EINVAL;
817 goto error;
818 }
819
820 /* usb_alloc/free_streams operate on an usb_interface */
821 ifnum = findintfep(ps->dev, ep);
822 if (ifnum < 0) {
823 ret = ifnum;
824 goto error;
825 }
826
827 if (i == 0) {
828 ret = checkintf(ps, ifnum);
829 if (ret < 0)
830 goto error;
831 intf = usb_ifnum_to_if(ps->dev, ifnum);
832 } else {
833 /* Verify all eps belong to the same interface */
834 if (ifnum != intf->altsetting->desc.bInterfaceNumber) {
835 ret = -EINVAL;
836 goto error;
837 }
838 }
839 }
840
841 if (num_streams_ret)
842 *num_streams_ret = num_streams;
843 *num_eps_ret = num_eps;
844 *eps_ret = eps;
845 *intf_ret = intf;
846
847 return 0;
848
849error:
850 kfree(eps);
851 return ret;
852}
853
772static int match_devt(struct device *dev, void *data) 854static int match_devt(struct device *dev, void *data)
773{ 855{
774 return dev->devt == (dev_t) (unsigned long) data; 856 return dev->devt == (dev_t) (unsigned long) data;
@@ -1043,6 +1125,20 @@ static int proc_bulk(struct usb_dev_state *ps, void __user *arg)
1043 return ret; 1125 return ret;
1044} 1126}
1045 1127
1128static void check_reset_of_active_ep(struct usb_device *udev,
1129 unsigned int epnum, char *ioctl_name)
1130{
1131 struct usb_host_endpoint **eps;
1132 struct usb_host_endpoint *ep;
1133
1134 eps = (epnum & USB_DIR_IN) ? udev->ep_in : udev->ep_out;
1135 ep = eps[epnum & 0x0f];
1136 if (ep && !list_empty(&ep->urb_list))
1137 dev_warn(&udev->dev, "Process %d (%s) called USBDEVFS_%s for active endpoint 0x%02x\n",
1138 task_pid_nr(current), current->comm,
1139 ioctl_name, epnum);
1140}
1141
1046static int proc_resetep(struct usb_dev_state *ps, void __user *arg) 1142static int proc_resetep(struct usb_dev_state *ps, void __user *arg)
1047{ 1143{
1048 unsigned int ep; 1144 unsigned int ep;
@@ -1056,6 +1152,7 @@ static int proc_resetep(struct usb_dev_state *ps, void __user *arg)
1056 ret = checkintf(ps, ret); 1152 ret = checkintf(ps, ret);
1057 if (ret) 1153 if (ret)
1058 return ret; 1154 return ret;
1155 check_reset_of_active_ep(ps->dev, ep, "RESETEP");
1059 usb_reset_endpoint(ps->dev, ep); 1156 usb_reset_endpoint(ps->dev, ep);
1060 return 0; 1157 return 0;
1061} 1158}
@@ -1074,6 +1171,7 @@ static int proc_clearhalt(struct usb_dev_state *ps, void __user *arg)
1074 ret = checkintf(ps, ret); 1171 ret = checkintf(ps, ret);
1075 if (ret) 1172 if (ret)
1076 return ret; 1173 return ret;
1174 check_reset_of_active_ep(ps->dev, ep, "CLEAR_HALT");
1077 if (ep & USB_DIR_IN) 1175 if (ep & USB_DIR_IN)
1078 pipe = usb_rcvbulkpipe(ps->dev, ep & 0x7f); 1176 pipe = usb_rcvbulkpipe(ps->dev, ep & 0x7f);
1079 else 1177 else
@@ -1127,6 +1225,9 @@ static int proc_setintf(struct usb_dev_state *ps, void __user *arg)
1127 return -EFAULT; 1225 return -EFAULT;
1128 if ((ret = checkintf(ps, setintf.interface))) 1226 if ((ret = checkintf(ps, setintf.interface)))
1129 return ret; 1227 return ret;
1228
1229 destroy_async_on_interface(ps, setintf.interface);
1230
1130 return usb_set_interface(ps->dev, setintf.interface, 1231 return usb_set_interface(ps->dev, setintf.interface,
1131 setintf.altsetting); 1232 setintf.altsetting);
1132} 1233}
@@ -1189,6 +1290,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
1189 struct usb_ctrlrequest *dr = NULL; 1290 struct usb_ctrlrequest *dr = NULL;
1190 unsigned int u, totlen, isofrmlen; 1291 unsigned int u, totlen, isofrmlen;
1191 int i, ret, is_in, num_sgs = 0, ifnum = -1; 1292 int i, ret, is_in, num_sgs = 0, ifnum = -1;
1293 int number_of_packets = 0;
1294 unsigned int stream_id = 0;
1192 void *buf; 1295 void *buf;
1193 1296
1194 if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP | 1297 if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP |
@@ -1209,15 +1312,10 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
1209 if (ret) 1312 if (ret)
1210 return ret; 1313 return ret;
1211 } 1314 }
1212 if ((uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0) { 1315 ep = ep_to_host_endpoint(ps->dev, uurb->endpoint);
1213 is_in = 1;
1214 ep = ps->dev->ep_in[uurb->endpoint & USB_ENDPOINT_NUMBER_MASK];
1215 } else {
1216 is_in = 0;
1217 ep = ps->dev->ep_out[uurb->endpoint & USB_ENDPOINT_NUMBER_MASK];
1218 }
1219 if (!ep) 1316 if (!ep)
1220 return -ENOENT; 1317 return -ENOENT;
1318 is_in = (uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0;
1221 1319
1222 u = 0; 1320 u = 0;
1223 switch(uurb->type) { 1321 switch(uurb->type) {
@@ -1242,7 +1340,6 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
1242 le16_to_cpup(&dr->wIndex)); 1340 le16_to_cpup(&dr->wIndex));
1243 if (ret) 1341 if (ret)
1244 goto error; 1342 goto error;
1245 uurb->number_of_packets = 0;
1246 uurb->buffer_length = le16_to_cpup(&dr->wLength); 1343 uurb->buffer_length = le16_to_cpup(&dr->wLength);
1247 uurb->buffer += 8; 1344 uurb->buffer += 8;
1248 if ((dr->bRequestType & USB_DIR_IN) && uurb->buffer_length) { 1345 if ((dr->bRequestType & USB_DIR_IN) && uurb->buffer_length) {
@@ -1272,17 +1369,17 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
1272 uurb->type = USBDEVFS_URB_TYPE_INTERRUPT; 1369 uurb->type = USBDEVFS_URB_TYPE_INTERRUPT;
1273 goto interrupt_urb; 1370 goto interrupt_urb;
1274 } 1371 }
1275 uurb->number_of_packets = 0;
1276 num_sgs = DIV_ROUND_UP(uurb->buffer_length, USB_SG_SIZE); 1372 num_sgs = DIV_ROUND_UP(uurb->buffer_length, USB_SG_SIZE);
1277 if (num_sgs == 1 || num_sgs > ps->dev->bus->sg_tablesize) 1373 if (num_sgs == 1 || num_sgs > ps->dev->bus->sg_tablesize)
1278 num_sgs = 0; 1374 num_sgs = 0;
1375 if (ep->streams)
1376 stream_id = uurb->stream_id;
1279 break; 1377 break;
1280 1378
1281 case USBDEVFS_URB_TYPE_INTERRUPT: 1379 case USBDEVFS_URB_TYPE_INTERRUPT:
1282 if (!usb_endpoint_xfer_int(&ep->desc)) 1380 if (!usb_endpoint_xfer_int(&ep->desc))
1283 return -EINVAL; 1381 return -EINVAL;
1284 interrupt_urb: 1382 interrupt_urb:
1285 uurb->number_of_packets = 0;
1286 break; 1383 break;
1287 1384
1288 case USBDEVFS_URB_TYPE_ISO: 1385 case USBDEVFS_URB_TYPE_ISO:
@@ -1292,15 +1389,16 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
1292 return -EINVAL; 1389 return -EINVAL;
1293 if (!usb_endpoint_xfer_isoc(&ep->desc)) 1390 if (!usb_endpoint_xfer_isoc(&ep->desc))
1294 return -EINVAL; 1391 return -EINVAL;
1392 number_of_packets = uurb->number_of_packets;
1295 isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * 1393 isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) *
1296 uurb->number_of_packets; 1394 number_of_packets;
1297 if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) 1395 if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
1298 return -ENOMEM; 1396 return -ENOMEM;
1299 if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) { 1397 if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {
1300 ret = -EFAULT; 1398 ret = -EFAULT;
1301 goto error; 1399 goto error;
1302 } 1400 }
1303 for (totlen = u = 0; u < uurb->number_of_packets; u++) { 1401 for (totlen = u = 0; u < number_of_packets; u++) {
1304 /* 1402 /*
1305 * arbitrary limit need for USB 3.0 1403 * arbitrary limit need for USB 3.0
1306 * bMaxBurst (0~15 allowed, 1~16 packets) 1404 * bMaxBurst (0~15 allowed, 1~16 packets)
@@ -1331,7 +1429,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
1331 ret = -EFAULT; 1429 ret = -EFAULT;
1332 goto error; 1430 goto error;
1333 } 1431 }
1334 as = alloc_async(uurb->number_of_packets); 1432 as = alloc_async(number_of_packets);
1335 if (!as) { 1433 if (!as) {
1336 ret = -ENOMEM; 1434 ret = -ENOMEM;
1337 goto error; 1435 goto error;
@@ -1425,7 +1523,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
1425 as->urb->setup_packet = (unsigned char *)dr; 1523 as->urb->setup_packet = (unsigned char *)dr;
1426 dr = NULL; 1524 dr = NULL;
1427 as->urb->start_frame = uurb->start_frame; 1525 as->urb->start_frame = uurb->start_frame;
1428 as->urb->number_of_packets = uurb->number_of_packets; 1526 as->urb->number_of_packets = number_of_packets;
1527 as->urb->stream_id = stream_id;
1429 if (uurb->type == USBDEVFS_URB_TYPE_ISO || 1528 if (uurb->type == USBDEVFS_URB_TYPE_ISO ||
1430 ps->dev->speed == USB_SPEED_HIGH) 1529 ps->dev->speed == USB_SPEED_HIGH)
1431 as->urb->interval = 1 << min(15, ep->desc.bInterval - 1); 1530 as->urb->interval = 1 << min(15, ep->desc.bInterval - 1);
@@ -1433,7 +1532,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
1433 as->urb->interval = ep->desc.bInterval; 1532 as->urb->interval = ep->desc.bInterval;
1434 as->urb->context = as; 1533 as->urb->context = as;
1435 as->urb->complete = async_completed; 1534 as->urb->complete = async_completed;
1436 for (totlen = u = 0; u < uurb->number_of_packets; u++) { 1535 for (totlen = u = 0; u < number_of_packets; u++) {
1437 as->urb->iso_frame_desc[u].offset = totlen; 1536 as->urb->iso_frame_desc[u].offset = totlen;
1438 as->urb->iso_frame_desc[u].length = isopkt[u].length; 1537 as->urb->iso_frame_desc[u].length = isopkt[u].length;
1439 totlen += isopkt[u].length; 1538 totlen += isopkt[u].length;
@@ -1983,6 +2082,45 @@ static int proc_disconnect_claim(struct usb_dev_state *ps, void __user *arg)
1983 return claimintf(ps, dc.interface); 2082 return claimintf(ps, dc.interface);
1984} 2083}
1985 2084
2085static int proc_alloc_streams(struct usb_dev_state *ps, void __user *arg)
2086{
2087 unsigned num_streams, num_eps;
2088 struct usb_host_endpoint **eps;
2089 struct usb_interface *intf;
2090 int r;
2091
2092 r = parse_usbdevfs_streams(ps, arg, &num_streams, &num_eps,
2093 &eps, &intf);
2094 if (r)
2095 return r;
2096
2097 destroy_async_on_interface(ps,
2098 intf->altsetting[0].desc.bInterfaceNumber);
2099
2100 r = usb_alloc_streams(intf, eps, num_eps, num_streams, GFP_KERNEL);
2101 kfree(eps);
2102 return r;
2103}
2104
2105static int proc_free_streams(struct usb_dev_state *ps, void __user *arg)
2106{
2107 unsigned num_eps;
2108 struct usb_host_endpoint **eps;
2109 struct usb_interface *intf;
2110 int r;
2111
2112 r = parse_usbdevfs_streams(ps, arg, NULL, &num_eps, &eps, &intf);
2113 if (r)
2114 return r;
2115
2116 destroy_async_on_interface(ps,
2117 intf->altsetting[0].desc.bInterfaceNumber);
2118
2119 r = usb_free_streams(intf, eps, num_eps, GFP_KERNEL);
2120 kfree(eps);
2121 return r;
2122}
2123
1986/* 2124/*
1987 * NOTE: All requests here that have interface numbers as parameters 2125 * NOTE: All requests here that have interface numbers as parameters
1988 * are assuming that somehow the configuration has been prevented from 2126 * are assuming that somehow the configuration has been prevented from
@@ -2159,6 +2297,12 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
2159 case USBDEVFS_DISCONNECT_CLAIM: 2297 case USBDEVFS_DISCONNECT_CLAIM:
2160 ret = proc_disconnect_claim(ps, p); 2298 ret = proc_disconnect_claim(ps, p);
2161 break; 2299 break;
2300 case USBDEVFS_ALLOC_STREAMS:
2301 ret = proc_alloc_streams(ps, p);
2302 break;
2303 case USBDEVFS_FREE_STREAMS:
2304 ret = proc_free_streams(ps, p);
2305 break;
2162 } 2306 }
2163 usb_unlock_device(dev); 2307 usb_unlock_device(dev);
2164 if (ret >= 0) 2308 if (ret >= 0)
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index ab90a0156828..888881e5f292 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -312,9 +312,9 @@ static int usb_probe_interface(struct device *dev)
312 return error; 312 return error;
313 } 313 }
314 314
315 id = usb_match_id(intf, driver->id_table); 315 id = usb_match_dynamic_id(intf, driver);
316 if (!id) 316 if (!id)
317 id = usb_match_dynamic_id(intf, driver); 317 id = usb_match_id(intf, driver->id_table);
318 if (!id) 318 if (!id)
319 return error; 319 return error;
320 320
@@ -400,8 +400,9 @@ static int usb_unbind_interface(struct device *dev)
400{ 400{
401 struct usb_driver *driver = to_usb_driver(dev->driver); 401 struct usb_driver *driver = to_usb_driver(dev->driver);
402 struct usb_interface *intf = to_usb_interface(dev); 402 struct usb_interface *intf = to_usb_interface(dev);
403 struct usb_host_endpoint *ep, **eps = NULL;
403 struct usb_device *udev; 404 struct usb_device *udev;
404 int error, r, lpm_disable_error; 405 int i, j, error, r, lpm_disable_error;
405 406
406 intf->condition = USB_INTERFACE_UNBINDING; 407 intf->condition = USB_INTERFACE_UNBINDING;
407 408
@@ -425,6 +426,26 @@ static int usb_unbind_interface(struct device *dev)
425 driver->disconnect(intf); 426 driver->disconnect(intf);
426 usb_cancel_queued_reset(intf); 427 usb_cancel_queued_reset(intf);
427 428
429 /* Free streams */
430 for (i = 0, j = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
431 ep = &intf->cur_altsetting->endpoint[i];
432 if (ep->streams == 0)
433 continue;
434 if (j == 0) {
435 eps = kmalloc(USB_MAXENDPOINTS * sizeof(void *),
436 GFP_KERNEL);
437 if (!eps) {
438 dev_warn(dev, "oom, leaking streams\n");
439 break;
440 }
441 }
442 eps[j++] = ep;
443 }
444 if (j) {
445 usb_free_streams(intf, eps, j, GFP_KERNEL);
446 kfree(eps);
447 }
448
428 /* Reset other interface state. 449 /* Reset other interface state.
429 * We cannot do a Set-Interface if the device is suspended or 450 * We cannot do a Set-Interface if the device is suspended or
430 * if it is prepared for a system sleep (since installing a new 451 * if it is prepared for a system sleep (since installing a new
@@ -990,8 +1011,7 @@ EXPORT_SYMBOL_GPL(usb_deregister);
990 * it doesn't support pre_reset/post_reset/reset_resume or 1011 * it doesn't support pre_reset/post_reset/reset_resume or
991 * because it doesn't support suspend/resume. 1012 * because it doesn't support suspend/resume.
992 * 1013 *
993 * The caller must hold @intf's device's lock, but not its pm_mutex 1014 * The caller must hold @intf's device's lock, but not @intf's lock.
994 * and not @intf->dev.sem.
995 */ 1015 */
996void usb_forced_unbind_intf(struct usb_interface *intf) 1016void usb_forced_unbind_intf(struct usb_interface *intf)
997{ 1017{
@@ -1004,16 +1024,37 @@ void usb_forced_unbind_intf(struct usb_interface *intf)
1004 intf->needs_binding = 1; 1024 intf->needs_binding = 1;
1005} 1025}
1006 1026
1027/*
1028 * Unbind drivers for @udev's marked interfaces. These interfaces have
1029 * the needs_binding flag set, for example by usb_resume_interface().
1030 *
1031 * The caller must hold @udev's device lock.
1032 */
1033static void unbind_marked_interfaces(struct usb_device *udev)
1034{
1035 struct usb_host_config *config;
1036 int i;
1037 struct usb_interface *intf;
1038
1039 config = udev->actconfig;
1040 if (config) {
1041 for (i = 0; i < config->desc.bNumInterfaces; ++i) {
1042 intf = config->interface[i];
1043 if (intf->dev.driver && intf->needs_binding)
1044 usb_forced_unbind_intf(intf);
1045 }
1046 }
1047}
1048
1007/* Delayed forced unbinding of a USB interface driver and scan 1049/* Delayed forced unbinding of a USB interface driver and scan
1008 * for rebinding. 1050 * for rebinding.
1009 * 1051 *
1010 * The caller must hold @intf's device's lock, but not its pm_mutex 1052 * The caller must hold @intf's device's lock, but not @intf's lock.
1011 * and not @intf->dev.sem.
1012 * 1053 *
1013 * Note: Rebinds will be skipped if a system sleep transition is in 1054 * Note: Rebinds will be skipped if a system sleep transition is in
1014 * progress and the PM "complete" callback hasn't occurred yet. 1055 * progress and the PM "complete" callback hasn't occurred yet.
1015 */ 1056 */
1016void usb_rebind_intf(struct usb_interface *intf) 1057static void usb_rebind_intf(struct usb_interface *intf)
1017{ 1058{
1018 int rc; 1059 int rc;
1019 1060
@@ -1030,68 +1071,66 @@ void usb_rebind_intf(struct usb_interface *intf)
1030 } 1071 }
1031} 1072}
1032 1073
1033#ifdef CONFIG_PM 1074/*
1034 1075 * Rebind drivers to @udev's marked interfaces. These interfaces have
1035/* Unbind drivers for @udev's interfaces that don't support suspend/resume 1076 * the needs_binding flag set.
1036 * There is no check for reset_resume here because it can be determined
1037 * only during resume whether reset_resume is needed.
1038 * 1077 *
1039 * The caller must hold @udev's device lock. 1078 * The caller must hold @udev's device lock.
1040 */ 1079 */
1041static void unbind_no_pm_drivers_interfaces(struct usb_device *udev) 1080static void rebind_marked_interfaces(struct usb_device *udev)
1042{ 1081{
1043 struct usb_host_config *config; 1082 struct usb_host_config *config;
1044 int i; 1083 int i;
1045 struct usb_interface *intf; 1084 struct usb_interface *intf;
1046 struct usb_driver *drv;
1047 1085
1048 config = udev->actconfig; 1086 config = udev->actconfig;
1049 if (config) { 1087 if (config) {
1050 for (i = 0; i < config->desc.bNumInterfaces; ++i) { 1088 for (i = 0; i < config->desc.bNumInterfaces; ++i) {
1051 intf = config->interface[i]; 1089 intf = config->interface[i];
1052 1090 if (intf->needs_binding)
1053 if (intf->dev.driver) { 1091 usb_rebind_intf(intf);
1054 drv = to_usb_driver(intf->dev.driver);
1055 if (!drv->suspend || !drv->resume)
1056 usb_forced_unbind_intf(intf);
1057 }
1058 } 1092 }
1059 } 1093 }
1060} 1094}
1061 1095
1062/* Unbind drivers for @udev's interfaces that failed to support reset-resume. 1096/*
1063 * These interfaces have the needs_binding flag set by usb_resume_interface(). 1097 * Unbind all of @udev's marked interfaces and then rebind all of them.
1098 * This ordering is necessary because some drivers claim several interfaces
1099 * when they are first probed.
1064 * 1100 *
1065 * The caller must hold @udev's device lock. 1101 * The caller must hold @udev's device lock.
1066 */ 1102 */
1067static void unbind_no_reset_resume_drivers_interfaces(struct usb_device *udev) 1103void usb_unbind_and_rebind_marked_interfaces(struct usb_device *udev)
1068{ 1104{
1069 struct usb_host_config *config; 1105 unbind_marked_interfaces(udev);
1070 int i; 1106 rebind_marked_interfaces(udev);
1071 struct usb_interface *intf;
1072
1073 config = udev->actconfig;
1074 if (config) {
1075 for (i = 0; i < config->desc.bNumInterfaces; ++i) {
1076 intf = config->interface[i];
1077 if (intf->dev.driver && intf->needs_binding)
1078 usb_forced_unbind_intf(intf);
1079 }
1080 }
1081} 1107}
1082 1108
1083static void do_rebind_interfaces(struct usb_device *udev) 1109#ifdef CONFIG_PM
1110
1111/* Unbind drivers for @udev's interfaces that don't support suspend/resume
1112 * There is no check for reset_resume here because it can be determined
1113 * only during resume whether reset_resume is needed.
1114 *
1115 * The caller must hold @udev's device lock.
1116 */
1117static void unbind_no_pm_drivers_interfaces(struct usb_device *udev)
1084{ 1118{
1085 struct usb_host_config *config; 1119 struct usb_host_config *config;
1086 int i; 1120 int i;
1087 struct usb_interface *intf; 1121 struct usb_interface *intf;
1122 struct usb_driver *drv;
1088 1123
1089 config = udev->actconfig; 1124 config = udev->actconfig;
1090 if (config) { 1125 if (config) {
1091 for (i = 0; i < config->desc.bNumInterfaces; ++i) { 1126 for (i = 0; i < config->desc.bNumInterfaces; ++i) {
1092 intf = config->interface[i]; 1127 intf = config->interface[i];
1093 if (intf->needs_binding) 1128
1094 usb_rebind_intf(intf); 1129 if (intf->dev.driver) {
1130 drv = to_usb_driver(intf->dev.driver);
1131 if (!drv->suspend || !drv->resume)
1132 usb_forced_unbind_intf(intf);
1133 }
1095 } 1134 }
1096 } 1135 }
1097} 1136}
@@ -1420,7 +1459,7 @@ int usb_resume_complete(struct device *dev)
1420 * whose needs_binding flag is set 1459 * whose needs_binding flag is set
1421 */ 1460 */
1422 if (udev->state != USB_STATE_NOTATTACHED) 1461 if (udev->state != USB_STATE_NOTATTACHED)
1423 do_rebind_interfaces(udev); 1462 rebind_marked_interfaces(udev);
1424 return 0; 1463 return 0;
1425} 1464}
1426 1465
@@ -1442,7 +1481,7 @@ int usb_resume(struct device *dev, pm_message_t msg)
1442 pm_runtime_disable(dev); 1481 pm_runtime_disable(dev);
1443 pm_runtime_set_active(dev); 1482 pm_runtime_set_active(dev);
1444 pm_runtime_enable(dev); 1483 pm_runtime_enable(dev);
1445 unbind_no_reset_resume_drivers_interfaces(udev); 1484 unbind_marked_interfaces(udev);
1446 } 1485 }
1447 1486
1448 /* Avoid PM error messages for devices disconnected while suspended 1487 /* Avoid PM error messages for devices disconnected while suspended
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 2518c3250750..9c4e2922b04d 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2049,7 +2049,7 @@ int usb_alloc_streams(struct usb_interface *interface,
2049{ 2049{
2050 struct usb_hcd *hcd; 2050 struct usb_hcd *hcd;
2051 struct usb_device *dev; 2051 struct usb_device *dev;
2052 int i; 2052 int i, ret;
2053 2053
2054 dev = interface_to_usbdev(interface); 2054 dev = interface_to_usbdev(interface);
2055 hcd = bus_to_hcd(dev->bus); 2055 hcd = bus_to_hcd(dev->bus);
@@ -2058,13 +2058,24 @@ int usb_alloc_streams(struct usb_interface *interface,
2058 if (dev->speed != USB_SPEED_SUPER) 2058 if (dev->speed != USB_SPEED_SUPER)
2059 return -EINVAL; 2059 return -EINVAL;
2060 2060
2061 /* Streams only apply to bulk endpoints. */ 2061 for (i = 0; i < num_eps; i++) {
2062 for (i = 0; i < num_eps; i++) 2062 /* Streams only apply to bulk endpoints. */
2063 if (!usb_endpoint_xfer_bulk(&eps[i]->desc)) 2063 if (!usb_endpoint_xfer_bulk(&eps[i]->desc))
2064 return -EINVAL; 2064 return -EINVAL;
2065 /* Re-alloc is not allowed */
2066 if (eps[i]->streams)
2067 return -EINVAL;
2068 }
2065 2069
2066 return hcd->driver->alloc_streams(hcd, dev, eps, num_eps, 2070 ret = hcd->driver->alloc_streams(hcd, dev, eps, num_eps,
2067 num_streams, mem_flags); 2071 num_streams, mem_flags);
2072 if (ret < 0)
2073 return ret;
2074
2075 for (i = 0; i < num_eps; i++)
2076 eps[i]->streams = ret;
2077
2078 return ret;
2068} 2079}
2069EXPORT_SYMBOL_GPL(usb_alloc_streams); 2080EXPORT_SYMBOL_GPL(usb_alloc_streams);
2070 2081
@@ -2078,8 +2089,7 @@ EXPORT_SYMBOL_GPL(usb_alloc_streams);
2078 * Reverts a group of bulk endpoints back to not using stream IDs. 2089 * Reverts a group of bulk endpoints back to not using stream IDs.
2079 * Can fail if we are given bad arguments, or HCD is broken. 2090 * Can fail if we are given bad arguments, or HCD is broken.
2080 * 2091 *
2081 * Return: On success, the number of allocated streams. On failure, a negative 2092 * Return: 0 on success. On failure, a negative error code.
2082 * error code.
2083 */ 2093 */
2084int usb_free_streams(struct usb_interface *interface, 2094int usb_free_streams(struct usb_interface *interface,
2085 struct usb_host_endpoint **eps, unsigned int num_eps, 2095 struct usb_host_endpoint **eps, unsigned int num_eps,
@@ -2087,19 +2097,26 @@ int usb_free_streams(struct usb_interface *interface,
2087{ 2097{
2088 struct usb_hcd *hcd; 2098 struct usb_hcd *hcd;
2089 struct usb_device *dev; 2099 struct usb_device *dev;
2090 int i; 2100 int i, ret;
2091 2101
2092 dev = interface_to_usbdev(interface); 2102 dev = interface_to_usbdev(interface);
2093 hcd = bus_to_hcd(dev->bus); 2103 hcd = bus_to_hcd(dev->bus);
2094 if (dev->speed != USB_SPEED_SUPER) 2104 if (dev->speed != USB_SPEED_SUPER)
2095 return -EINVAL; 2105 return -EINVAL;
2096 2106
2097 /* Streams only apply to bulk endpoints. */ 2107 /* Double-free is not allowed */
2098 for (i = 0; i < num_eps; i++) 2108 for (i = 0; i < num_eps; i++)
2099 if (!eps[i] || !usb_endpoint_xfer_bulk(&eps[i]->desc)) 2109 if (!eps[i] || !eps[i]->streams)
2100 return -EINVAL; 2110 return -EINVAL;
2101 2111
2102 return hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags); 2112 ret = hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags);
2113 if (ret < 0)
2114 return ret;
2115
2116 for (i = 0; i < num_eps; i++)
2117 eps[i]->streams = 0;
2118
2119 return ret;
2103} 2120}
2104EXPORT_SYMBOL_GPL(usb_free_streams); 2121EXPORT_SYMBOL_GPL(usb_free_streams);
2105 2122
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 610735823d93..090469ebfcff 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -141,19 +141,27 @@ static int usb_device_supports_lpm(struct usb_device *udev)
141 return 0; 141 return 0;
142 } 142 }
143 143
144 /* All USB 3.0 must support LPM, but we need their max exit latency 144 /*
145 * information from the SuperSpeed Extended Capabilities BOS descriptor. 145 * According to the USB 3.0 spec, all USB 3.0 devices must support LPM.
146 * However, there are some that don't, and they set the U1/U2 exit
147 * latencies to zero.
146 */ 148 */
147 if (!udev->bos->ss_cap) { 149 if (!udev->bos->ss_cap) {
148 dev_warn(&udev->dev, "No LPM exit latency info found. " 150 dev_info(&udev->dev, "No LPM exit latency info found, disabling LPM.\n");
149 "Power management will be impacted.\n"); 151 return 0;
152 }
153
154 if (udev->bos->ss_cap->bU1devExitLat == 0 &&
155 udev->bos->ss_cap->bU2DevExitLat == 0) {
156 if (udev->parent)
157 dev_info(&udev->dev, "LPM exit latency is zeroed, disabling LPM.\n");
158 else
159 dev_info(&udev->dev, "We don't know the algorithms for LPM for this host, disabling LPM.\n");
150 return 0; 160 return 0;
151 } 161 }
152 if (udev->parent->lpm_capable)
153 return 1;
154 162
155 dev_warn(&udev->dev, "Parent hub missing LPM exit latency info. " 163 if (!udev->parent || udev->parent->lpm_capable)
156 "Power management will be impacted.\n"); 164 return 1;
157 return 0; 165 return 0;
158} 166}
159 167
@@ -499,7 +507,8 @@ static void led_work (struct work_struct *work)
499 changed++; 507 changed++;
500 } 508 }
501 if (changed) 509 if (changed)
502 schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD); 510 queue_delayed_work(system_power_efficient_wq,
511 &hub->leds, LED_CYCLE_PERIOD);
503} 512}
504 513
505/* use a short timeout for hub/port status fetches */ 514/* use a short timeout for hub/port status fetches */
@@ -1041,7 +1050,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
1041 if (type == HUB_INIT) { 1050 if (type == HUB_INIT) {
1042 delay = hub_power_on(hub, false); 1051 delay = hub_power_on(hub, false);
1043 INIT_DELAYED_WORK(&hub->init_work, hub_init_func2); 1052 INIT_DELAYED_WORK(&hub->init_work, hub_init_func2);
1044 schedule_delayed_work(&hub->init_work, 1053 queue_delayed_work(system_power_efficient_wq,
1054 &hub->init_work,
1045 msecs_to_jiffies(delay)); 1055 msecs_to_jiffies(delay));
1046 1056
1047 /* Suppress autosuspend until init is done */ 1057 /* Suppress autosuspend until init is done */
@@ -1195,7 +1205,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
1195 /* Don't do a long sleep inside a workqueue routine */ 1205 /* Don't do a long sleep inside a workqueue routine */
1196 if (type == HUB_INIT2) { 1206 if (type == HUB_INIT2) {
1197 INIT_DELAYED_WORK(&hub->init_work, hub_init_func3); 1207 INIT_DELAYED_WORK(&hub->init_work, hub_init_func3);
1198 schedule_delayed_work(&hub->init_work, 1208 queue_delayed_work(system_power_efficient_wq,
1209 &hub->init_work,
1199 msecs_to_jiffies(delay)); 1210 msecs_to_jiffies(delay));
1200 return; /* Continues at init3: below */ 1211 return; /* Continues at init3: below */
1201 } else { 1212 } else {
@@ -1209,7 +1220,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
1209 if (status < 0) 1220 if (status < 0)
1210 dev_err(hub->intfdev, "activate --> %d\n", status); 1221 dev_err(hub->intfdev, "activate --> %d\n", status);
1211 if (hub->has_indicators && blinkenlights) 1222 if (hub->has_indicators && blinkenlights)
1212 schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD); 1223 queue_delayed_work(system_power_efficient_wq,
1224 &hub->leds, LED_CYCLE_PERIOD);
1213 1225
1214 /* Scan all ports that need attention */ 1226 /* Scan all ports that need attention */
1215 kick_khubd(hub); 1227 kick_khubd(hub);
@@ -3095,9 +3107,19 @@ static int finish_port_resume(struct usb_device *udev)
3095 * operation is carried out here, after the port has been 3107 * operation is carried out here, after the port has been
3096 * resumed. 3108 * resumed.
3097 */ 3109 */
3098 if (udev->reset_resume) 3110 if (udev->reset_resume) {
3111 /*
3112 * If the device morphs or switches modes when it is reset,
3113 * we don't want to perform a reset-resume. We'll fail the
3114 * resume, which will cause a logical disconnect, and then
3115 * the device will be rediscovered.
3116 */
3099 retry_reset_resume: 3117 retry_reset_resume:
3100 status = usb_reset_and_verify_device(udev); 3118 if (udev->quirks & USB_QUIRK_RESET)
3119 status = -ENODEV;
3120 else
3121 status = usb_reset_and_verify_device(udev);
3122 }
3101 3123
3102 /* 10.5.4.5 says be sure devices in the tree are still there. 3124 /* 10.5.4.5 says be sure devices in the tree are still there.
3103 * For now let's assume the device didn't go crazy on resume, 3125 * For now let's assume the device didn't go crazy on resume,
@@ -3960,7 +3982,7 @@ static void hub_set_initial_usb2_lpm_policy(struct usb_device *udev)
3960 connect_type = usb_get_hub_port_connect_type(udev->parent, 3982 connect_type = usb_get_hub_port_connect_type(udev->parent,
3961 udev->portnum); 3983 udev->portnum);
3962 3984
3963 if ((udev->bos->ext_cap->bmAttributes & USB_BESL_SUPPORT) || 3985 if ((udev->bos->ext_cap->bmAttributes & cpu_to_le32(USB_BESL_SUPPORT)) ||
3964 connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED) { 3986 connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED) {
3965 udev->usb2_hw_lpm_allowed = 1; 3987 udev->usb2_hw_lpm_allowed = 1;
3966 usb_set_usb2_hardware_lpm(udev, 1); 3988 usb_set_usb2_hardware_lpm(udev, 1);
@@ -4109,8 +4131,12 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
4109 4131
4110 did_new_scheme = true; 4132 did_new_scheme = true;
4111 retval = hub_enable_device(udev); 4133 retval = hub_enable_device(udev);
4112 if (retval < 0) 4134 if (retval < 0) {
4135 dev_err(&udev->dev,
4136 "hub failed to enable device, error %d\n",
4137 retval);
4113 goto fail; 4138 goto fail;
4139 }
4114 4140
4115#define GET_DESCRIPTOR_BUFSIZE 64 4141#define GET_DESCRIPTOR_BUFSIZE 64
4116 buf = kmalloc(GET_DESCRIPTOR_BUFSIZE, GFP_NOIO); 4142 buf = kmalloc(GET_DESCRIPTOR_BUFSIZE, GFP_NOIO);
@@ -4313,7 +4339,8 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
4313 /* hub LEDs are probably harder to miss than syslog */ 4339 /* hub LEDs are probably harder to miss than syslog */
4314 if (hub->has_indicators) { 4340 if (hub->has_indicators) {
4315 hub->indicator[port1-1] = INDICATOR_GREEN_BLINK; 4341 hub->indicator[port1-1] = INDICATOR_GREEN_BLINK;
4316 schedule_delayed_work (&hub->leds, 0); 4342 queue_delayed_work(system_power_efficient_wq,
4343 &hub->leds, 0);
4317 } 4344 }
4318 } 4345 }
4319 kfree(qual); 4346 kfree(qual);
@@ -4542,7 +4569,9 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
4542 if (hub->has_indicators) { 4569 if (hub->has_indicators) {
4543 hub->indicator[port1-1] = 4570 hub->indicator[port1-1] =
4544 INDICATOR_AMBER_BLINK; 4571 INDICATOR_AMBER_BLINK;
4545 schedule_delayed_work (&hub->leds, 0); 4572 queue_delayed_work(
4573 system_power_efficient_wq,
4574 &hub->leds, 0);
4546 } 4575 }
4547 status = -ENOTCONN; /* Don't retry */ 4576 status = -ENOTCONN; /* Don't retry */
4548 goto loop_disable; 4577 goto loop_disable;
@@ -4741,6 +4770,8 @@ static void hub_events(void)
4741 4770
4742 /* deal with port status changes */ 4771 /* deal with port status changes */
4743 for (i = 1; i <= hdev->maxchild; i++) { 4772 for (i = 1; i <= hdev->maxchild; i++) {
4773 struct usb_device *udev = hub->ports[i - 1]->child;
4774
4744 if (test_bit(i, hub->busy_bits)) 4775 if (test_bit(i, hub->busy_bits))
4745 continue; 4776 continue;
4746 connect_change = test_bit(i, hub->change_bits); 4777 connect_change = test_bit(i, hub->change_bits);
@@ -4839,8 +4870,6 @@ static void hub_events(void)
4839 */ 4870 */
4840 if (hub_port_warm_reset_required(hub, portstatus)) { 4871 if (hub_port_warm_reset_required(hub, portstatus)) {
4841 int status; 4872 int status;
4842 struct usb_device *udev =
4843 hub->ports[i - 1]->child;
4844 4873
4845 dev_dbg(hub_dev, "warm reset port %d\n", i); 4874 dev_dbg(hub_dev, "warm reset port %d\n", i);
4846 if (!udev || 4875 if (!udev ||
@@ -4857,6 +4886,24 @@ static void hub_events(void)
4857 usb_unlock_device(udev); 4886 usb_unlock_device(udev);
4858 connect_change = 0; 4887 connect_change = 0;
4859 } 4888 }
4889 /*
4890 * On disconnect USB3 protocol ports transit from U0 to
4891 * SS.Inactive to Rx.Detect. If this happens a warm-
4892 * reset is not needed, but a (re)connect may happen
4893 * before khubd runs and sees the disconnect, and the
4894 * device may be an unknown state.
4895 *
4896 * If the port went through SS.Inactive without khubd
4897 * seeing it the C_LINK_STATE change flag will be set,
4898 * and we reset the dev to put it in a known state.
4899 */
4900 } else if (udev && hub_is_superspeed(hub->hdev) &&
4901 (portchange & USB_PORT_STAT_C_LINK_STATE) &&
4902 (portstatus & USB_PORT_STAT_CONNECTION)) {
4903 usb_lock_device(udev);
4904 usb_reset_device(udev);
4905 usb_unlock_device(udev);
4906 connect_change = 0;
4860 } 4907 }
4861 4908
4862 if (connect_change) 4909 if (connect_change)
@@ -5114,7 +5161,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
5114 struct usb_hcd *hcd = bus_to_hcd(udev->bus); 5161 struct usb_hcd *hcd = bus_to_hcd(udev->bus);
5115 struct usb_device_descriptor descriptor = udev->descriptor; 5162 struct usb_device_descriptor descriptor = udev->descriptor;
5116 struct usb_host_bos *bos; 5163 struct usb_host_bos *bos;
5117 int i, ret = 0; 5164 int i, j, ret = 0;
5118 int port1 = udev->portnum; 5165 int port1 = udev->portnum;
5119 5166
5120 if (udev->state == USB_STATE_NOTATTACHED || 5167 if (udev->state == USB_STATE_NOTATTACHED ||
@@ -5240,6 +5287,9 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
5240 ret); 5287 ret);
5241 goto re_enumerate; 5288 goto re_enumerate;
5242 } 5289 }
5290 /* Resetting also frees any allocated streams */
5291 for (j = 0; j < intf->cur_altsetting->desc.bNumEndpoints; j++)
5292 intf->cur_altsetting->endpoint[j].streams = 0;
5243 } 5293 }
5244 5294
5245done: 5295done:
@@ -5342,10 +5392,11 @@ int usb_reset_device(struct usb_device *udev)
5342 else if (cintf->condition == 5392 else if (cintf->condition ==
5343 USB_INTERFACE_BOUND) 5393 USB_INTERFACE_BOUND)
5344 rebind = 1; 5394 rebind = 1;
5395 if (rebind)
5396 cintf->needs_binding = 1;
5345 } 5397 }
5346 if (ret == 0 && rebind)
5347 usb_rebind_intf(cintf);
5348 } 5398 }
5399 usb_unbind_and_rebind_marked_interfaces(udev);
5349 } 5400 }
5350 5401
5351 usb_autosuspend_device(udev); 5402 usb_autosuspend_device(udev);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 08d95e9d56c2..3cdcd0a2c0b7 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1293,8 +1293,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1293 struct usb_interface *iface; 1293 struct usb_interface *iface;
1294 struct usb_host_interface *alt; 1294 struct usb_host_interface *alt;
1295 struct usb_hcd *hcd = bus_to_hcd(dev->bus); 1295 struct usb_hcd *hcd = bus_to_hcd(dev->bus);
1296 int ret; 1296 int i, ret, manual = 0;
1297 int manual = 0;
1298 unsigned int epaddr; 1297 unsigned int epaddr;
1299 unsigned int pipe; 1298 unsigned int pipe;
1300 1299
@@ -1329,6 +1328,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1329 mutex_unlock(hcd->bandwidth_mutex); 1328 mutex_unlock(hcd->bandwidth_mutex);
1330 return -ENOMEM; 1329 return -ENOMEM;
1331 } 1330 }
1331 /* Changing alt-setting also frees any allocated streams */
1332 for (i = 0; i < iface->cur_altsetting->desc.bNumEndpoints; i++)
1333 iface->cur_altsetting->endpoint[i].streams = 0;
1334
1332 ret = usb_hcd_alloc_bandwidth(dev, NULL, iface->cur_altsetting, alt); 1335 ret = usb_hcd_alloc_bandwidth(dev, NULL, iface->cur_altsetting, alt);
1333 if (ret < 0) { 1336 if (ret < 0) {
1334 dev_info(&dev->dev, "Not enough bandwidth for altsetting %d\n", 1337 dev_info(&dev->dev, "Not enough bandwidth for altsetting %d\n",
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index a87532845bf9..75bf649da82d 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -55,7 +55,7 @@ extern int usb_match_one_id_intf(struct usb_device *dev,
55extern int usb_match_device(struct usb_device *dev, 55extern int usb_match_device(struct usb_device *dev,
56 const struct usb_device_id *id); 56 const struct usb_device_id *id);
57extern void usb_forced_unbind_intf(struct usb_interface *intf); 57extern void usb_forced_unbind_intf(struct usb_interface *intf);
58extern void usb_rebind_intf(struct usb_interface *intf); 58extern void usb_unbind_and_rebind_marked_interfaces(struct usb_device *udev);
59 59
60extern void usb_hub_release_all_ports(struct usb_device *hdev, 60extern void usb_hub_release_all_ports(struct usb_device *hdev,
61 struct usb_dev_state *owner); 61 struct usb_dev_state *owner);