]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/commitdiff
uhci: Export uhci_realloc_pipe() instead of uhci_alloc_pipe()
authorKevin O'Connor <kevin@koconnor.net>
Thu, 16 Oct 2014 17:33:35 +0000 (13:33 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 16 Oct 2014 20:30:15 +0000 (16:30 -0400)
Support alloc, update, and free from the single exported function.

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

index e940d917ba4b5dd038c1c5ff12ee4cbc8fedac5a..6dcc3401d5800adfe4e558db7c5a7d39c9ff37bf 100644 (file)
@@ -352,11 +352,14 @@ fail:
 }
 
 struct usb_pipe *
-uhci_alloc_pipe(struct usbdevice_s *usbdev
-                , struct usb_endpoint_descriptor *epdesc)
+uhci_realloc_pipe(struct usbdevice_s *usbdev, struct usb_pipe *upipe
+                  , struct usb_endpoint_descriptor *epdesc)
 {
     if (! CONFIG_USB_UHCI)
         return NULL;
+    usb_add_freelist(upipe);
+    if (!epdesc)
+        return NULL;
     u8 eptype = epdesc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
     if (eptype == USB_ENDPOINT_XFER_INT)
         return uhci_alloc_intr_pipe(usbdev, epdesc);
index 6b675bbdd204f2563a2934ae86f59391be6f19eb..541954adcbf6706b4a0754f6a50d07ce47ecce8d 100644 (file)
@@ -5,9 +5,10 @@
 void uhci_setup(void);
 struct usbdevice_s;
 struct usb_endpoint_descriptor;
-struct usb_pipe *uhci_alloc_pipe(struct usbdevice_s *usbdev
-                                 , struct usb_endpoint_descriptor *epdesc);
 struct usb_pipe;
+struct usb_pipe *uhci_realloc_pipe(struct usbdevice_s *usbdev
+                                   , struct usb_pipe *upipe
+                                   , struct usb_endpoint_descriptor *epdesc);
 int uhci_send_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
                       , void *data, int datasize);
 int uhci_send_bulk(struct usb_pipe *p, int dir, void *data, int datasize);
index 1fb5051303851436e4d03d333fd60827ae3840cf..51100539bfb3854af1068831af017b2fe5a80fbf 100644 (file)
@@ -34,7 +34,7 @@ usb_alloc_pipe(struct usbdevice_s *usbdev
     switch (usbdev->hub->cntl->type) {
     default:
     case USB_TYPE_UHCI:
-        return uhci_alloc_pipe(usbdev, epdesc);
+        return uhci_realloc_pipe(usbdev, NULL, epdesc);
     case USB_TYPE_OHCI:
         return ohci_alloc_pipe(usbdev, epdesc);
     case USB_TYPE_EHCI: