Linux USB
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Jiazi.Li" <jqqlijiazi@gmail.com>
Cc: "Jiazi.Li" <jiazi.li@transsion.com>, linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: f_fs: increase eps_revmap length
Date: Tue, 12 Sep 2023 12:50:24 +0200	[thread overview]
Message-ID: <2023091248-shady-wavy-847d@gregkh> (raw)
In-Reply-To: <20230912103417.18839-1-jiazi.li@transsion.com>

On Tue, Sep 12, 2023 at 06:34:17PM +0800, Jiazi.Li wrote:
> Commit 41dc9ac163e7 ("usb: gadget: f_fs: Accept up to 30 endpoints.")
> increase eps_addrmap length to 31, eps_revmap also need to increase.
> Increase it's length to 32.

Why 32?

> 
> For same-address, opposite-direction endpoints, will use same idx in
> eps_revmap, so add new marco REVMAP_IDX to calculate idx for endpoints.
> 
> Signed-off-by: Jiazi.Li <jiazi.li@transsion.com>

Please use your real name here, not your email alias.  Same for the
 From: line in your email


> ---
>  drivers/usb/gadget/function/f_fs.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
> index 6e9ef35a43a7..4a210368bd33 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -71,12 +71,14 @@ struct ffs_function {
>  	struct ffs_data			*ffs;
>  
>  	struct ffs_ep			*eps;
> -	u8				eps_revmap[16];
> +	u8				eps_revmap[32];
>  	short				*interfaces_nums;
>  
>  	struct usb_function		function;
>  };
>  
> +#define REVMAP_IDX(epaddr)	((epaddr & USB_ENDPOINT_NUMBER_MASK) \
> +				* 2 + ((epaddr & USB_DIR_IN) ? 1 : 0))

What is the * 2 for?  Also, this macro is hard to read, can you make
this an inline function instead, explaining what you are trying to
calculate?

thanks,

greg k-h

      reply	other threads:[~2023-09-12 10:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 10:34 [PATCH] usb: gadget: f_fs: increase eps_revmap length Jiazi.Li
2023-09-12 10:50 ` Greg Kroah-Hartman [this message]

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=2023091248-shady-wavy-847d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=jiazi.li@transsion.com \
    --cc=jqqlijiazi@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    /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