All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guiting Shen <aarongt.shen@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: gregkh@linuxfoundation.org, nicolas.ferre@microchip.com,
	alexandre.belloni@bootlin.com, claudiu.beznea@microchip.com,
	linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: ohci-at91: Fix the unhandle interrupt when resume
Date: Fri, 23 Jun 2023 11:44:04 +0800	[thread overview]
Message-ID: <c2d0b37a-3ee1-e07e-e265-c71895474ba8@gmail.com> (raw)
In-Reply-To: <4cf867a9-3c78-403a-aaeb-91f6cf099a3d@rowland.harvard.edu>



On Thu,Jun 22,2023 at 22:29:43PM GMT+8, Alan Stern wrote:
> On Thu, Jun 22, 2023 at 10:57:39AM +0800, Guiting Shen wrote:
>> The ohci_hcd_at91_drv_suspend() sets ohci->rh_state to OHCI_RH_HALTED when
>> suspend which will let the ohci_irq() skip the interrupt after resume. And
>> nobody to handle this interrupt.
>>
>> Set the ohci->rh_state to OHCI_RH_SUSPEND instead of OHCI_RH_HALTED when
>> suspend to fix it.
>>
>> Signed-off-by: Guiting Shen <aarongt.shen@gmail.com>
>> ---
>>   drivers/usb/host/ohci-at91.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
>> index b9ce8d80f20b..7a970e573668 100644
>> --- a/drivers/usb/host/ohci-at91.c
>> +++ b/drivers/usb/host/ohci-at91.c
>> @@ -645,7 +645,7 @@ ohci_hcd_at91_drv_suspend(struct device *dev)
>>   	 * REVISIT: some boards will be able to turn VBUS off...
>>   	 */
>>   	if (!ohci_at91->wakeup) {
>> -		ohci->rh_state = OHCI_RH_HALTED;
>> +		ohci->rh_state = OHCI_RH_SUSPENDED;
> 
> It looks like this change ignores the comment immediately above it
> (just before the start of this hunk).
> 
> If you want to find a way to handle IRQs better after the controller
> resumes, maybe you should change the resume routine instead of the
> suspend routine.
>
> Alan Stern

The comment which was added with commit-id 0365ee0a8f745 may be outdated
because ohci_suspend() and ohci_at91_port_suspend() is used to suspend 
instead of setting ohci->rh_state to OHCI_RH_HALTED.

What's more, I found that only ohci-at91 driver to set the 
ohci->rh_state which may be unnessory because the ohci_suspend() disable 
irq emission and mark HW unaccessible and ohci_at91_port_suspend() 
suspend the controller.

Is it really need to set ohci->rh_state in ohci_hcd_at91_drv_suspend()?

It maybe confused to set ohci->rh_state to OHCI_RH_SUSPEND in resume 
routine.

-- 
Best regards,
Guiting Shen

WARNING: multiple messages have this Message-ID (diff)
From: Guiting Shen <aarongt.shen@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: alexandre.belloni@bootlin.com, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	claudiu.beznea@microchip.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] usb: ohci-at91: Fix the unhandle interrupt when resume
Date: Fri, 23 Jun 2023 11:44:04 +0800	[thread overview]
Message-ID: <c2d0b37a-3ee1-e07e-e265-c71895474ba8@gmail.com> (raw)
In-Reply-To: <4cf867a9-3c78-403a-aaeb-91f6cf099a3d@rowland.harvard.edu>



On Thu,Jun 22,2023 at 22:29:43PM GMT+8, Alan Stern wrote:
> On Thu, Jun 22, 2023 at 10:57:39AM +0800, Guiting Shen wrote:
>> The ohci_hcd_at91_drv_suspend() sets ohci->rh_state to OHCI_RH_HALTED when
>> suspend which will let the ohci_irq() skip the interrupt after resume. And
>> nobody to handle this interrupt.
>>
>> Set the ohci->rh_state to OHCI_RH_SUSPEND instead of OHCI_RH_HALTED when
>> suspend to fix it.
>>
>> Signed-off-by: Guiting Shen <aarongt.shen@gmail.com>
>> ---
>>   drivers/usb/host/ohci-at91.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
>> index b9ce8d80f20b..7a970e573668 100644
>> --- a/drivers/usb/host/ohci-at91.c
>> +++ b/drivers/usb/host/ohci-at91.c
>> @@ -645,7 +645,7 @@ ohci_hcd_at91_drv_suspend(struct device *dev)
>>   	 * REVISIT: some boards will be able to turn VBUS off...
>>   	 */
>>   	if (!ohci_at91->wakeup) {
>> -		ohci->rh_state = OHCI_RH_HALTED;
>> +		ohci->rh_state = OHCI_RH_SUSPENDED;
> 
> It looks like this change ignores the comment immediately above it
> (just before the start of this hunk).
> 
> If you want to find a way to handle IRQs better after the controller
> resumes, maybe you should change the resume routine instead of the
> suspend routine.
>
> Alan Stern

The comment which was added with commit-id 0365ee0a8f745 may be outdated
because ohci_suspend() and ohci_at91_port_suspend() is used to suspend 
instead of setting ohci->rh_state to OHCI_RH_HALTED.

What's more, I found that only ohci-at91 driver to set the 
ohci->rh_state which may be unnessory because the ohci_suspend() disable 
irq emission and mark HW unaccessible and ohci_at91_port_suspend() 
suspend the controller.

Is it really need to set ohci->rh_state in ohci_hcd_at91_drv_suspend()?

It maybe confused to set ohci->rh_state to OHCI_RH_SUSPEND in resume 
routine.

-- 
Best regards,
Guiting Shen

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-06-23  3:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22  2:57 [PATCH] usb: ohci-at91: Fix the unhandle interrupt when resume Guiting Shen
2023-06-22  2:57 ` Guiting Shen
2023-06-22 14:29 ` Alan Stern
2023-06-22 14:29   ` Alan Stern
2023-06-23  3:44   ` Guiting Shen [this message]
2023-06-23  3:44     ` Guiting Shen
2023-06-23 15:52     ` Alan Stern
2023-06-23 15:52       ` Alan Stern
2023-06-25  4:01       ` Guiting Shen
2023-06-25  4:01         ` Guiting Shen
2023-06-25 13:57         ` Alan Stern
2023-06-25 13:57           ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2d0b37a-3ee1-e07e-e265-c71895474ba8@gmail.com \
    --to=aarongt.shen@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.