]> xenbits.xensource.com Git - seabios.git/commitdiff
usb: Centralize pipe free list code.
authorKevin O'Connor <kevin@koconnor.net>
Tue, 6 Mar 2012 02:48:34 +0000 (21:48 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Tue, 6 Mar 2012 12:29:57 +0000 (07:29 -0500)
Now that all controllers use a free list, maintain the free list in
the common code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/usb-ehci.c
src/usb-ehci.h
src/usb-ohci.c
src/usb-ohci.h
src/usb-uhci.c
src/usb-uhci.h
src/usb.c

index 2978072a65f9b2af02ba2f05cbe82adc0407c6c7..5717dc633635704e4ab15c96ca235c3bbba23d88 100644 (file)
@@ -423,17 +423,6 @@ ehci_wait_td(struct ehci_pipe *pipe, struct ehci_qtd *td, int timeout)
     return 0;
 }
 
-void
-ehci_free_pipe(struct usb_pipe *pipe)
-{
-    if (! CONFIG_USB_EHCI)
-        return;
-    // Add to controller's free list.
-    struct usb_s *cntl = pipe->cntl;
-    pipe->freenext = cntl->freelist;
-    cntl->freelist = pipe;
-}
-
 static struct usb_pipe *
 ehci_alloc_pipe(struct usb_pipe *dummy, int iscontrol)
 {
index 1a2c6c78b76128f2a2f8339a28fa95ae5c59b4c4..fd38b734ad2d33fdc5fa81adb26e567dfdd16b15 100644 (file)
@@ -4,7 +4,6 @@
 // usb-ehci.c
 int ehci_init(struct pci_device *pci, int busid, struct pci_device *comppci);
 struct usb_pipe;
-void ehci_free_pipe(struct usb_pipe *p);
 struct usb_pipe *ehci_alloc_control_pipe(struct usb_pipe *dummy);
 int ehci_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
                  , void *data, int datasize);
index 7a437ad6cb0c3cb615626c8d71a400492dd1cc02..ac1eb3775169b0b0a80f836fe57fc048655b554a 100644 (file)
@@ -319,15 +319,6 @@ wait_ed(struct ohci_ed *ed)
     }
 }
 
-void
-ohci_free_pipe(struct usb_pipe *pipe)
-{
-    // Add to controller's free list.
-    struct usb_s *cntl = pipe->cntl;
-    pipe->freenext = cntl->freelist;
-    cntl->freelist = pipe;
-}
-
 struct usb_pipe *
 ohci_alloc_control_pipe(struct usb_pipe *dummy)
 {
index c7670ffd86c7669549fe438e4f69314cdaa28fa8..6162d32b314ee372c0e5ca10e16b82a4dcf35692 100644 (file)
@@ -4,7 +4,6 @@
 // usb-ohci.c
 void ohci_init(struct pci_device *pci, int busid);
 struct usb_pipe;
-void ohci_free_pipe(struct usb_pipe *p);
 struct usb_pipe *ohci_alloc_control_pipe(struct usb_pipe *dummy);
 int ohci_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
                  , void *data, int datasize);
index 015b974d5d96d4a0b4ddbacd32354a798910b294..4f7fbb4d59c5938a82995d8feb8b562c1999c5c4 100644 (file)
@@ -294,17 +294,6 @@ wait_pipe(struct uhci_pipe *pipe, int timeout)
     }
 }
 
-void
-uhci_free_pipe(struct usb_pipe *pipe)
-{
-    if (! CONFIG_USB_UHCI)
-        return;
-    // Add to controller's free list.
-    struct usb_s *cntl = pipe->cntl;
-    pipe->freenext = cntl->freelist;
-    cntl->freelist = pipe;
-}
-
 static struct usb_pipe *
 uhci_alloc_pipe(struct usb_pipe *dummy, int iscontrol)
 {
index b5f70f77ba7f617ba4f92ad57c036c5d5e2e9a45..59b190d1ab4be895620a0f56a9c4c1975c141665 100644 (file)
@@ -4,7 +4,6 @@
 // usb-uhci.c
 void uhci_init(struct pci_device *pci, int busid);
 struct usb_pipe;
-void uhci_free_pipe(struct usb_pipe *p);
 struct usb_pipe *uhci_alloc_control_pipe(struct usb_pipe *dummy);
 int uhci_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
                  , void *data, int datasize);
index 1f69d16aa2b738d732125891d8aff0b50602f45a..f522e1a91efcc0025ce138d51d661a145b5a2167 100644 (file)
--- a/src/usb.c
+++ b/src/usb.c
@@ -30,15 +30,10 @@ free_pipe(struct usb_pipe *pipe)
     ASSERT32FLAT();
     if (!pipe)
         return;
-    switch (pipe->type) {
-    default:
-    case USB_TYPE_UHCI:
-        return uhci_free_pipe(pipe);
-    case USB_TYPE_OHCI:
-        return ohci_free_pipe(pipe);
-    case USB_TYPE_EHCI:
-        return ehci_free_pipe(pipe);
-    }
+    // Add to controller's free list.
+    struct usb_s *cntl = pipe->cntl;
+    pipe->freenext = cntl->freelist;
+    cntl->freelist = pipe;
 }
 
 // Allocate a control pipe to a default endpoint (which can only be