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

usb: xhci: use cached HCSPARAMS1 value

The Structural Parameters 1 (HCSPARAMS1) register is read and cached in
'xhci->hcs_params1' during host controller initialization. Since this
register is read-only and its value remains constant for the lifetime of
the controller, re-reading it later is unnecessary.

Replace subsequent register reads with the cached 'xhci->hcs_params1'
value to avoid redundant MMIO access.

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/20251119142417.2820519-15-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Niklas Neronin and committed by
Greg Kroah-Hartman
70651cc3 2085fa6c

+1 -2
+1 -2
drivers/usb/host/xhci.c
··· 4235 4235 xhci_err(xhci, "Error while assigning device slot ID: %s\n", 4236 4236 xhci_trb_comp_code_string(command->status)); 4237 4237 xhci_err(xhci, "Max number of devices this xHCI host supports is %u.\n", 4238 - HCS_MAX_SLOTS( 4239 - readl(&xhci->cap_regs->hcs_params1))); 4238 + HCS_MAX_SLOTS(xhci->hcs_params1)); 4240 4239 xhci_free_command(xhci, command); 4241 4240 return 0; 4242 4241 }