RE: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled
> > 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 > > --- > > 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 I will update the patch, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled
> > 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> > --- > > 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 I will update the patch, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled
Hi, changbin...@intel.com writes: > From: "Du, Changbin" > > 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 > --- > 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 signature.asc Description: PGP signature
Re: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled
Hi, changbin...@intel.com writes: > From: "Du, Changbin"> > 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 > --- > 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 signature.asc Description: PGP signature
[PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled
From: "Du, Changbin" 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 --- 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; ret = ep->ops->enable(ep, ep->desc); if (ret) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled
From: "Du, Changbin"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 --- 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; ret = ep->ops->enable(ep, ep->desc); if (ret) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/