Message ID | 20240723131817.262596-5-zli@ogga.fr |
---|---|
State | Changes Requested |
Delegated to: | Mattijs Korpershoek |
Headers | show |
Series | usb: gadget: atmel: Code refactor and DM_USB_GADGET support | expand |
On 7/23/24 3:18 PM, Zixun LI wrote: > To make all static functions in the top, no functional change. Reviewed-by: Marek Vasut <marex@denx.de> Thanks !
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
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;
To make all static functions in the top, no functional change. Signed-off-by: Zixun LI <zli@ogga.fr> --- drivers/usb/gadget/atmel_usba_udc.c | 80 ++++++++++++++--------------- 1 file changed, 40 insertions(+), 40 deletions(-)