]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: xhci: use cached HCSPARAMS1 value
authorNiklas Neronin <niklas.neronin@linux.intel.com>
Wed, 19 Nov 2025 14:24:08 +0000 (16:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2025 13:53:00 +0000 (14:53 +0100)
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>
drivers/usb/host/xhci.c

index 7ac8198d0d7b83e2db02ee57b85b07c707de50bc..dbe64ea479361522b152834e5bed53c982dee637 100644 (file)
@@ -4235,8 +4235,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
                xhci_err(xhci, "Error while assigning device slot ID: %s\n",
                         xhci_trb_comp_code_string(command->status));
                xhci_err(xhci, "Max number of devices this xHCI host supports is %u.\n",
-                               HCS_MAX_SLOTS(
-                                       readl(&xhci->cap_regs->hcs_params1)));
+                        HCS_MAX_SLOTS(xhci->hcs_params1));
                xhci_free_command(xhci, command);
                return 0;
        }