diff mbox series

[1/1] usb: dwc2: gadget: don't try to disable ep0 in dwc2_hsotg_suspend

Message ID 20211207130101.270314-1-amelie.delaunay@foss.st.com
State New
Headers show
Series [1/1] usb: dwc2: gadget: don't try to disable ep0 in dwc2_hsotg_suspend | expand

Commit Message

Amelie DELAUNAY Dec. 7, 2021, 1:01 p.m. UTC
Calling dwc2_hsotg_ep_disable on ep0 (in/out) will lead to the following
logs before returning -EINVAL:
dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0

To avoid these two logs while suspending, start disabling the endpoint
from the index 1, as done in dwc2_hsotg_udc_stop:

	/* all endpoints should be shutdown */
	for (ep = 1; ep < hsotg->num_of_eps; ep++) {
		if (hsotg->eps_in[ep])
			dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
		if (hsotg->eps_out[ep])
			dwc2_hsotg_ep_disable_lock(&hsotg->eps_out[ep]->ep);
	}

Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
 drivers/usb/dwc2/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Minas Harutyunyan Dec. 16, 2021, 10:20 a.m. UTC | #1
On 12/7/2021 5:01 PM, Amelie Delaunay wrote:
> Calling dwc2_hsotg_ep_disable on ep0 (in/out) will lead to the following
> logs before returning -EINVAL:
> dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
> dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
> 
> To avoid these two logs while suspending, start disabling the endpoint
> from the index 1, as done in dwc2_hsotg_udc_stop:
> 
> 	/* all endpoints should be shutdown */
> 	for (ep = 1; ep < hsotg->num_of_eps; ep++) {
> 		if (hsotg->eps_in[ep])
> 			dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
> 		if (hsotg->eps_out[ep])
> 			dwc2_hsotg_ep_disable_lock(&hsotg->eps_out[ep]->ep);
> 	}
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>

Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>

> ---
>   drivers/usb/dwc2/gadget.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index b884a83b26a6..ee31f9a328da 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -5086,7 +5086,7 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg)
>   		hsotg->gadget.speed = USB_SPEED_UNKNOWN;
>   		spin_unlock_irqrestore(&hsotg->lock, flags);
>   
> -		for (ep = 0; ep < hsotg->num_of_eps; ep++) {
> +		for (ep = 1; ep < hsotg->num_of_eps; ep++) {
>   			if (hsotg->eps_in[ep])
>   				dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
>   			if (hsotg->eps_out[ep])
Amelie DELAUNAY Jan. 18, 2022, 10:40 a.m. UTC | #2
Hi Greg,

Kind reminder about this patch.

Thanks,
Amelie

On 12/16/21 11:20 AM, Minas Harutyunyan wrote:
> On 12/7/2021 5:01 PM, Amelie Delaunay wrote:
>> Calling dwc2_hsotg_ep_disable on ep0 (in/out) will lead to the following
>> logs before returning -EINVAL:
>> dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
>> dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
>>
>> To avoid these two logs while suspending, start disabling the endpoint
>> from the index 1, as done in dwc2_hsotg_udc_stop:
>>
>> 	/* all endpoints should be shutdown */
>> 	for (ep = 1; ep < hsotg->num_of_eps; ep++) {
>> 		if (hsotg->eps_in[ep])
>> 			dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
>> 		if (hsotg->eps_out[ep])
>> 			dwc2_hsotg_ep_disable_lock(&hsotg->eps_out[ep]->ep);
>> 	}
>>
>> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
> 
> Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
> 
>> ---
>>    drivers/usb/dwc2/gadget.c | 2 +-
>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>> index b884a83b26a6..ee31f9a328da 100644
>> --- a/drivers/usb/dwc2/gadget.c
>> +++ b/drivers/usb/dwc2/gadget.c
>> @@ -5086,7 +5086,7 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg)
>>    		hsotg->gadget.speed = USB_SPEED_UNKNOWN;
>>    		spin_unlock_irqrestore(&hsotg->lock, flags);
>>    
>> -		for (ep = 0; ep < hsotg->num_of_eps; ep++) {
>> +		for (ep = 1; ep < hsotg->num_of_eps; ep++) {
>>    			if (hsotg->eps_in[ep])
>>    				dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
>>    			if (hsotg->eps_out[ep])
>
Greg Kroah-Hartman Jan. 18, 2022, 11:01 a.m. UTC | #3
On Tue, Jan 18, 2022 at 11:40:46AM +0100, Amelie DELAUNAY wrote:
> Hi Greg,
> 
> Kind reminder about this patch.

It is the middle of the merge window, I can not add any patches to my
tree until 5.17-rc1 is out.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index b884a83b26a6..ee31f9a328da 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -5086,7 +5086,7 @@  int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg)
 		hsotg->gadget.speed = USB_SPEED_UNKNOWN;
 		spin_unlock_irqrestore(&hsotg->lock, flags);
 
-		for (ep = 0; ep < hsotg->num_of_eps; ep++) {
+		for (ep = 1; ep < hsotg->num_of_eps; ep++) {
 			if (hsotg->eps_in[ep])
 				dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
 			if (hsotg->eps_out[ep])