Linux USB
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@gmail.com>
To: Linyu Yuan <quic_linyyuan@quicinc.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, Jack Pham <quic_jackp@quicinc.com>
Subject: Re: [PATCH 1/5] usb: host: xhci: use ffs() in xhci_mem_init()
Date: Wed, 16 Feb 2022 12:41:49 +0300	[thread overview]
Message-ID: <4688f5bb-c0fd-bbce-de1f-a554d543ed03@gmail.com> (raw)
In-Reply-To: <1644994755-12975-2-git-send-email-quic_linyyuan@quicinc.com>

Hello!

On 2/16/22 9:59 AM, Linyu Yuan wrote:

> The for loop to find page size bit can be replaced with ffs().
> 
> Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
> ---
>  drivers/usb/host/xhci-mem.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 0e31206..3cbc7f2 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -2395,12 +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;
> -	}
> -	if (i < 16)
> +	if ((i = ffs(page_size)) < 16)

   Always run your patches thru scripts/checkpatch.pl -- in this case it will complain
of an assignment in the *if* expression...

[...]

MNR, Sergey

  reply	other threads:[~2022-02-16  9:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16  6:59 [PATCH 0/5] usb: xhci: fix of some code/comment Linyu Yuan
2022-02-16  6:59 ` [PATCH 1/5] usb: host: xhci: use ffs() in xhci_mem_init() Linyu Yuan
2022-02-16  9:41   ` Sergei Shtylyov [this message]
2022-02-16  9:47     ` Linyu Yuan (QUIC)
2022-02-16  9:53       ` Sergei Shtylyov
2022-02-16  9:57         ` Linyu Yuan (QUIC)
2022-02-16 10:11           ` Sergei Shtylyov
2022-02-16 10:34           ` Greg Kroah-Hartman
2022-02-16  6:59 ` [PATCH 2/5] usb: host: xhci: fix a comment typo " Linyu Yuan
2022-02-16  6:59 ` [PATCH 3/5] usb: host: xhci: update hci_version operation in xhci_gen_setup() Linyu Yuan
2022-02-16  6:59 ` [PATCH 4/5] usb: host: xhci: add blank line in xhci_halt() Linyu Yuan
2022-02-16  6:59 ` [PATCH 5/5] usb: host: xhci: remove init to some ret/retval Linyu Yuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4688f5bb-c0fd-bbce-de1f-a554d543ed03@gmail.com \
    --to=sergei.shtylyov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_linyyuan@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox