Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: xhci: split core allocation and initialization

Separate allocation and initialization in the xHCI core:
* xhci_mem_init() now only handles memory allocation.
* xhci_init() now only handles initialization.

This split allows xhci_init() to be reused when resuming from S4
suspend-to-disk.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20260402131342.2628648-11-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Niklas Neronin and committed by
Greg Kroah-Hartman
b4dd01eb 45484754

+13 -20
+3
drivers/usb/host/xhci-mem.c
··· 2421 2421 struct device *dev = xhci_to_hcd(xhci)->self.sysdev; 2422 2422 dma_addr_t dma; 2423 2423 2424 + xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Starting %s", __func__); 2425 + 2424 2426 /* 2425 2427 * xHCI section 5.4.6 - Device Context array must be 2426 2428 * "physically contiguous and 64-byte (cache line) aligned". ··· 2512 2510 if (xhci_setup_port_arrays(xhci, flags)) 2513 2511 goto fail; 2514 2512 2513 + xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Finished %s", __func__); 2515 2514 return 0; 2516 2515 2517 2516 fail:
+10 -20
drivers/usb/host/xhci.c
··· 536 536 writel(dev_notf, &xhci->op_regs->dev_notification); 537 537 } 538 538 539 - /* 540 - * Initialize memory for HCD and xHC (one-time init). 541 - * 542 - * Program the PAGESIZE register, initialize the device context array, create 543 - * device contexts (?), set up a command ring segment (or two?), create event 544 - * ring (one for now). 545 - */ 546 - static int xhci_init(struct usb_hcd *hcd) 539 + /* Setup basic xHCI registers */ 540 + static void xhci_init(struct usb_hcd *hcd) 547 541 { 548 542 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 549 - int retval; 550 543 551 544 xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Starting %s", __func__); 552 - 553 - retval = xhci_mem_init(xhci, GFP_KERNEL); 554 - if (retval) 555 - return retval; 556 545 557 546 /* Set the Number of Device Slots Enabled to the maximum supported value */ 558 547 xhci_enable_max_dev_slots(xhci); ··· 578 589 } 579 590 580 591 xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Finished %s", __func__); 581 - return 0; 582 592 } 583 593 584 594 /*-------------------------------------------------------------------------*/ ··· 1178 1190 * first with the primary HCD, and then with the secondary HCD. 1179 1191 * If we don't do the same, the host will never be started. 1180 1192 */ 1181 - xhci_dbg(xhci, "Initialize the xhci_hcd\n"); 1182 - retval = xhci_init(hcd); 1193 + retval = xhci_mem_init(xhci, GFP_KERNEL); 1183 1194 if (retval) 1184 1195 return retval; 1196 + 1197 + xhci_init(hcd); 1185 1198 1186 1199 xhci_dbg(xhci, "Start the primary HCD\n"); 1187 1200 retval = xhci_run(hcd); ··· 5522 5533 5523 5534 memset(xhci->devs, 0, MAX_HC_SLOTS * sizeof(*xhci->devs)); 5524 5535 5525 - xhci_dbg(xhci, "Calling HCD init\n"); 5526 - /* Initialize HCD and host controller data structures. */ 5527 - retval = xhci_init(hcd); 5536 + /* Allocate xHCI data structures */ 5537 + retval = xhci_mem_init(xhci, GFP_KERNEL); 5528 5538 if (retval) 5529 5539 return retval; 5530 - xhci_dbg(xhci, "Called HCD init\n"); 5540 + 5541 + /* Initialize HCD and host controller data structures */ 5542 + xhci_init(hcd); 5531 5543 5532 5544 if (xhci_hcd_is_usb3(hcd)) 5533 5545 xhci_hcd_init_usb3_data(xhci, hcd);