diff mbox series

xhci: fix runtime PM imbalance in USB2 resume

Message ID 20220225055311.92447-1-henryl@nvidia.com (mailing list archive)
State Superseded
Headers show
Series xhci: fix runtime PM imbalance in USB2 resume | expand

Commit Message

Henry Lin Feb. 25, 2022, 5:53 a.m. UTC
USB2 resume starts with usb_hcd_start_port_resume() in port status
change handling for RESUME link state. usb_hcd_end_port_resume() call is
needed to keep runtime PM balance.

Signed-off-by: Henry Lin <henryl@nvidia.com>
---
 drivers/usb/host/xhci-hub.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Greg KH Feb. 25, 2022, 6:23 a.m. UTC | #1
On Fri, Feb 25, 2022 at 01:53:11PM +0800, Henry Lin wrote:
> USB2 resume starts with usb_hcd_start_port_resume() in port status
> change handling for RESUME link state. usb_hcd_end_port_resume() call is
> needed to keep runtime PM balance.
> 
> Signed-off-by: Henry Lin <henryl@nvidia.com>
> ---
>  drivers/usb/host/xhci-hub.c | 2 ++
>  1 file changed, 2 insertions(+)

What commit does this fix?
Henry Lin Feb. 25, 2022, 6:40 a.m. UTC | #2
It fixes side effect from below change. 

commit a231ec41e6f6433daf4c693f169f6c5cfda8cb9d
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Fri Dec 7 16:19:35 2018 +0200

    xhci: refactor U0 link state handling in get_port_status

    Move U0 link state handing to USB3 and USB2 specific functions

    Note that
    bus_state->resuming_ports:
    bus_state->resume_done[]:
    are only used for USB2, and don't need to cleared for USB3 ports

    No functional changes

    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

--nvpublic
Greg KH Feb. 25, 2022, 6:49 a.m. UTC | #3
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Fri, Feb 25, 2022 at 06:40:53AM +0000, Henry Lin wrote:
> It fixes side effect from below change. 
> 
> commit a231ec41e6f6433daf4c693f169f6c5cfda8cb9d
> Author: Mathias Nyman <mathias.nyman@linux.intel.com>
> Date:   Fri Dec 7 16:19:35 2018 +0200
> 
>     xhci: refactor U0 link state handling in get_port_status
> 
>     Move U0 link state handing to USB3 and USB2 specific functions
> 
>     Note that
>     bus_state->resuming_ports:
>     bus_state->resume_done[]:
>     are only used for USB2, and don't need to cleared for USB3 ports
> 
>     No functional changes
> 
>     Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>     Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Great, please add a "Fixes:" tag to the patch when resubmitting it.

And the "no functional changes" seems not to have been true, right?
Does this need to go into the stable kernels?

thanks,

greg k-h
Henry Lin Feb. 25, 2022, 7:02 a.m. UTC | #4
> Great, please add a "Fixes:" tag to the patch when resubmitting it.
I will resubmit soon.

> And the "no functional changes" seems not to have been true, right?
Yes.
> Does this need to go into the stable kernels?
Yes, this need to go into stable kernels. 

Thanks,
Henry
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index df3522dab31b..4a8b07b8ee01 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1090,6 +1090,8 @@  static void xhci_get_usb2_port_status(struct xhci_port *port, u32 *status,
 		if (link_state == XDEV_U0) {
 			bus_state->resume_done[portnum] = 0;
 			clear_bit(portnum, &bus_state->resuming_ports);
+			usb_hcd_end_port_resume(&port->rhub->hcd->self,
+						portnum);
 			if (bus_state->suspended_ports & (1 << portnum)) {
 				bus_state->suspended_ports &= ~(1 << portnum);
 				bus_state->port_c_suspend |= 1 << portnum;