From patchwork Tue Nov 5 09:01:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13862681 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2051.outbound.protection.outlook.com [40.107.249.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BF01210FB for ; Tue, 5 Nov 2024 09:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730797313; cv=fail; b=hi/G6KnkoM0lQP+jENYM+u2MHIWx2YOG4jJYJPghnxWQwYWWSOFmnHR8We0GzWADMZ9LoduItdWZZ/+Ui2nwKWtANtNl9hCp98MEOrDETHrm5d6UgXrpHnp9GJtB8SQQDkzkr1IRtZ6VRuKtwERIqKTwHjY6m7BnmA5ebDiGCtE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730797313; c=relaxed/simple; bh=UGmH2yX4kvuHHJUBLEpYB0wr6DgX4Yo58QRpfTOcLjg=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=AEGr5JHepTkF2u/lgAW2JnF8tTrh24Q6V2VopD6GbkDaL7O6ioJ/7kBFyVbHA95sWQKYQs8a9MprGSMIfI3LJgvQt4Xm1wGiKzQdX8LsP1Zd42V0ZTR0xVv+DSVyBg5Ir007TH6Vge5zXaGehQD0o4wh2bPMFopMHRpknkbmwI8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=J6jpxHLq; arc=fail smtp.client-ip=40.107.249.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="J6jpxHLq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z12FYAkfYjbceq1GB5e4Y7qTnPXCpwM+Wm1gwbBI06LXq+zmens0XDKVTCQaKv/3ee76TpDJvHXbpXQLsGZ2qvxuVTXF99d8qBU+vASLCTMU3QBuywl9UCzuc84/2t7gqg/6mzUf6t1DhCH6ZW+P4N68xsoIccNNHlNSVJZdtm7KcPj5qP1VBlmwiKn9vfbf445YpKc9qp1ACnehrJFxJbJ2cC6MFn2xLA+ui2u0xrcYAQsK52MHXcbFfXUFSlCuQmaYOD3wJ7JwczYClWzQGsk+KcwFvcZCnwVGOfixbiRcXGGfVOTee4Xwzz0/ll+bMZ5EIgnSLGMbkSQcEwohvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lSiMlCAJbCT4PEMIiv6FoMzcaRq+jQ84sgFwYXe6BFo=; b=d3hYI5bRfmTd1tSWReUZlpXSUEDLXZdutXEjszAqOLVT+8xff5chpB6P8WhB1StAtmjfG2s6DUcgPvosDhucVCWhRQnx0Ix+wH9IgNVc9sxm52ducL2W1audUwovw9WBCL4AT8A3sLY9oubaT9SB2fpJbS/Ztf5ob1cDAMg1EjRN3f6zaqScAkoNRfXXn1gWKXmMqufH6M3kLYDZSqjGTLuiIzxRYOSlcGujIZFA3skg0CjADswJYsCke6/p6Y0Hg2KZbJkL84hWO0Ka4zuUT7Lwn05zkFrfDT49wikwSNW0g852zaWoZUL3FblIFTEQi6Ih1PGYAcVLupeTEVEGLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lSiMlCAJbCT4PEMIiv6FoMzcaRq+jQ84sgFwYXe6BFo=; b=J6jpxHLqrykeA6YzNH0rttETRvXXfClE8l81pDVXmdGoSA1FWhJA64vf0McSZwdEKFyiCWAiQdwkNHsKABjH+SeqkYVDDJKpwv/u/EH7Ei5atUMEVK6+trxH82T3VyEfazYeylQ6UTNse5Ep5Sr7tAR9Tz+LyIBEEfcbhKYNrYxkule7K2NEqWHMUClp+FYyQH43kC9I1i2aJks3+ULGbZpLMcn/PR8enLnOLyCDdpiLCs9LcWWSqIcxuCeCXE1zT11HeikYajXv6hEPRHAJk6+45V003pYqd5nw+VQc43aW61ZxGxpgVnHnDSKDBp1k5ppVGMh9pZw4xRTibBp/oQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by AS5PR04MB9876.eurprd04.prod.outlook.com (2603:10a6:20b:678::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Tue, 5 Nov 2024 09:01:47 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%5]) with mapi id 15.20.8114.028; Tue, 5 Nov 2024 09:01:47 +0000 From: Xu Yang To: gregkh@linuxfoundation.org, niko.mauno@vaisala.com, dvyukov@google.com, stanley_chang@realtek.com, andreyknvl@gmail.com, tj@kernel.org, viro@zeniv.linux.org.uk Cc: linux-usb@vger.kernel.org, imx@lists.linux.dev, jun.li@nxp.com Subject: [PATCH] usb: core: hcd: only check primary hcd skip_phy_initialization Date: Tue, 5 Nov 2024 17:01:20 +0800 Message-Id: <20241105090120.2438366-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR01CA0163.apcprd01.prod.exchangelabs.com (2603:1096:4:28::19) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|AS5PR04MB9876:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b0266f7-9484-44a5-817a-08dcfd787a61 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: qWU7+XNRS5BsqisI9BluhdaVGgJdiIIn2wCyPALFQr/dyzKmkjoc5Z897KdqgnopdtjIm2G0+qnsT0TdnZC/WTEDv1Rze1YG5l1GmX/vaWQu24K43kEzfC2GDNC9zDJgV26aK/OpCrcCoSPXk1L4C0hhgjPDRCDJ0MvPgNoHXQptV7xkHQ3s0HEf+nS6vY9B3QnjdqBOqs8gBGY7eMuy+jIXwXSiTbXpif7yBln76STgdBls9590XEuaSilSeXw8trBkuUHSwhHqGaQPdsAh06ZOxwZK01hgimMFjAtQEnqROuxa4/T4urIgnY6yq6A0rS6Wi4EGa4XYQUkFkVMck6hkJxQal7CXu4P416KQJLU37kA/aLPFQBVki3p5V831wJVeDhBzjrXi3ZpjzF6r7OnVVPfwI4Fu19/vjz7I9W1lYy5QYgLLGReioI0JZvHv8fNXbKkpkJSem/ZcKMNriJt9OXwxoAIfNFhPu+lieWLNgc/yuIHzdutW6wt9T8pV/c1pm0zHxuaNPUUfboa98O6WsX55OdKQ/Kc2nSBnguD24hKkoln57ra7XyiwI2bqRf+e+syO8oDuzUtD2JvjToxlWr+HLKQoqnpeSh1HtU54Lt2aOIB2IMd8y90QiPUMuBpg6889TwBLfKEeBJALnpkze3gjId44HLtRQfTgZ5n03XNZiVSzy0PF7+AsGT8VwdZ8sdBZHviz4MA3lnVI5TTyZEBfXzyNZiQ2BdY5JZZ7LjTWwo9XnLiUlyWQX9VOEa7qc4COTR25LGMjR0yqwTn0ILYlsXBXT4A0z9qKgUBCS1LE9vNg97E/Jbnf59Y3DY2Uu2qfV154vaW5VCRSA/edujfmS9/wcAbFukuU1igib324eZ69itmJ3nou3Bxiq3XJgfI4oLWaTFvuT8J1EDECLT7vBbfzF0xBscc7aZGDOPh8aMpyOnC/KV36EZRmDr7LgukiFm/teuEL+4zoSoFveJUU4dl9sh5AuPwtv2umfjDfHyc/Gt5JnB5DpqAxa8fWIPeayBNnwqQ9z6dGv/MLY3vmbkO0LX8R8o/uSA80W3gYbaVaV7TZZuDn3Q7EznmO01DjlF6jdQ0J65Ifjgp+P3LkxYPokIrcrHpA8OxS0oIxcldYxiuf6/gDHx/LPyRvk99f6wEBDzsu7J0zjy9whfSblk8qC2lP+2nWCjd7uowAu5m3tws2+1FK4iUyhkl0nQj7897ycfxB77CulDxfJsm1nKofrHnxjQ/XNb+gZGLqH4GlCkoBK8Nm4bEh/BUSwKO/y6Zvq121gklIpFSfJq1tELWl4T/4DJ3RuTP6iP9y6BqY+s6Uo1ryoDPWSivRWZBrlu00ZB2NVO+LQkoCEU4wM+aJ3Ov5mPghfJs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8822.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(376014)(1800799024)(38350700014);DIR:OUT;S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24d3HWXIKeokfD9SIqcKs/4q6JyHsP4eRBuRmIvXny+cKAyW6rvnaZMSWhusOJ5NR/Rp8zUDX2UEaWfVqH3Dk+izTTU2brV/RfskkJ5yQj5fq0Omc49EBgIZw2MKxHagDl1bIZv7UwYfHwm7IHlIUnBpcBZIVSfxS9PttRhGWDYTZNxLo2W6/tEZGrK0+2EXau1dNrOWaj1CJ6B2Wn2j/l4fpwZB1VEFAB7XfYY82yWXArh8FbUcecmoelwYuMaGDZ6b9X0vJ3yzF0HBU/aIyBvo8JNPoo0Pl9btPfln3n4Zx87esigbvfggFX80Cp5CK8o4BiYiFpb19Ik8st2uHxmkeBW/OfZAIzM3NFgnrMTJ1A7zxpqpVQWXgMBZQoWalCDl/Fu2b/MUAnnYr4NGXkE5zCyR6ofP0qQJR2nwsDru9ZR3hoW4Ahg/y1Vco1aChqRXmO8KCKVypMTvMfYKjvfKXSWDc4ZV8wZibKZXF+pXgqYHo6p7H4uQ8zOS3la9fJonvvsbPJchegjESPKtuPFwadD8mp+CeQRjMEDljuNqieesxiDr6Z0FnfsCIpFOapgbayEGPwwaNLED0My X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b0266f7-9484-44a5-817a-08dcfd787a61 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 09:01:47.3630 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: H9Md184a0ldxeC/hppM5RUh7Wo+kzrH6O4ON5k1mSlL8Xct2AWbP2TtHWSd22mG2NTtk/c+c3qfQNMF/hwWxPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9876 Before commit 53a2d95df836 ("usb: core: add phy notify connect and disconnect"), phy initialization will be skipped even when shared hcd doesn't set skip_phy_initialization flag. However, the situation is changed after the commit. The hcd.c will initialize phy when add shared hcd. This behavior is unexpected for some platforms which will handle phy initialization by themselves. To avoid the issue, this will only check skip_phy_initialization flag of primary hcd since shared hcd normally follow primary hcd setting. Fixes: 53a2d95df836 ("usb: core: add phy notify connect and disconnect") Cc: stable@vger.kernel.org Signed-off-by: Xu Yang --- drivers/usb/core/hcd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 500dc35e6477..0b2490347b9f 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2794,8 +2794,14 @@ int usb_add_hcd(struct usb_hcd *hcd, int retval; struct usb_device *rhdev; struct usb_hcd *shared_hcd; + int skip_phy_initialization; - if (!hcd->skip_phy_initialization) { + if (usb_hcd_is_primary_hcd(hcd)) + skip_phy_initialization = hcd->skip_phy_initialization; + else + skip_phy_initialization = hcd->primary_hcd->skip_phy_initialization; + + if (!skip_phy_initialization) { if (usb_hcd_is_primary_hcd(hcd)) { hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); if (IS_ERR(hcd->phy_roothub))