aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-07-03 11:29:25 +0100
committerMichael Brown <mcb30@ipxe.org>2020-07-03 12:10:04 +0100
commite87760183df0d7e07533e3361041620617389429 (patch)
tree1cbae95231bb5067cfe40e148e46582c92fe798a
parent18d4be8aafe9ea468daed907aca3fd730e8c0d2e (diff)
downloadipxe-e87760183df0d7e07533e3361041620617389429.zip
ipxe-e87760183df0d7e07533e3361041620617389429.tar.gz
ipxe-e87760183df0d7e07533e3361041620617389429.tar.bz2
[usb] Avoid unnecessary calls to usb_hub_set_drvdata()
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>
-rw-r--r--src/drivers/usb/ehci.c9
-rw-r--r--src/drivers/usb/uhci.c13
-rw-r--r--src/drivers/usb/xhci.c11
3 files changed, 8 insertions, 25 deletions
diff --git a/src/drivers/usb/ehci.c b/src/drivers/usb/ehci.c
index cd39670..29c32b3 100644
--- a/src/drivers/usb/ehci.c
+++ b/src/drivers/usb/ehci.c
@@ -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 );
}
/**
diff --git a/src/drivers/usb/uhci.c b/src/drivers/usb/uhci.c
index 528c1be..ce2962d 100644
--- a/src/drivers/usb/uhci.c
+++ b/src/drivers/usb/uhci.c
@@ -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 */
}
/**
diff --git a/src/drivers/usb/xhci.c b/src/drivers/usb/xhci.c
index 21c3e00..aa6ca73 100644
--- a/src/drivers/usb/xhci.c
+++ b/src/drivers/usb/xhci.c
@@ -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 */
}
/**