aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2005-04-25 11:28:04 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-27 14:43:49 -0700
commit247f3105636caa9d1d8a4c3dfb755de42633bc80 (patch)
treef5fca7b566ee3304d661485a11dc4877652e7904
parent8ec8d20b21f00a36343ca0ebd6c6be9421724a1e (diff)
[PATCH] USB HCDs: no longer need to register root hub
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>
-rw-r--r--drivers/usb/gadget/dummy_hcd.c24
-rw-r--r--drivers/usb/host/ehci-hcd.c31
-rw-r--r--drivers/usb/host/isp116x-hcd.c16
-rw-r--r--drivers/usb/host/ohci-hcd.c30
-rw-r--r--drivers/usb/host/sl811-hcd.c13
-rw-r--r--drivers/usb/host/uhci-hcd.c25
6 files changed, 4 insertions, 135 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 9d37fc771b2..1918d10f756 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -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)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index bc69bd7aceb..527abc693b1 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -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)
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 1183988fdf5..ff0a168e8ee 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1547,7 +1547,6 @@ static int isp116x_start(struct usb_hcd *hcd)
{
struct isp116x *isp116x = hcd_to_isp116x(hcd);
struct isp116x_platform_data *board = isp116x->board;
- struct usb_device *udev;
u32 val;
unsigned long flags;
@@ -1609,24 +1608,9 @@ static int isp116x_start(struct usb_hcd *hcd)
isp116x->rhstatus = isp116x_read_reg32(isp116x, HCRHSTATUS);
isp116x_write_reg32(isp116x, HCFMINTVL, 0x27782edf);
- spin_unlock_irqrestore(&isp116x->lock, flags);
-
- udev = usb_alloc_dev(NULL, &hcd->self, 0);
- if (!udev) {
- isp116x_stop(hcd);
- return -ENOMEM;
- }
- udev->speed = USB_SPEED_FULL;
hcd->state = HC_STATE_RUNNING;
- if (usb_hcd_register_root_hub(udev, hcd) != 0) {
- isp116x_stop(hcd);
- usb_put_dev(udev);
- return -ENODEV;
- }
-
- spin_lock_irqsave(&isp116x->lock, flags);
/* Set up interrupts */
isp116x->intenb = HCINT_MIE | HCINT_RHSC | HCINT_UE;
if (board->remote_wakeup_enable)
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 0da99619125..13cd2177b55 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -505,13 +505,10 @@ static int ohci_init (struct ohci_hcd *ohci)
/* Start an OHCI controller, set the BUS operational
* resets USB and controller
* enable interrupts
- * connect the virtual root hub
*/
static int ohci_run (struct ohci_hcd *ohci)
{
u32 mask, temp;
- struct usb_device *udev;
- struct usb_bus *bus;
int first = ohci->fminterval == 0;
disable (ohci);
@@ -672,36 +669,13 @@ retry:
// POTPGT delay is bits 24-31, in 2 ms units.
mdelay ((temp >> 23) & 0x1fe);
- bus = &ohci_to_hcd(ohci)->self;
ohci_to_hcd(ohci)->state = HC_STATE_RUNNING;
ohci_dump (ohci, 1);
- udev = bus->root_hub;
- if (udev) {
- return 0;
- }
-
- /* connect the virtual root hub */
- udev = usb_alloc_dev (NULL, bus, 0);
- if (!udev) {
- disable (ohci);
- ohci->hc_control &= ~OHCI_CTRL_HCFS;
- ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
- return -ENOMEM;
- }
-
- udev->speed = USB_SPEED_FULL;
- if (usb_hcd_register_root_hub (udev, ohci_to_hcd(ohci)) != 0) {
- usb_put_dev (udev);
- disable (ohci);
- ohci->hc_control &= ~OHCI_CTRL_HCFS;
- ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
- return -ENODEV;
- }
+ if (ohci_to_hcd(ohci)->self.root_hub == NULL)
+ create_debug_files (ohci);
- register_reboot_notifier (&ohci->reboot_notifier);
- create_debug_files (ohci);
return 0;
}
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 1f2d00fe983..6c3f910bc30 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1563,15 +1563,8 @@ static int
sl811h_start(struct usb_hcd *hcd)
{
struct sl811 *sl811 = hcd_to_sl811(hcd);
- struct usb_device *udev;
/* chip has been reset, VBUS power is off */
-
- udev = usb_alloc_dev(NULL, &hcd->self, 0);
- if (!udev)
- return -ENOMEM;
-
- udev->speed = USB_SPEED_FULL;
hcd->state = HC_STATE_RUNNING;
if (sl811->board) {
@@ -1579,12 +1572,6 @@ sl811h_start(struct usb_hcd *hcd)
hcd->power_budget = sl811->board->power * 2;
}
- if (usb_hcd_register_root_hub(udev, hcd) != 0) {
- usb_put_dev(udev);
- sl811h_stop(hcd);
- return -ENODEV;
- }
-
/* enable power and interupts */
port_power(sl811, 1);
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 6b87bd74b04..fdf54295da7 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -562,7 +562,6 @@ static int uhci_start(struct usb_hcd *hcd)
int retval = -EBUSY;
int i;
dma_addr_t dma_handle;
- struct usb_device *udev;
struct dentry *dentry;
hcd->uses_new_polling = 1;
@@ -626,14 +625,6 @@ static int uhci_start(struct usb_hcd *hcd)
goto err_create_qh_pool;
}
- /* Initialize the root hub */
-
- udev = usb_alloc_dev(NULL, &hcd->self, 0);
- if (!udev) {
- dev_err(uhci_dev(uhci), "unable to allocate root hub\n");
- goto err_alloc_root_hub;
- }
-
uhci->term_td = uhci_alloc_td(uhci);
if (!uhci->term_td) {
dev_err(uhci_dev(uhci), "unable to allocate terminating TD\n");
@@ -713,24 +704,11 @@ static int uhci_start(struct usb_hcd *hcd)
configure_hc(uhci);
start_rh(uhci);
-
- udev->speed = USB_SPEED_FULL;
-
- if (usb_hcd_register_root_hub(udev, hcd) != 0) {
- dev_err(uhci_dev(uhci), "unable to start root hub\n");
- retval = -ENOMEM;
- goto err_start_root_hub;
- }
-
return 0;
/*
* error exits:
*/
-err_start_root_hub:
- reset_hc(uhci);
- del_timer_sync(&uhci->stall_timer);
-
err_alloc_skelqh:
for (i = 0; i < UHCI_NUM_SKELQH; i++)
if (uhci->skelqh[i]) {
@@ -742,9 +720,6 @@ err_alloc_skelqh:
uhci->term_td = NULL;
err_alloc_term_td:
- usb_put_dev(udev);
-
-err_alloc_root_hub:
dma_pool_destroy(uhci->qh_pool);
uhci->qh_pool = NULL;