Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1288708

Re: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled

From Felipe Balbi <balbi@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled
Date 2015-12-10 18:30 +0100
Message-ID <qEdcv-Km-37@gated-at.bofh.it> (permalink)
References <qBT8d-89d-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,

changbin.du@intel.com writes:
> From: "Du, Changbin" <changbin.du@intel.com>
>
> When usb_ep_enable on a enabled ep, the configuration of the ep probably
> has changed. In this scenario, the ep configuration in hw should be
> reprogrammed by udc driver. Hence, it is better to return an error to
> inform the caller.
>
> Signed-off-by: Du, Changbin <changbin.du@intel.com>
> ---
>  include/linux/usb/gadget.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
> index d813bd2..89f9fdd 100644
> --- a/include/linux/usb/gadget.h
> +++ b/include/linux/usb/gadget.h
> @@ -268,7 +268,7 @@ static inline int usb_ep_enable(struct usb_ep *ep)
>  	int ret;
>  
>  	if (ep->enabled)
> -		return 0;
> +		return -EBUSY;

While at that, can you add a WARN_ON() as well ?

	if (WARN_ON(ep->enabled))
        	return -EBUSY;

-- 
balbi

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled changbin.du@intel.com - 2015-12-04 08:40 +0100
  Re: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled Felipe Balbi <balbi@ti.com> - 2015-12-10 18:30 +0100

csiph-web