[PATCH 1/3] usb: gadget: atmel: Code refactor

Marek Vasut marex at denx.de
Mon Jul 22 13:41:22 CEST 2024


On 7/22/24 10:47 AM, Zixun LI wrote:
> - Sort includes
> - Forward declare controller structure
> - Rename _start() /  _stop() to _enable() / _disable() inline with other
>    drivers, avoid confusion with DM start() stop() functions.
> - Replace printf() by log_err()
> - Spelling paramter -> parameter
> 
> Signed-off-by: Zixun LI <zli at ogga.fr>
> ---
>   drivers/usb/gadget/atmel_usba_udc.c | 77 +++++++++++++++--------------
>   1 file changed, 39 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index f99553df8d..327e90a786 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -7,19 +7,22 @@
>    *			   Bo Shen <voice.shen at atmel.com>
>    */
>   
> -#include <linux/bitops.h>
> -#include <linux/errno.h>
> +#include <clk.h>
> +#include <log.h>
> +#include <malloc.h>
>   #include <asm/gpio.h>
>   #include <asm/hardware.h>
> +#include <linux/bitops.h>
> +#include <linux/errno.h>
>   #include <linux/list.h>
> -#include <linux/printk.h>
>   #include <linux/usb/ch9.h>
>   #include <linux/usb/gadget.h>
>   #include <linux/usb/atmel_usba_udc.h>
> -#include <malloc.h>
>   
>   #include "atmel_usba_udc.h"
>   
> +static struct usba_udc *controller;
> +
>   static int vbus_is_present(struct usba_udc *udc)
>   {
>   	/* No Vbus detection: Assume always present */
> @@ -506,12 +509,6 @@ usba_udc_set_selfpowered(struct usb_gadget *gadget, int is_selfpowered)
>   	return 0;
>   }
>   
> -static const struct usb_gadget_ops usba_udc_ops = {
> -	.get_frame		= usba_udc_get_frame,
> -	.wakeup			= usba_udc_wakeup,
> -	.set_selfpowered	= usba_udc_set_selfpowered,
> -};
> -
>   static struct usb_endpoint_descriptor usba_ep0_desc = {
>   	.bLength = USB_DT_ENDPOINT_SIZE,
>   	.bDescriptorType = USB_DT_ENDPOINT,
> @@ -1153,7 +1150,7 @@ static int usba_udc_irq(struct usba_udc *udc)
>   	return 0;
>   }
>   
> -static int atmel_usba_start(struct usba_udc *udc)
> +static int usba_enable(struct usba_udc *udc)

Is there any specific reason for the removal of this atmel_ prefix from 
the functions ?


More information about the U-Boot mailing list