[SeaBIOS] [PATCH] usb: Remove usbdev->slotid field

Kevin O'Connor kevin at koconnor.net
Tue Jan 5 19:44:20 CET 2016


The usbdev->slotid field is xhci specific and on xhci it is always
reachable from usbdev->defpipe->slotid.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/hw/usb-xhci.c | 6 ++++--
 src/hw/usb.h      | 1 -
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c
index 3359cff..089cae7 100644
--- a/src/hw/usb-xhci.c
+++ b/src/hw/usb-xhci.c
@@ -1006,9 +1006,11 @@ xhci_alloc_pipe(struct usbdevice_s *usbdev
             free(dev);
             goto fail;
         }
-        pipe->slotid = usbdev->slotid = slotid;
+        pipe->slotid = slotid;
     } else {
-        pipe->slotid = usbdev->slotid;
+        struct xhci_pipe *defpipe = container_of(
+            usbdev->defpipe, struct xhci_pipe, pipe);
+        pipe->slotid = defpipe->slotid;
         // Send configure command.
         int cc = xhci_cmd_configure_endpoint(xhci, pipe->slotid, in);
         if (cc != CC_SUCCESS) {
diff --git a/src/hw/usb.h b/src/hw/usb.h
index efb5e6f..94e12b2 100644
--- a/src/hw/usb.h
+++ b/src/hw/usb.h
@@ -22,7 +22,6 @@ struct usb_pipe {
 struct usbdevice_s {
     struct usbhub_s *hub;
     struct usb_pipe *defpipe;
-    u32 slotid;
     u32 port;
     struct usb_config_descriptor *config;
     struct usb_interface_descriptor *iface;
-- 
2.5.0




More information about the SeaBIOS mailing list