[U-Boot] [PATCH V2 2/2] USB-CDC: called handle_interrupts inside usb_eth_send

Sergei Shtylyov sshtylyov at mvista.com
Sat Aug 14 14:26:27 CEST 2010


Stefano Babic wrote:

> The patch removes an endless loop  in the usb_eth_send
> if the tx_complete is not called before going
> in the loop. The driver interrupt routine is called
> allowing the driver to check if the TX is completed.

> Signed-off-by: Stefano Babic <sbabic at denx.de>
> ---

[...]

> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
> index 0b4ed18..f082c03 100644
> --- a/drivers/usb/gadget/ether.c
> +++ b/drivers/usb/gadget/ether.c
> @@ -1808,6 +1808,8 @@ static int usb_eth_send(struct eth_device* netdev, volatile void* packet, int le
>  	struct usb_request	*req = NULL;
>  
>  	struct eth_dev *dev = &l_ethdev;
> +	unsigned long ts;
> +	unsigned long timeout = USB_CONNECT_TIMEOUT;

    Please keep an empty line after the declaration block.

> @@ -1833,13 +1835,19 @@ static int usb_eth_send(struct eth_device* netdev, volatile void* packet, int le
>  #endif
>  	dev->tx_qlen=1;
>  
> +	ts = get_timer(0);
> +	packet_sent=0;

    Please keep the style consistent and add spaces before/after =.

>  	retval = usb_ep_queue (dev->in_ep, req, GFP_ATOMIC);
>  
>  	if (!retval)
> -		dprintf("%s: packet queued\n",__func__);
> +		debug("%s: packet queued\n",__func__);
>  	while(!packet_sent)
>  	{
> -		packet_sent=0;
> +		if (get_timer(ts) > timeout) {
> +			printf ("timeout sending packets to usb ethernet\n");

    Please be consistent and remove space before paren. U-Boot nwo seems to 
follow the Linux coding style...

WBR, Sergei


More information about the U-Boot mailing list