summaryrefslogtreecommitdiff
path: root/drivers/usb/host/xhci-mem.c
diff options
context:
space:
mode:
authorLinyu Yuan <quic_linyyuan@quicinc.com>2022-03-03 14:08:59 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-03-03 17:46:07 +0300
commit81720ec5320c3a02a4b2faf597127de5478cbf02 (patch)
tree3da785d521bc9c930b5d451ee34de2c467cf65b0 /drivers/usb/host/xhci-mem.c
parent70c05e4cf63054cd755ca66c1819327b22cb085f (diff)
downloadlinux-81720ec5320c3a02a4b2faf597127de5478cbf02.tar.xz
usb: host: xhci: use ffs() in xhci_mem_init()
The for loop to find page size bit can be replaced with ffs(). Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20220303110903.1662404-6-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r--drivers/usb/host/xhci-mem.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 48114a462908..938eb2b907ab 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2391,11 +2391,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
page_size = readl(&xhci->op_regs->page_size);
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Supported page size register = 0x%x", page_size);
- for (i = 0; i < 16; i++) {
- if ((0x1 & page_size) != 0)
- break;
- page_size = page_size >> 1;
- }
+ i = ffs(page_size);
if (i < 16)
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Supported page size of %iK", (1 << (i+12)) / 1024);