[PATCH] USB HCDs: no longer need to register root hub
authorAlan Stern <stern@rowland.harvard.edu>
Mon, 25 Apr 2005 15:28:04 +0000 (11:28 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 27 Jun 2005 21:43:49 +0000 (14:43 -0700)
This patch changes the host controller drivers; they no longer need to
register their root hubs because usbcore will take care of it for them.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/dummy_hcd.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/isp116x-hcd.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/sl811-hcd.c
drivers/usb/host/uhci-hcd.c

index 9d37fc7..1918d10 100644 (file)
@@ -1625,7 +1625,6 @@ static DEVICE_ATTR (urbs, S_IRUGO, show_urbs, NULL);
 static int dummy_start (struct usb_hcd *hcd)
 {
        struct dummy            *dum;
-       struct usb_device       *root;
        int                     retval;
 
        dum = hcd_to_dummy (hcd);
@@ -1642,35 +1641,16 @@ static int dummy_start (struct usb_hcd *hcd)
 
        INIT_LIST_HEAD (&dum->urbp_list);
 
-       root = usb_alloc_dev (NULL, &hcd->self, 0);
-       if (!root)
-               return -ENOMEM;
+       if ((retval = dummy_register_udc (dum)) != 0)
+               return retval;
 
        /* only show a low-power port: just 8mA */
        hcd->power_budget = 8;
-
-       /* root hub enters addressed state... */
        hcd->state = HC_STATE_RUNNING;
-       root->speed = USB_SPEED_HIGH;
-
-       /* ...then configured, so khubd sees us. */
-       if ((retval = usb_hcd_register_root_hub (root, hcd)) != 0) {
-               goto err1;
-       }
-
-       if ((retval = dummy_register_udc (dum)) != 0)
-               goto err2;
 
        /* FIXME 'urbs' should be a per-device thing, maybe in usbcore */
        device_create_file (dummy_dev(dum), &dev_attr_urbs);
        return 0;
-
- err2:
-       usb_disconnect (&hcd->self.root_hub);
- err1:
-       usb_put_dev (root);
-       hcd->state = HC_STATE_QUIESCING;
-       return retval;
 }
 
 static void dummy_stop (struct usb_hcd *hcd)
index bc69bd7..527abc6 100644 (file)
@@ -492,8 +492,6 @@ static int ehci_start (struct usb_hcd *hcd)
 {
        struct ehci_hcd         *ehci = hcd_to_ehci (hcd);
        u32                     temp;
-       struct usb_device       *udev;
-       struct usb_bus          *bus;
        int                     retval;
        u32                     hcc_params;
        u8                      sbrn = 0;
@@ -631,17 +629,6 @@ static int ehci_start (struct usb_hcd *hcd)
 
        /* set async sleep time = 10 us ... ? */
 
-       /* wire up the root hub */
-       bus = hcd_to_bus (hcd);
-       udev = first ? usb_alloc_dev (NULL, bus, 0) : bus->root_hub;
-       if (!udev) {
-done2:
-               ehci_mem_cleanup (ehci);
-               return -ENOMEM;
-       }
-       udev->speed = USB_SPEED_HIGH;
-       udev->state = first ? USB_STATE_ATTACHED : USB_STATE_CONFIGURED;
-
        /*
         * Start, enabling full USB 2.0 functionality ... usb 1.1 devices
         * are explicitly handed to companion controller(s), so no TT is
@@ -664,24 +651,6 @@ done2:
                first ? "initialized" : "restarted",
                temp >> 8, temp & 0xff, DRIVER_VERSION);
 
-       /*
-        * From here on, khubd concurrently accesses the root
-        * hub; drivers will be talking to enumerated devices.
-        * (On restart paths, khubd already knows about the root
-        * hub and could find work as soon as we wrote FLAG_CF.)
-        *
-        * Before this point the HC was idle/ready.  After, khubd
-        * and device drivers may start it running.
-        */
-       if (first && usb_hcd_register_root_hub (udev, hcd) != 0) {
-               if (hcd->state == HC_STATE_RUNNING)
-                       ehci_quiesce (ehci);
-               ehci_reset (ehci);
-               usb_put_dev (udev); 
-               retval = -ENODEV;
-               goto done2;
-       }
-
        writel (INTR_MASK, &ehci->regs->intr_enable); /* Turn On Interrupts */
 
        if (first)
Simple merge
Simple merge
Simple merge
Simple merge