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: simplify CMRT initialization logic

The function compliance_mode_recovery_timer_init() is called from
xhci_init() because the Compliance Mode Recovery Timer (CMRT) must be set
up before xhci_run() when the xhci driver is re-initialized.

To handle this case, the boolean flag 'comp_timer_running' was introduced
to track whether xhci_run() had already been called, ensuring that
xhci_resume() would not invoke compliance_mode_recovery_timer_init()
a second time.

This can be simplified by moving the 'done' label in xhci_resume() to
after the compliance_mode_recovery_timer_init() call. With this change,
the timer initialization runs only when the xhci driver has not been
re-initialized, making the 'comp_timer_running' flag unnecessary and
allowing it to be removed.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
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-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Niklas Neronin and committed by
Greg Kroah-Hartman
5ef760cf 452af0f9

+3 -5
+3 -5
drivers/usb/host/xhci.c
··· 1084 1084 u32 command, temp = 0; 1085 1085 struct usb_hcd *hcd = xhci_to_hcd(xhci); 1086 1086 int retval = 0; 1087 - bool comp_timer_running = false; 1088 1087 bool pending_portevent = false; 1089 1088 bool suspended_usb3_devs = false; 1090 1089 ··· 1195 1196 retval = xhci_init(hcd); 1196 1197 if (retval) 1197 1198 return retval; 1198 - comp_timer_running = true; 1199 1199 1200 1200 xhci_dbg(xhci, "Start the primary HCD\n"); 1201 1201 retval = xhci_run(hcd); ··· 1263 1265 usb_hcd_resume_root_hub(hcd); 1264 1266 } 1265 1267 } 1266 - done: 1268 + 1267 1269 /* 1268 1270 * If system is subject to the Quirk, Compliance Mode Timer needs to 1269 1271 * be re-initialized Always after a system resume. Ports are subject 1270 1272 * to suffer the Compliance Mode issue again. It doesn't matter if 1271 1273 * ports have entered previously to U0 before system's suspension. 1272 1274 */ 1273 - if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !comp_timer_running) 1275 + if (xhci->quirks & XHCI_COMP_MODE_QUIRK) 1274 1276 compliance_mode_recovery_timer_init(xhci); 1275 - 1277 + done: 1276 1278 if (xhci->quirks & XHCI_ASMEDIA_MODIFY_FLOWCONTROL) 1277 1279 usb_asmedia_modifyflowcontrol(to_pci_dev(hcd->self.controller)); 1278 1280