Now that all pipes use a free list, there is no need to cache the controller's default pipe. The regular free list provides the same capability.
Signed-off-by: Kevin O'Connor <ke...@koconnor.net> --- src/usb-ehci.c | 1 - src/usb-ohci.c | 1 - src/usb-uhci.c | 1 - src/usb.c | 37 +++++++++++++++++-------------------- src/usb.h | 1 - 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/usb-ehci.c b/src/usb-ehci.c index 5717dc6..0678560 100644 --- a/src/usb-ehci.c +++ b/src/usb-ehci.c @@ -310,7 +310,6 @@ configure_ehci(void *data) // Find devices int count = check_ehci_ports(cntl); - free_pipe(cntl->usb.defaultpipe); ehci_free_pipes(cntl); if (count) // Success diff --git a/src/usb-ohci.c b/src/usb-ohci.c index ac1eb37..d77727e 100644 --- a/src/usb-ohci.c +++ b/src/usb-ohci.c @@ -249,7 +249,6 @@ configure_ohci(void *data) goto err; int count = check_ohci_ports(cntl); - free_pipe(cntl->usb.defaultpipe); ohci_free_pipes(cntl); if (! count) goto err; diff --git a/src/usb-uhci.c b/src/usb-uhci.c index 4f7fbb4..9d46762 100644 --- a/src/usb-uhci.c +++ b/src/usb-uhci.c @@ -220,7 +220,6 @@ configure_uhci(void *data) // Find devices int count = check_uhci_ports(cntl); - free_pipe(cntl->usb.defaultpipe); uhci_free_pipes(cntl); if (count) // Success diff --git a/src/usb.c b/src/usb.c index f522e1a..e7ee6bc 100644 --- a/src/usb.c +++ b/src/usb.c @@ -246,19 +246,16 @@ usb_set_address(struct usbhub_s *hub, int port, int speed) if (cntl->maxaddr >= USB_MAXADDR) return NULL; - struct usb_pipe *defpipe = cntl->defaultpipe; - if (!defpipe) { - // Create a pipe for the default address. - struct usb_pipe dummy; - memset(&dummy, 0, sizeof(dummy)); - dummy.cntl = cntl; - dummy.type = cntl->type; - dummy.maxpacket = 8; - dummy.path = (u64)-1; - cntl->defaultpipe = defpipe = alloc_default_control_pipe(&dummy); - if (!defpipe) - return NULL; - } + // Create a pipe for the default address. + struct usb_pipe dummy; + memset(&dummy, 0, sizeof(dummy)); + dummy.cntl = cntl; + dummy.type = cntl->type; + dummy.maxpacket = 8; + dummy.path = (u64)-1; + struct usb_pipe *defpipe = alloc_default_control_pipe(&dummy); + if (!defpipe) + return NULL; defpipe->speed = speed; if (hub->pipe) { if (hub->pipe->speed == USB_HIGHSPEED) { @@ -271,6 +268,9 @@ usb_set_address(struct usbhub_s *hub, int port, int speed) } else { defpipe->tt_devaddr = defpipe->tt_port = 0; } + if (hub->pipe) + defpipe->path = hub->pipe->path; + defpipe->path = (defpipe->path << 8) | port; msleep(USB_TIME_RSTRCY); @@ -281,19 +281,16 @@ usb_set_address(struct usbhub_s *hub, int port, int speed) req.wIndex = 0; req.wLength = 0; int ret = send_default_control(defpipe, &req, NULL); - if (ret) + if (ret) { + free_pipe(defpipe); return NULL; + } msleep(USB_TIME_SETADDR_RECOVERY); cntl->maxaddr++; defpipe->devaddr = cntl->maxaddr; - struct usb_pipe *pipe = alloc_default_control_pipe(defpipe); - defpipe->devaddr = 0; - if (hub->pipe) - pipe->path = hub->pipe->path; - pipe->path = (pipe->path << 8) | port; - return pipe; + return defpipe; } // Called for every found device - see if a driver is available for diff --git a/src/usb.h b/src/usb.h index cc32eb7..47b25b6 100644 --- a/src/usb.h +++ b/src/usb.h @@ -22,7 +22,6 @@ struct usb_pipe { // Common information for usb controllers. struct usb_s { - struct usb_pipe *defaultpipe; struct usb_pipe *freelist; struct mutex_s resetlock; struct pci_device *pci; -- 1.7.6.5 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios