In the re-init path xhci_resume() passes 'hcd->primary_hcd' to hci_init(), however this field isn't initialized by __usb_create_hcd() for a HCD without secondary controller. xhci_resume() is called once per xHC device, not per hcd, so the extra checking for primary hcd can be removed.
Unified · Split
| @@ -1107,7 +1107,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 1106 unmodified lines | |||
| 1107 | { | 1107 | { |
| 1108 | u32 command, temp = 0; | 1108 | u32 command, temp = 0; |
| 1109 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 1109 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
| 1110 | struct usb_hcd *secondary_hcd; | ||
| 1111 | int retval = 0; | 1110 | int retval = 0; |
| 1112 | bool comp_timer_running = false; | 1111 | bool comp_timer_running = false; |
| 1113 | bool pending_portevent = false; | 1112 | bool pending_portevent = false; |
| @@ -1214,23 +1213,19 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 100 unmodified lines | |||
| 1214 | * first with the primary HCD, and then with the secondary HCD. | 1213 | * first with the primary HCD, and then with the secondary HCD. |
| 1215 | * If we don't do the same, the host will never be started. | 1214 | * If we don't do the same, the host will never be started. |
| 1216 | */ | 1215 | */ |
| 1217 | if (!usb_hcd_is_primary_hcd(hcd)) | ||
| 1218 | secondary_hcd = hcd; | ||
| 1219 | else | ||
| 1220 | secondary_hcd = xhci->shared_hcd; | ||
| 1221 | |||
| 1222 | xhci_dbg(xhci, "Initialize the xhci_hcd\n"); | 1216 | xhci_dbg(xhci, "Initialize the xhci_hcd\n"); |
| 1223 | retval = xhci_init(hcd->primary_hcd); | 1217 | retval = xhci_init(hcd); |
| 1224 | if (retval) | 1218 | if (retval) |
| 1225 | return retval; | 1219 | return retval; |
| 1226 | comp_timer_running = true; | 1220 | comp_timer_running = true; |
| 1227 | 1221 | ||
| 1228 | xhci_dbg(xhci, "Start the primary HCD\n"); | 1222 | xhci_dbg(xhci, "Start the primary HCD\n"); |
| 1229 | retval = xhci_run(hcd->primary_hcd); | 1223 | retval = xhci_run(hcd); |
| 1230 | if (!retval && secondary_hcd) { | 1224 | if (!retval && xhci->shared_hcd) { |
| 1231 | xhci_dbg(xhci, "Start the secondary HCD\n"); | 1225 | xhci_dbg(xhci, "Start the secondary HCD\n"); |
| 1232 | retval = xhci_run(secondary_hcd); | 1226 | retval = xhci_run(xhci->shared_hcd); |
| 1233 | } | 1227 | } |
| 1228 | |||
| 1234 | hcd->state = HC_STATE_SUSPENDED; | 1229 | hcd->state = HC_STATE_SUSPENDED; |
| 1235 | if (xhci->shared_hcd) | 1230 | if (xhci->shared_hcd) |
| 1236 | xhci->shared_hcd->state = HC_STATE_SUSPENDED; | 1231 | xhci->shared_hcd->state = HC_STATE_SUSPENDED; |