U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Zixun LI <admin@hifiphile.com>, Lukasz Majewski <lukma@denx.de>,
	Marek Vasut <marex@denx.de>, Tom Rini <trini@konsulko.com>
Cc: Zixun LI <zli@ogga.fr>, u-boot@lists.denx.de
Subject: Re: [PATCH v3 4/7] usb: gadget: atmel: Move usba_udc_pdata() with other static functions
Date: Wed, 24 Jul 2024 12:15:35 +0200	[thread overview]
Message-ID: <87a5i75c54.fsf@baylibre.com> (raw)
In-Reply-To: <20240723131817.262596-5-zli@ogga.fr>

Hi Zixun,

Thank you for the patch.

On mar., juil. 23, 2024 at 15:18, Zixun LI <admin@hifiphile.com> wrote:

> To make all static functions in the top, no functional change.
>
> Signed-off-by: Zixun LI <zli@ogga.fr>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>  drivers/usb/gadget/atmel_usba_udc.c | 80 ++++++++++++++---------------
>  1 file changed, 40 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index 2e3d8f36a2..a3d24501ba 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -1179,6 +1179,46 @@ static int atmel_usba_stop(struct usba_udc *udc)
>  	return 0;
>  }
>  
> +static struct usba_ep *usba_udc_pdata(struct usba_platform_data *pdata,
> +				      struct usba_udc *udc)
> +{
> +	struct usba_ep *eps;
> +	int i;
> +
> +	eps = malloc(sizeof(struct usba_ep) * pdata->num_ep);
> +	if (!eps) {
> +		log_err("failed to alloc eps\n");
> +		return NULL;
> +	}
> +
> +	udc->gadget.ep0 = &eps[0].ep;
> +
> +	INIT_LIST_HEAD(&udc->gadget.ep_list);
> +	INIT_LIST_HEAD(&eps[0].ep.ep_list);
> +
> +	for (i = 0; i < pdata->num_ep; i++) {
> +		struct usba_ep *ep = &eps[i];
> +
> +		ep->ep_regs = udc->regs + USBA_EPT_BASE(i);
> +		ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
> +		ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
> +		ep->ep.ops = &usba_ep_ops;
> +		ep->ep.name = pdata->ep[i].name;
> +		ep->ep.maxpacket = pdata->ep[i].fifo_size;
> +		ep->fifo_size = ep->ep.maxpacket;
> +		ep->udc = udc;
> +		INIT_LIST_HEAD(&ep->queue);
> +		ep->nr_banks = pdata->ep[i].nr_banks;
> +		ep->index = pdata->ep[i].index;
> +		ep->can_dma = pdata->ep[i].can_dma;
> +		ep->can_isoc = pdata->ep[i].can_isoc;
> +		if (i)
> +			list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
> +	};
> +
> +	return eps;
> +}
> +
>  static struct usba_udc controller = {
>  	.regs = (unsigned *)ATMEL_BASE_UDPHS,
>  	.fifo = (unsigned *)ATMEL_BASE_UDPHS_FIFO,
> @@ -1244,46 +1284,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
>  	return 0;
>  }
>  
> -static struct usba_ep *usba_udc_pdata(struct usba_platform_data *pdata,
> -				      struct usba_udc *udc)
> -{
> -	struct usba_ep *eps;
> -	int i;
> -
> -	eps = malloc(sizeof(struct usba_ep) * pdata->num_ep);
> -	if (!eps) {
> -		log_err("failed to alloc eps\n");
> -		return NULL;
> -	}
> -
> -	udc->gadget.ep0 = &eps[0].ep;
> -
> -	INIT_LIST_HEAD(&udc->gadget.ep_list);
> -	INIT_LIST_HEAD(&eps[0].ep.ep_list);
> -
> -	for (i = 0; i < pdata->num_ep; i++) {
> -		struct usba_ep *ep = &eps[i];
> -
> -		ep->ep_regs = udc->regs + USBA_EPT_BASE(i);
> -		ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
> -		ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
> -		ep->ep.ops = &usba_ep_ops;
> -		ep->ep.name = pdata->ep[i].name;
> -		ep->ep.maxpacket = pdata->ep[i].fifo_size;
> -		ep->fifo_size = ep->ep.maxpacket;
> -		ep->udc = udc;
> -		INIT_LIST_HEAD(&ep->queue);
> -		ep->nr_banks = pdata->ep[i].nr_banks;
> -		ep->index = pdata->ep[i].index;
> -		ep->can_dma = pdata->ep[i].can_dma;
> -		ep->can_isoc = pdata->ep[i].can_isoc;
> -		if (i)
> -			list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
> -	};
> -
> -	return eps;
> -}
> -
>  int usba_udc_probe(struct usba_platform_data *pdata)
>  {
>  	struct usba_udc *udc;
> -- 
> 2.45.2

  parent reply	other threads:[~2024-07-24 10:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23 13:18 [PATCH v3 0/7] usb: gadget: atmel: Code refactor and DM_USB_GADGET support Zixun LI
2024-07-23 13:18 ` [PATCH v3 1/7] usb: gadget: atmel: Sort includes Zixun LI
2024-07-23 13:34   ` Marek Vasut
2024-07-24 10:06   ` Mattijs Korpershoek
2024-07-23 13:18 ` [PATCH v3 2/7] usb: gadget: atmel: Replace printf() and pr_err() by log_err() Zixun LI
2024-07-23 13:34   ` Marek Vasut
2024-07-24 10:12   ` Mattijs Korpershoek
2024-07-23 13:18 ` [PATCH v3 3/7] usb: gadget: atmel: Fix typo in usb_gadget_register_driver() Zixun LI
2024-07-23 13:35   ` Marek Vasut
2024-07-24 10:14   ` Mattijs Korpershoek
2024-07-23 13:18 ` [PATCH v3 4/7] usb: gadget: atmel: Move usba_udc_pdata() with other static functions Zixun LI
2024-07-23 13:35   ` Marek Vasut
2024-07-24 10:15   ` Mattijs Korpershoek [this message]
2024-07-23 13:18 ` [PATCH v3 5/7] usb: gadget: atmel: Rename atmel_usba_start()/_stop() to usba_udc_enable()/_disable() Zixun LI
2024-07-23 13:36   ` Marek Vasut
2024-07-24 10:16   ` Mattijs Korpershoek
2024-07-23 13:18 ` [PATCH v3 6/7] usb: gadget: atmel: Add attach/detach support Zixun LI
2024-07-23 13:36   ` Marek Vasut
2024-07-24 10:19     ` Mattijs Korpershoek
2024-07-24 10:18   ` Mattijs Korpershoek
2024-07-23 13:18 ` [PATCH v3 7/7] usb: gadget: atmel: Add DM_USB_GADGET support Zixun LI
2024-07-24 10:41   ` Mattijs Korpershoek
2024-07-24 13:20     ` admin LI

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=87a5i75c54.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=admin@hifiphile.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=zli@ogga.fr \
    /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