Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'usb-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
"Here are some USB fixes for 3.16-rc2 that resolve some reported
issues. All of these have been in linux-next for a while with no
problems"

* tag 'usb-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
USB: usbtest: add a timeout for scatter-gather tests
USB: EHCI: avoid BIOS handover on the HASEE E200
usb: fix hub-port pm_runtime_enable() vs runtime pm transitions
usb: quiet peer failure warning, disable poweroff
usb: improve "not suspended yet" message in hub_suspend()
xhci: Fix sleeping with IRQs disabled in xhci_stop_device()
usb: fix ->update_hub_device() vs hdev->maxchild

+118 -41
+20 -13
drivers/usb/core/hub.c
··· 1526 1526 dev_dbg(hub_dev, "%umA bus power budget for each child\n", 1527 1527 hub->mA_per_port); 1528 1528 1529 - /* Update the HCD's internal representation of this hub before khubd 1530 - * starts getting port status changes for devices under the hub. 1531 - */ 1532 - if (hcd->driver->update_hub_device) { 1533 - ret = hcd->driver->update_hub_device(hcd, hdev, 1534 - &hub->tt, GFP_KERNEL); 1535 - if (ret < 0) { 1536 - message = "can't update HCD hub info"; 1537 - goto fail; 1538 - } 1539 - } 1540 - 1541 1529 ret = hub_hub_status(hub, &hubstatus, &hubchange); 1542 1530 if (ret < 0) { 1543 1531 message = "can't get hub status"; ··· 1577 1589 } 1578 1590 } 1579 1591 hdev->maxchild = i; 1592 + for (i = 0; i < hdev->maxchild; i++) { 1593 + struct usb_port *port_dev = hub->ports[i]; 1594 + 1595 + pm_runtime_put(&port_dev->dev); 1596 + } 1597 + 1580 1598 mutex_unlock(&usb_port_peer_mutex); 1581 1599 if (ret < 0) 1582 1600 goto fail; 1601 + 1602 + /* Update the HCD's internal representation of this hub before khubd 1603 + * starts getting port status changes for devices under the hub. 1604 + */ 1605 + if (hcd->driver->update_hub_device) { 1606 + ret = hcd->driver->update_hub_device(hcd, hdev, 1607 + &hub->tt, GFP_KERNEL); 1608 + if (ret < 0) { 1609 + message = "can't update HCD hub info"; 1610 + goto fail; 1611 + } 1612 + } 1583 1613 1584 1614 usb_hub_adjust_deviceremovable(hdev, hub->descriptor); 1585 1615 ··· 3464 3458 struct usb_device *udev = port_dev->child; 3465 3459 3466 3460 if (udev && udev->can_submit) { 3467 - dev_warn(&port_dev->dev, "not suspended yet\n"); 3461 + dev_warn(&port_dev->dev, "device %s not suspended yet\n", 3462 + dev_name(&udev->dev)); 3468 3463 if (PMSG_IS_AUTO(msg)) 3469 3464 return -EBUSY; 3470 3465 }
+2
drivers/usb/core/hub.h
··· 84 84 * @dev: generic device interface 85 85 * @port_owner: port's owner 86 86 * @peer: related usb2 and usb3 ports (share the same connector) 87 + * @req: default pm qos request for hubs without port power control 87 88 * @connect_type: port's connect type 88 89 * @location: opaque representation of platform connector location 89 90 * @status_lock: synchronize port_event() vs usb_port_{suspend|resume} ··· 96 95 struct device dev; 97 96 struct usb_dev_state *port_owner; 98 97 struct usb_port *peer; 98 + struct dev_pm_qos_request *req; 99 99 enum usb_port_connect_type connect_type; 100 100 usb_port_location_t location; 101 101 struct mutex status_lock;
+64 -23
drivers/usb/core/port.c
··· 21 21 22 22 #include "hub.h" 23 23 24 + static int usb_port_block_power_off; 25 + 24 26 static const struct attribute_group *port_dev_group[]; 25 27 26 28 static ssize_t connect_type_show(struct device *dev, ··· 68 66 { 69 67 struct usb_port *port_dev = to_usb_port(dev); 70 68 69 + kfree(port_dev->req); 71 70 kfree(port_dev); 72 71 } 73 72 ··· 145 142 == PM_QOS_FLAGS_ALL) 146 143 return -EAGAIN; 147 144 145 + if (usb_port_block_power_off) 146 + return -EBUSY; 147 + 148 148 usb_autopm_get_interface(intf); 149 149 retval = usb_hub_set_port_power(hdev, hub, port1, false); 150 150 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); ··· 196 190 if (left->peer || right->peer) { 197 191 struct usb_port *lpeer = left->peer; 198 192 struct usb_port *rpeer = right->peer; 193 + char *method; 199 194 200 - WARN(1, "failed to peer %s and %s (%s -> %p) (%s -> %p)\n", 201 - dev_name(&left->dev), dev_name(&right->dev), 202 - dev_name(&left->dev), lpeer, 203 - dev_name(&right->dev), rpeer); 195 + if (left->location && left->location == right->location) 196 + method = "location"; 197 + else 198 + method = "default"; 199 + 200 + pr_warn("usb: failed to peer %s and %s by %s (%s:%s) (%s:%s)\n", 201 + dev_name(&left->dev), dev_name(&right->dev), method, 202 + dev_name(&left->dev), 203 + lpeer ? dev_name(&lpeer->dev) : "none", 204 + dev_name(&right->dev), 205 + rpeer ? dev_name(&rpeer->dev) : "none"); 204 206 return -EBUSY; 205 207 } 206 208 ··· 265 251 dev_warn(&left->dev, "failed to peer to %s (%d)\n", 266 252 dev_name(&right->dev), rc); 267 253 pr_warn_once("usb: port power management may be unreliable\n"); 254 + usb_port_block_power_off = 1; 268 255 } 269 256 } 270 257 ··· 401 386 int retval; 402 387 403 388 port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL); 404 - if (!port_dev) { 405 - retval = -ENOMEM; 406 - goto exit; 389 + if (!port_dev) 390 + return -ENOMEM; 391 + 392 + port_dev->req = kzalloc(sizeof(*(port_dev->req)), GFP_KERNEL); 393 + if (!port_dev->req) { 394 + kfree(port_dev); 395 + return -ENOMEM; 407 396 } 408 397 409 398 hub->ports[port1 - 1] = port_dev; ··· 423 404 port1); 424 405 mutex_init(&port_dev->status_lock); 425 406 retval = device_register(&port_dev->dev); 426 - if (retval) 427 - goto error_register; 407 + if (retval) { 408 + put_device(&port_dev->dev); 409 + return retval; 410 + } 411 + 412 + /* Set default policy of port-poweroff disabled. */ 413 + retval = dev_pm_qos_add_request(&port_dev->dev, port_dev->req, 414 + DEV_PM_QOS_FLAGS, PM_QOS_FLAG_NO_POWER_OFF); 415 + if (retval < 0) { 416 + device_unregister(&port_dev->dev); 417 + return retval; 418 + } 428 419 429 420 find_and_link_peer(hub, port1); 430 421 422 + /* 423 + * Enable runtime pm and hold a refernce that hub_configure() 424 + * will drop once the PM_QOS_NO_POWER_OFF flag state has been set 425 + * and the hub has been fully registered (hdev->maxchild set). 426 + */ 431 427 pm_runtime_set_active(&port_dev->dev); 428 + pm_runtime_get_noresume(&port_dev->dev); 429 + pm_runtime_enable(&port_dev->dev); 430 + device_enable_async_suspend(&port_dev->dev); 432 431 433 432 /* 434 - * Do not enable port runtime pm if the hub does not support 435 - * power switching. Also, userspace must have final say of 436 - * whether a port is permitted to power-off. Do not enable 437 - * runtime pm if we fail to expose pm_qos_no_power_off. 433 + * Keep hidden the ability to enable port-poweroff if the hub 434 + * does not support power switching. 438 435 */ 439 - if (hub_is_port_power_switchable(hub) 440 - && dev_pm_qos_expose_flags(&port_dev->dev, 441 - PM_QOS_FLAG_NO_POWER_OFF) == 0) 442 - pm_runtime_enable(&port_dev->dev); 436 + if (!hub_is_port_power_switchable(hub)) 437 + return 0; 443 438 444 - device_enable_async_suspend(&port_dev->dev); 439 + /* Attempt to let userspace take over the policy. */ 440 + retval = dev_pm_qos_expose_flags(&port_dev->dev, 441 + PM_QOS_FLAG_NO_POWER_OFF); 442 + if (retval < 0) { 443 + dev_warn(&port_dev->dev, "failed to expose pm_qos_no_poweroff\n"); 444 + return 0; 445 + } 446 + 447 + /* Userspace owns the policy, drop the kernel 'no_poweroff' request. */ 448 + retval = dev_pm_qos_remove_request(port_dev->req); 449 + if (retval >= 0) { 450 + kfree(port_dev->req); 451 + port_dev->req = NULL; 452 + } 445 453 return 0; 446 - 447 - error_register: 448 - put_device(&port_dev->dev); 449 - exit: 450 - return retval; 451 454 } 452 455 453 456 void usb_hub_remove_port_device(struct usb_hub *hub, int port1)
+16 -3
drivers/usb/host/pci-quirks.c
··· 656 656 DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), 657 657 }, 658 658 }, 659 + { 660 + /* HASEE E200 */ 661 + .matches = { 662 + DMI_MATCH(DMI_BOARD_VENDOR, "HASEE"), 663 + DMI_MATCH(DMI_BOARD_NAME, "E210"), 664 + DMI_MATCH(DMI_BIOS_VERSION, "6.00"), 665 + }, 666 + }, 659 667 { } 660 668 }; 661 669 ··· 673 665 { 674 666 int try_handoff = 1, tried_handoff = 0; 675 667 676 - /* The Pegatron Lucid tablet sporadically waits for 98 seconds trying 677 - * the handoff on its unused controller. Skip it. */ 678 - if (pdev->vendor == 0x8086 && pdev->device == 0x283a) { 668 + /* 669 + * The Pegatron Lucid tablet sporadically waits for 98 seconds trying 670 + * the handoff on its unused controller. Skip it. 671 + * 672 + * The HASEE E200 hangs when the semaphore is set (bugzilla #77021). 673 + */ 674 + if (pdev->vendor == 0x8086 && (pdev->device == 0x283a || 675 + pdev->device == 0x27cc)) { 679 676 if (dmi_check_system(ehci_dmi_nohandoff_table)) 680 677 try_handoff = 0; 681 678 }
+1 -1
drivers/usb/host/xhci-hub.c
··· 287 287 if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { 288 288 struct xhci_command *command; 289 289 command = xhci_alloc_command(xhci, false, false, 290 - GFP_NOIO); 290 + GFP_NOWAIT); 291 291 if (!command) { 292 292 spin_unlock_irqrestore(&xhci->lock, flags); 293 293 xhci_free_command(xhci, cmd);
+15 -1
drivers/usb/misc/usbtest.c
··· 7 7 #include <linux/moduleparam.h> 8 8 #include <linux/scatterlist.h> 9 9 #include <linux/mutex.h> 10 - 10 + #include <linux/timer.h> 11 11 #include <linux/usb.h> 12 12 13 13 #define SIMPLE_IO_TIMEOUT 10000 /* in milliseconds */ ··· 484 484 return sg; 485 485 } 486 486 487 + static void sg_timeout(unsigned long _req) 488 + { 489 + struct usb_sg_request *req = (struct usb_sg_request *) _req; 490 + 491 + req->status = -ETIMEDOUT; 492 + usb_sg_cancel(req); 493 + } 494 + 487 495 static int perform_sglist( 488 496 struct usbtest_dev *tdev, 489 497 unsigned iterations, ··· 503 495 { 504 496 struct usb_device *udev = testdev_to_usbdev(tdev); 505 497 int retval = 0; 498 + struct timer_list sg_timer; 499 + 500 + setup_timer_on_stack(&sg_timer, sg_timeout, (unsigned long) req); 506 501 507 502 while (retval == 0 && iterations-- > 0) { 508 503 retval = usb_sg_init(req, udev, pipe, ··· 516 505 517 506 if (retval) 518 507 break; 508 + mod_timer(&sg_timer, jiffies + 509 + msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); 519 510 usb_sg_wait(req); 511 + del_timer_sync(&sg_timer); 520 512 retval = req->status; 521 513 522 514 /* FIXME check resulting data pattern */