[SeaBIOS] [PATCH 08/11] uhci: Export uhci_realloc_pipe() instead of uhci_alloc_pipe()
Kevin O'Connor
kevin at koconnor.net
Thu Oct 16 22:23:00 CEST 2014
Support alloc, update, and free from the single exported function.
Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
src/hw/usb-uhci.c | 7 +++++--
src/hw/usb-uhci.h | 5 +++--
src/hw/usb.c | 2 +-
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/hw/usb-uhci.c b/src/hw/usb-uhci.c
index e940d91..6dcc340 100644
--- a/src/hw/usb-uhci.c
+++ b/src/hw/usb-uhci.c
@@ -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);
diff --git a/src/hw/usb-uhci.h b/src/hw/usb-uhci.h
index 6b675bb..541954a 100644
--- a/src/hw/usb-uhci.h
+++ b/src/hw/usb-uhci.h
@@ -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);
diff --git a/src/hw/usb.c b/src/hw/usb.c
index 1fb5051..5110053 100644
--- a/src/hw/usb.c
+++ b/src/hw/usb.c
@@ -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:
--
1.9.3
More information about the SeaBIOS
mailing list