On Thu, Jan 16, 2025 at 01:50:17PM +0000, Guan-Yu Lin wrote: > Sharing a USB controller with another entity via xhci-sideband driver > creates power management complexities. To prevent the USB controller > from being inadvertently deactivated while in use by the other entity, a > usage-count based mechanism is implemented. This allows the system to > manage power effectively, ensuring the controller remains available > whenever needed. > In order to maintain full functionality of an offloaded USB devices, > several changes are made within the suspend flow of such devices: > - skip usb_suspend_device() so that the port/hub are still active for > USB transfers via offloaded path. > - not suspending the endpoints which are used by USB interfaces marked > with needs_remote_wakeup. Namely, skip usb_suspend_interface() and > usb_hcd_flush_endpoint() on associated USB interfaces. This reserves a > pending interrupt urb during system suspend for handling the interrupt > transfer, which is necessary since remote wakeup doesn't apply in the > offloaded USB devices when controller is still active. > - not flushing the endpoints of actively offloaded USB devices. Given > that the USB devices is used by another entity, unilaterally flush the > endpoint might lead to unexpected behavior on another entity. > > Signed-off-by: Guan-Yu Lin <guanyulin@xxxxxxxxxx> > --- > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > index 1bbf9592724f..6441742869ff 100644 > --- a/drivers/usb/core/driver.c > +++ b/drivers/usb/core/driver.c > @@ -1413,19 +1413,31 @@ static int usb_resume_interface(struct usb_device *udev, > */ > static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) > { > - int status = 0; > - int i = 0, n = 0; > - struct usb_interface *intf; > + int status = 0; > + int i = 0, n = 0; > + bool offload = false; > + struct usb_interface *intf; Unnecessary whitespace change. Please remove this from the patch. Alan Stern