Message ID | 1645060971-27141-2-git-send-email-quic_linyyuan@quicinc.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 81720ec5320c3a02a4b2faf597127de5478cbf02 |
Headers | show |
Series | usb: xhci: fix of some code/comment | expand |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 0e31206..ad681e2 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2395,11 +2395,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);
The for loop to find page size bit can be replaced with ffs(). Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> --- v2: move assignment out of if condition drivers/usb/host/xhci-mem.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)