Re: [PATCH v3] platform/x86/hp: Avoid spurious wakeup on HP ProOne 440

From: Alan Stern
Date: Thu Sep 12 2024 - 11:06:19 EST


On Thu, Sep 12, 2024 at 02:28:15PM +0800, Kai-Heng Feng wrote:
> On Tue, Sep 10, 2024 at 9:13 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> > It should be possible for this to work. Just make the interrupt
> > handler skip calling usb_hcd_resume_root_hub() if wakeup is not enabled
> > for the root hub getting the port-status change. When the root hub
> > resumes as part of the system resume later on, the hub driver will check
> > and see that a connect change occurred.
>
> This can work. But should the change be made in
> usb_hcd_resume_root_hub() or by the caller?
> The issue can potentially happen to all USB controllers, not just xHCI.

True. However, we need to make sure that remote wakeup continues to
work properly. This means that the handler should skip calling
usb_hcd_resume_root_hub() (when the root hub is suspended with wakeup =
0) for port connect/disconnect changes or for port overcurrent changes.
But it should _not_ skip calling usb_hcd_resume_root_hub() for port
resume events (i.e., wakeup requests received from downstream).

usb_hcd_resume_root_hub() does not have enough information to know the
reason for the resume; only the interrupt handler does.

Have you been following the discussion in this other email thread?

https://lore.kernel.org/linux-usb/20240906030548.845115-1-duanchenghao@xxxxxxxxxx/

It seems very similar to the problem you are trying to fix.

Alan Stern