Re: [PATCH] usb: chipidea: replace udelay in loops with usleep_range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 08, 2014 at 06:15:38PM +0100, Heiner Kallweit wrote:
> Both delays are at the lower end of where the use of usleep_range
> is recommended. However as both udelay's occur in loops I think it
> makes sense to replace them with sleeping equivalents to avoid
> longer busy-waits.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
> ---
>  drivers/usb/chipidea/core.c | 2 +-
>  drivers/usb/chipidea/udc.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 5b9825a..b9c645b 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -396,7 +396,7 @@ static int hw_controller_reset(struct ci_hdrc *ci)
>  
>  	hw_write(ci, OP_USBCMD, USBCMD_RST, USBCMD_RST);
>  	while (hw_read(ci, OP_USBCMD, USBCMD_RST)) {
> -		udelay(10);
> +		usleep_range(10, 20);
>  		if (count++ > 1000)
>  			return -ETIMEDOUT;
>  	}
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 4fe18ce..70ef2f2 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -326,7 +326,7 @@ static int hw_usb_reset(struct ci_hdrc *ci)
>  
>  	/* wait until all bits cleared */
>  	while (hw_read(ci, OP_ENDPTPRIME, ~0))
> -		udelay(10);             /* not RTOS friendly */
> +		usleep_range(10, 20);
>  

This one is not acceptable since it is used at interrupt handler.

>  	/* reset all endpoints ? */
>  
> -- 
> 2.1.3
> 

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux