Support alloc, update, and free from the single exported function.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/hw/usb-ohci.c | 7 +++++-- src/hw/usb-ohci.h | 5 +++-- src/hw/usb.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/hw/usb-ohci.c b/src/hw/usb-ohci.c index d19b667..4789768 100644 --- a/src/hw/usb-ohci.c +++ b/src/hw/usb-ohci.c @@ -387,11 +387,14 @@ err: }
struct usb_pipe * -ohci_alloc_pipe(struct usbdevice_s *usbdev - , struct usb_endpoint_descriptor *epdesc) +ohci_realloc_pipe(struct usbdevice_s *usbdev, struct usb_pipe *upipe + , struct usb_endpoint_descriptor *epdesc) { if (! CONFIG_USB_OHCI) 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 ohci_alloc_intr_pipe(usbdev, epdesc); diff --git a/src/hw/usb-ohci.h b/src/hw/usb-ohci.h index 14d2b1a..5699523 100644 --- a/src/hw/usb-ohci.h +++ b/src/hw/usb-ohci.h @@ -5,9 +5,10 @@ void ohci_setup(void); struct usbdevice_s; struct usb_endpoint_descriptor; -struct usb_pipe *ohci_alloc_pipe(struct usbdevice_s *usbdev - , struct usb_endpoint_descriptor *epdesc); struct usb_pipe; +struct usb_pipe *ohci_realloc_pipe(struct usbdevice_s *usbdev + , struct usb_pipe *upipe + , struct usb_endpoint_descriptor *epdesc); int ohci_send_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize , void *data, int datasize); int ohci_send_bulk(struct usb_pipe *p, int dir, void *data, int datasize); diff --git a/src/hw/usb.c b/src/hw/usb.c index 5110053..8551c4d 100644 --- a/src/hw/usb.c +++ b/src/hw/usb.c @@ -36,7 +36,7 @@ usb_alloc_pipe(struct usbdevice_s *usbdev case USB_TYPE_UHCI: return uhci_realloc_pipe(usbdev, NULL, epdesc); case USB_TYPE_OHCI: - return ohci_alloc_pipe(usbdev, epdesc); + return ohci_realloc_pipe(usbdev, NULL, epdesc); case USB_TYPE_EHCI: return ehci_alloc_pipe(usbdev, epdesc); case USB_TYPE_XHCI: