diff mbox series

[v2,1/2] usb: gadget: udc: core: Revise comments for usb_ep_disable()

Message ID 1635303025-772-2-git-send-email-quic_wcheng@quicinc.com (mailing list archive)
State Superseded
Headers show
Series Disable mass storage endpoints during disconnect | expand

Commit Message

Wesley Cheng Oct. 27, 2021, 2:50 a.m. UTC
The usb_ep_disable() routine is being widely used directly in the
disconnect callback path by function drivers.  Hence, the statement
about it being able to only run in process context may not be true.

Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
 drivers/usb/gadget/udc/core.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Alan Stern Oct. 27, 2021, 2:24 p.m. UTC | #1
On Tue, Oct 26, 2021 at 07:50:24PM -0700, Wesley Cheng wrote:
> The usb_ep_disable() routine is being widely used directly in the
> disconnect callback path by function drivers.  Hence, the statement
> about it being able to only run in process context may not be true.
> 
> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
> ---
>  drivers/usb/gadget/udc/core.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index d626511..e1f90d8 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -136,8 +136,6 @@ EXPORT_SYMBOL_GPL(usb_ep_enable);
>   * gadget drivers must call usb_ep_enable() again before queueing
>   * requests to the endpoint.
>   *
> - * This routine must be called in process context.
> - *
>   * returns zero, or a negative error code.
>   */
>  int usb_ep_disable(struct usb_ep *ep)

You should also change the kerneldoc for usb_ep_enable.  Neither routine 
needs to be called in process context.

In fact, it might be good to change both comments to:

 * This routine may be called in an atomic (interrupt) context.

just to be totally explicit.

Alan Stern
Wesley Cheng Oct. 27, 2021, 7:58 p.m. UTC | #2
Hi Alan,

On 10/27/2021 7:24 AM, Alan Stern wrote:
> On Tue, Oct 26, 2021 at 07:50:24PM -0700, Wesley Cheng wrote:
>> The usb_ep_disable() routine is being widely used directly in the
>> disconnect callback path by function drivers.  Hence, the statement
>> about it being able to only run in process context may not be true.
>>
>> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
>> ---
>>  drivers/usb/gadget/udc/core.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
>> index d626511..e1f90d8 100644
>> --- a/drivers/usb/gadget/udc/core.c
>> +++ b/drivers/usb/gadget/udc/core.c
>> @@ -136,8 +136,6 @@ EXPORT_SYMBOL_GPL(usb_ep_enable);
>>   * gadget drivers must call usb_ep_enable() again before queueing
>>   * requests to the endpoint.
>>   *
>> - * This routine must be called in process context.
>> - *
>>   * returns zero, or a negative error code.
>>   */
>>  int usb_ep_disable(struct usb_ep *ep)
> 
> You should also change the kerneldoc for usb_ep_enable.  Neither routine 
> needs to be called in process context.
> 
> In fact, it might be good to change both comments to:
> 
>  * This routine may be called in an atomic (interrupt) context.
> 
> just to be totally explicit.
> 
Ah, missed the ep enable case as well, thanks for the catch.  Sounds
good, I'll add that statement.

Thanks
Wesley Cheng
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index d626511..e1f90d8 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -136,8 +136,6 @@  EXPORT_SYMBOL_GPL(usb_ep_enable);
  * gadget drivers must call usb_ep_enable() again before queueing
  * requests to the endpoint.
  *
- * This routine must be called in process context.
- *
  * returns zero, or a negative error code.
  */
 int usb_ep_disable(struct usb_ep *ep)