]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[usb] Avoid unnecessary calls to usb_hub_set_drvdata()
authorMichael Brown <mcb30@ipxe.org>
Fri, 3 Jul 2020 10:29:25 +0000 (11:29 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 3 Jul 2020 11:10:04 +0000 (12:10 +0100)
The driver-private data for root hubs is already set immediately after
allocating the USB bus.  There seems to be no reason to set it again
when opening the root hub.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/usb/ehci.c
src/drivers/usb/uhci.c
src/drivers/usb/xhci.c

index cd39670707e7af286500a91d92a7cbd6067de673..29c32b356341f1382ccb707e721ef58c6d883832 100644 (file)
@@ -1552,8 +1552,7 @@ static void ehci_hub_close ( struct usb_hub *hub __unused ) {
  * @ret rc             Return status code
  */
 static int ehci_root_open ( struct usb_hub *hub ) {
-       struct usb_bus *bus = hub->bus;
-       struct ehci_device *ehci = usb_bus_get_hostdata ( bus );
+       struct ehci_device *ehci = usb_hub_get_drvdata ( hub );
        uint32_t portsc;
        unsigned int i;
 
@@ -1571,9 +1570,6 @@ static int ehci_root_open ( struct usb_hub *hub ) {
        /* Wait 20ms after potentially enabling power to a port */
        mdelay ( EHCI_PORT_POWER_DELAY_MS );
 
-       /* Record hub driver private data */
-       usb_hub_set_drvdata ( hub, ehci );
-
        return 0;
 }
 
@@ -1587,9 +1583,6 @@ static void ehci_root_close ( struct usb_hub *hub ) {
 
        /* Route all ports back to companion controllers */
        writel ( 0, ehci->op + EHCI_OP_CONFIGFLAG );
-
-       /* Clear hub driver private data */
-       usb_hub_set_drvdata ( hub, NULL );
 }
 
 /**
index 528c1be1d6e89928d7cd0b4b8c27088293fc5e2c..ce2962d36565f5f968c8e378d0af25a07c3a2e56 100644 (file)
@@ -1124,13 +1124,9 @@ static void uhci_hub_close ( struct usb_hub *hub __unused ) {
  * @v hub              USB hub
  * @ret rc             Return status code
  */
-static int uhci_root_open ( struct usb_hub *hub ) {
-       struct usb_bus *bus = hub->bus;
-       struct uhci_device *uhci = usb_bus_get_hostdata ( bus );
-
-       /* Record hub driver private data */
-       usb_hub_set_drvdata ( hub, uhci );
+static int uhci_root_open ( struct usb_hub *hub __unused) {
 
+       /* Nothing to do */
        return 0;
 }
 
@@ -1139,10 +1135,9 @@ static int uhci_root_open ( struct usb_hub *hub ) {
  *
  * @v hub              USB hub
  */
-static void uhci_root_close ( struct usb_hub *hub ) {
+static void uhci_root_close ( struct usb_hub *hub __unused ) {
 
-       /* Clear hub driver private data */
-       usb_hub_set_drvdata ( hub, NULL );
+       /* Nothing to do */
 }
 
 /**
index 21c3e00015aee72ee59d9454ba8e8e5e152df216..aa6ca73c4779971742f602fe0b43cb81ff8ef4d0 100644 (file)
@@ -2944,8 +2944,7 @@ static void xhci_hub_close ( struct usb_hub *hub __unused ) {
  * @ret rc             Return status code
  */
 static int xhci_root_open ( struct usb_hub *hub ) {
-       struct usb_bus *bus = hub->bus;
-       struct xhci_device *xhci = usb_bus_get_hostdata ( bus );
+       struct xhci_device *xhci = usb_hub_get_drvdata ( hub );
        struct usb_port *port;
        uint32_t portsc;
        unsigned int i;
@@ -2982,9 +2981,6 @@ static int xhci_root_open ( struct usb_hub *hub ) {
         */
        mdelay ( XHCI_LINK_STATE_DELAY_MS );
 
-       /* Record hub driver private data */
-       usb_hub_set_drvdata ( hub, xhci );
-
        return 0;
 }
 
@@ -2993,10 +2989,9 @@ static int xhci_root_open ( struct usb_hub *hub ) {
  *
  * @v hub              USB hub
  */
-static void xhci_root_close ( struct usb_hub *hub ) {
+static void xhci_root_close ( struct usb_hub *hub __unused ) {
 
-       /* Clear hub driver private data */
-       usb_hub_set_drvdata ( hub, NULL );
+       /* Nothing to do */
 }
 
 /**