From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21CD122ACDF for ; Thu, 16 Jan 2025 15:06:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039994; cv=none; b=SR4PbYLLhn6Py76jqF0gjbYZkQ9WDd//F11XFSdVU7NVfHSRwzoJHRaP76QcxHAJRBwChi7rMcjAgpbB1IfUIOGBznYjl+5pAf8/bQe6v/0ulyrZSreQKPXMhIEEopu8F+nImBEMixJnJC75+D5ni/0Zl1xaJhSJIRaSNf8zopc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039994; c=relaxed/simple; bh=oG2F8xXGtIwtvCB2psTNr2rTBTy0NoXrjQaVcy/VBS8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JnYonBFOrzu5oTMGQhJYBunD8yOsdthcmVXVC+86qVUhdFa8s1MSchZ1CZs1qcc9GfpzRw/C0hKilQWw77nbOIP4dFEI30sxy1K+WDqnQSohAYanZVPuPcWkDjaDDpP9dNMv+FYvTlPM6WiEmH2uDfrr9UpGw1eZj4vy00NRY3E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu; spf=fail smtp.mailfrom=g.harvard.edu; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b=sH/VnWpT; arc=none smtp.client-ip=209.85.219.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=g.harvard.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b="sH/VnWpT" Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-6d900c27af7so11528436d6.2 for ; Thu, 16 Jan 2025 07:06:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rowland.harvard.edu; s=google; t=1737039991; x=1737644791; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Q0nAZJMInzyGZTtSyDilCukDk7rI34qxFCU+Z358ruI=; b=sH/VnWpTpgKen++BGBMCB8e4RlTVosfVzShLz3+364d4FUwbWI9VObglhIYuf8JjhU RWcPr1pZ3ti4QbamOS7PlE8LkwifcDV90u4fVrv9wBmtZ57pPL21n2u0RnTC0GhiMxzG ul1xUFxEJ/3S8Qnd4CqvzJ8O+BDwwAa2uW1fJxjssWDhn82lG5qbgRNzAvPrwqCW06RN XwXPjQGWnxGW9Hvv+OfRol9cdBIoyznSe0RaQDRchRFjokoi0c87DsHVq1UAovi1w3sk rI9sKjVTRMbItbmDOKfW9gnwrKVHUZwKmJG/GF1cWFEaIcNDlUe0F6iR1MuLXCcY3a69 Bs7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737039991; x=1737644791; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Q0nAZJMInzyGZTtSyDilCukDk7rI34qxFCU+Z358ruI=; b=KoOSj6ANWEfyCZkQL6MSBabVfLPw0QfIUBSC310QOVOTEQ9lXzkSF/tuuLLyI7dG/u V+T5qXGsVZNvDObbt97EBbJA2hyXTOvQiyXxLWkfZc21n7oA3JSXKx7L6P5G/HYt9raJ eA3lfZtz0KDxCP1hJu3j+ermurWna/+qkMEPy9dXPoNejO3Xhu90SGFdFuMzF6h7DbxC tiYNDsmpRpXZ4H6m3jV3oYdckYuUcfxRdxOC0CCVnSBtLejLm28rBS21HOPqPlJ7kPCS mwj2weIBowQm0c8DBDWkTPCx98BW/cGrh2G9c/ZThnaIwG+nhZNjNRqHNCZCZDk/4Hve 4kWg== X-Forwarded-Encrypted: i=1; AJvYcCU0U0LZzdVczyUMcg9wmBnoT5V3pMJCkdAzQzwXUZwJTDgvnbAHbiyeIi0bwhOt6lFZD4ce2xl8qk0+568=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8DJQgrShNP10v2zAc9qebw1RJhrgI6iyR8B27uekRT3afOpc2 VvSO5Xz74xvmcYYRx3zrlCwtHjBTA/0rpE3WIVv454E+WkIi9zE+C/dBtFAroQ== X-Gm-Gg: ASbGnct0v6eoAAuhQuoNttUdNnrmL0YxsrNPTWyuk9/43ekIit1b1JWhHj1g/wuaxYD /p3teLJmmHHLYJysIAttorpSI7Du7cLxMtgYF5SCWO+2gjeoXvvPLsnciFlTSfuAc1h77FkNt8J AUfidJPYtSyfd4hN/lE9bZ6qrj4Frr/TxEYPP6lOp7hOIPdaIRELq5yWRB8rK4UPsG+DjINejKh XOtfVKLwdBXaMiyZ1gmV6p2HiQWkBD/N8ltRdgJCwxG0xIn52po1hiJGw== X-Google-Smtp-Source: AGHT+IE8qovXuuvi3CKjkFHljYmIvNkybJE3IrpSuCl/AVPhp93pJK7DzHsIz1p0ZQINBJZvJPkaNA== X-Received: by 2002:a05:6214:449f:b0:6d8:a4fd:d253 with SMTP id 6a1803df08f44-6df9b22d70emr555753786d6.21.1737039990992; Thu, 16 Jan 2025 07:06:30 -0800 (PST) Received: from rowland.harvard.edu ([2601:19b:681:fd10::5bb3]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e1afc117a2sm774686d6.40.2025.01.16.07.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 07:06:30 -0800 (PST) Date: Thu, 16 Jan 2025 10:06:27 -0500 From: Alan Stern To: Guan-Yu Lin Cc: gregkh@linuxfoundation.org, Thinh.Nguyen@synopsys.com, mathias.nyman@intel.com, perex@perex.cz, tiwai@suse.com, sumit.garg@linaro.org, kekrby@gmail.com, oneukum@suse.com, ricardo@marliere.net, lijiayi@kylinos.cn, quic_jjohnson@quicinc.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: Re: [PATCH v8 5/5] usb: host: enable USB offload during system sleep Message-ID: <47efaf4a-8237-4030-8386-5e67a50c3030@rowland.harvard.edu> References: <20250116135358.2335615-1-guanyulin@google.com> <20250116135358.2335615-6-guanyulin@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250116135358.2335615-6-guanyulin@google.com> 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 > --- > 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