Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: core: hcd: only check primary hcd skip_phy_initialization

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 <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20241105090120.2438366-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Xu Yang and committed by
Greg Kroah-Hartman
d2ec94fb 82937056

+7 -1
+7 -1
drivers/usb/core/hcd.c
··· 2794 2794 int retval; 2795 2795 struct usb_device *rhdev; 2796 2796 struct usb_hcd *shared_hcd; 2797 + int skip_phy_initialization; 2797 2798 2798 - if (!hcd->skip_phy_initialization) { 2799 + if (usb_hcd_is_primary_hcd(hcd)) 2800 + skip_phy_initialization = hcd->skip_phy_initialization; 2801 + else 2802 + skip_phy_initialization = hcd->primary_hcd->skip_phy_initialization; 2803 + 2804 + if (!skip_phy_initialization) { 2799 2805 if (usb_hcd_is_primary_hcd(hcd)) { 2800 2806 hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); 2801 2807 if (IS_ERR(hcd->phy_roothub))