aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/gadget/dummy_hcd.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index e9b95df5b23d..ffedf4d1b747 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -601,7 +601,7 @@ static int dummy_wakeup (struct usb_gadget *_gadget)
601 struct dummy *dum; 601 struct dummy *dum;
602 602
603 dum = gadget_to_dummy (_gadget); 603 dum = gadget_to_dummy (_gadget);
604 if (!(dum->port_status & (1 << USB_PORT_FEAT_SUSPEND)) 604 if (!(dum->port_status & USB_PORT_STAT_SUSPEND)
605 || !(dum->devstatus & 605 || !(dum->devstatus &
606 ( (1 << USB_DEVICE_B_HNP_ENABLE) 606 ( (1 << USB_DEVICE_B_HNP_ENABLE)
607 | (1 << USB_DEVICE_REMOTE_WAKEUP)))) 607 | (1 << USB_DEVICE_REMOTE_WAKEUP))))
@@ -609,7 +609,7 @@ static int dummy_wakeup (struct usb_gadget *_gadget)
609 609
610 /* hub notices our request, issues downstream resume, etc */ 610 /* hub notices our request, issues downstream resume, etc */
611 dum->resuming = 1; 611 dum->resuming = 1;
612 dum->port_status |= (1 << USB_PORT_FEAT_C_SUSPEND); 612 dum->port_status |= (USB_PORT_STAT_C_SUSPEND << 16);
613 return 0; 613 return 0;
614} 614}
615 615
@@ -661,15 +661,15 @@ DEVICE_ATTR (function, S_IRUGO, show_function, NULL);
661 * for each driver that registers: just add to a big root hub. 661 * for each driver that registers: just add to a big root hub.
662 */ 662 */
663 663
664/* This doesn't need to do anything because the udc device structure is
665 * stored inside the hcd and will be deallocated along with it. */
664static void 666static void
665dummy_udc_release (struct device *dev) 667dummy_udc_release (struct device *dev) {}
666{
667}
668 668
669/* This doesn't need to do anything because the pdev structure is
670 * statically allocated. */
669static void 671static void
670dummy_pdev_release (struct device *dev) 672dummy_pdev_release (struct device *dev) {}
671{
672}
673 673
674static int 674static int
675dummy_register_udc (struct dummy *dum) 675dummy_register_udc (struct dummy *dum)
@@ -753,15 +753,13 @@ usb_gadget_register_driver (struct usb_gadget_driver *driver)
753 return retval; 753 return retval;
754 } 754 }
755 755
756 // FIXME: Check these calls for errors and re-order
757 driver->driver.bus = dum->gadget.dev.parent->bus; 756 driver->driver.bus = dum->gadget.dev.parent->bus;
758 driver_register (&driver->driver); 757 driver_register (&driver->driver);
759
760 device_bind_driver (&dum->gadget.dev); 758 device_bind_driver (&dum->gadget.dev);
761 759
762 /* khubd will enumerate this in a while */ 760 /* khubd will enumerate this in a while */
763 dum->port_status |= USB_PORT_STAT_CONNECTION 761 dum->port_status |= USB_PORT_STAT_CONNECTION
764 | (1 << USB_PORT_FEAT_C_CONNECTION); 762 | (USB_PORT_STAT_C_CONNECTION << 16);
765 return 0; 763 return 0;
766} 764}
767EXPORT_SYMBOL (usb_gadget_register_driver); 765EXPORT_SYMBOL (usb_gadget_register_driver);
@@ -807,14 +805,13 @@ usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
807 stop_activity (dum, driver); 805 stop_activity (dum, driver);
808 dum->port_status &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE | 806 dum->port_status &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE |
809 USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED); 807 USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED);
810 dum->port_status |= (1 << USB_PORT_FEAT_C_CONNECTION); 808 dum->port_status |= (USB_PORT_STAT_C_CONNECTION << 16);
811 spin_unlock_irqrestore (&dum->lock, flags); 809 spin_unlock_irqrestore (&dum->lock, flags);
812 810
813 driver->unbind (&dum->gadget); 811 driver->unbind (&dum->gadget);
814 dum->driver = NULL; 812 dum->driver = NULL;
815 813
816 device_release_driver (&dum->gadget.dev); 814 device_release_driver (&dum->gadget.dev);
817
818 driver_unregister (&driver->driver); 815 driver_unregister (&driver->driver);
819 816
820 return 0; 817 return 0;
@@ -1406,11 +1403,11 @@ return_urb:
1406/*-------------------------------------------------------------------------*/ 1403/*-------------------------------------------------------------------------*/
1407 1404
1408#define PORT_C_MASK \ 1405#define PORT_C_MASK \
1409 ((1 << USB_PORT_FEAT_C_CONNECTION) \ 1406 ((USB_PORT_STAT_C_CONNECTION \
1410 | (1 << USB_PORT_FEAT_C_ENABLE) \ 1407 | USB_PORT_STAT_C_ENABLE \
1411 | (1 << USB_PORT_FEAT_C_SUSPEND) \ 1408 | USB_PORT_STAT_C_SUSPEND \
1412 | (1 << USB_PORT_FEAT_C_OVER_CURRENT) \ 1409 | USB_PORT_STAT_C_OVERCURRENT \
1413 | (1 << USB_PORT_FEAT_C_RESET)) 1410 | USB_PORT_STAT_C_RESET) << 16)
1414 1411
1415static int dummy_hub_status (struct usb_hcd *hcd, char *buf) 1412static int dummy_hub_status (struct usb_hcd *hcd, char *buf)
1416{ 1413{
@@ -1465,7 +1462,7 @@ static int dummy_hub_control (
1465 case ClearPortFeature: 1462 case ClearPortFeature:
1466 switch (wValue) { 1463 switch (wValue) {
1467 case USB_PORT_FEAT_SUSPEND: 1464 case USB_PORT_FEAT_SUSPEND:
1468 if (dum->port_status & (1 << USB_PORT_FEAT_SUSPEND)) { 1465 if (dum->port_status & USB_PORT_STAT_SUSPEND) {
1469 /* 20msec resume signaling */ 1466 /* 20msec resume signaling */
1470 dum->resuming = 1; 1467 dum->resuming = 1;
1471 dum->re_timeout = jiffies + 1468 dum->re_timeout = jiffies +
@@ -1495,8 +1492,8 @@ static int dummy_hub_control (
1495 * complete it!! 1492 * complete it!!
1496 */ 1493 */
1497 if (dum->resuming && time_after (jiffies, dum->re_timeout)) { 1494 if (dum->resuming && time_after (jiffies, dum->re_timeout)) {
1498 dum->port_status |= (1 << USB_PORT_FEAT_C_SUSPEND); 1495 dum->port_status |= (USB_PORT_STAT_C_SUSPEND << 16);
1499 dum->port_status &= ~(1 << USB_PORT_FEAT_SUSPEND); 1496 dum->port_status &= ~USB_PORT_STAT_SUSPEND;
1500 dum->resuming = 0; 1497 dum->resuming = 0;
1501 dum->re_timeout = 0; 1498 dum->re_timeout = 0;
1502 if (dum->driver && dum->driver->resume) { 1499 if (dum->driver && dum->driver->resume) {
@@ -1505,10 +1502,10 @@ static int dummy_hub_control (
1505 spin_lock (&dum->lock); 1502 spin_lock (&dum->lock);
1506 } 1503 }
1507 } 1504 }
1508 if ((dum->port_status & (1 << USB_PORT_FEAT_RESET)) != 0 1505 if ((dum->port_status & USB_PORT_STAT_RESET) != 0
1509 && time_after (jiffies, dum->re_timeout)) { 1506 && time_after (jiffies, dum->re_timeout)) {
1510 dum->port_status |= (1 << USB_PORT_FEAT_C_RESET); 1507 dum->port_status |= (USB_PORT_STAT_C_RESET << 16);
1511 dum->port_status &= ~(1 << USB_PORT_FEAT_RESET); 1508 dum->port_status &= ~USB_PORT_STAT_RESET;
1512 dum->re_timeout = 0; 1509 dum->re_timeout = 0;
1513 if (dum->driver) { 1510 if (dum->driver) {
1514 dum->port_status |= USB_PORT_STAT_ENABLE; 1511 dum->port_status |= USB_PORT_STAT_ENABLE;
@@ -1540,10 +1537,9 @@ static int dummy_hub_control (
1540 case SetPortFeature: 1537 case SetPortFeature:
1541 switch (wValue) { 1538 switch (wValue) {
1542 case USB_PORT_FEAT_SUSPEND: 1539 case USB_PORT_FEAT_SUSPEND:
1543 if ((dum->port_status & (1 << USB_PORT_FEAT_SUSPEND)) 1540 if ((dum->port_status & USB_PORT_STAT_SUSPEND)
1544 == 0) { 1541 == 0) {
1545 dum->port_status |= 1542 dum->port_status |= USB_PORT_STAT_SUSPEND;
1546 (1 << USB_PORT_FEAT_SUSPEND);
1547 if (dum->driver && dum->driver->suspend) { 1543 if (dum->driver && dum->driver->suspend) {
1548 spin_unlock (&dum->lock); 1544 spin_unlock (&dum->lock);
1549 dum->driver->suspend (&dum->gadget); 1545 dum->driver->suspend (&dum->gadget);