[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>
pull/119/head
Michael Brown 2020-07-03 11:29:25 +01:00
parent 18d4be8aaf
commit e87760183d
3 changed files with 8 additions and 25 deletions

View 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 );
}
/**

View 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 */
}
/**

View 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 */
}
/**