Re: Is there something wrong with v5.10.234 patch 664760c49d98 ("xhci: use pm_ptr() instead of #ifdef for CONFIG_PM conditionals")?

From: zhangzekun (A)
Date: Wed Mar 05 2025 - 22:35:59 EST


Sorry for make noise. Please ignore this messgae.
The latter patch c762b76981fc ("Partial revert of xhci: use pm_ptr() instead #ifdef for CONFIG_PM conditionals") patial revert the patch, So, there is no such problem with the patch.

Thanks,
Zekunk

在 2025/3/6 10:33, Zhang Zekun 写道:
Hi, Greg,
The stable patch 664760c49d98 ("xhci: use pm_ptr() instead of #ifdef for CONFIG_PM conditionals") in linux-5.10.y, is different with the mainline patch. In the following code.

mainline:
-#ifdef CONFIG_PM
- xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend;
- xhci_pci_hc_driver.pci_resume = xhci_pci_resume;
- xhci_pci_hc_driver.pci_poweroff_late = xhci_pci_poweroff_late;
- xhci_pci_hc_driver.shutdown = xhci_pci_shutdown;
-#endif
+ xhci_pci_hc_driver.pci_suspend = pm_ptr(xhci_pci_suspend);
+ xhci_pci_hc_driver.pci_resume = pm_ptr(xhci_pci_resume);
+ xhci_pci_hc_driver.pci_poweroff_late = pm_ptr(xhci_pci_poweroff_late);
+ xhci_pci_hc_driver.shutdown = pm_ptr(xhci_pci_shutdown);

linux-5.10.y:
-#ifdef CONFIG_PM
xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend;
xhci_pci_hc_driver.pci_resume = xhci_pci_resume;
xhci_pci_hc_driver.shutdown = xhci_pci_shutdown;
-#endif

xhci_pci_shutdown() in mainline is wrapped with pm_ptr(), which is NULL if CONFIG_PM is not enabled, but for linux-5.10.y, xhci_pci_shutdown() it will not be converted to a NULL pointer. The .shutdown() function seems has been used in usb_hcd_platform_shutdown() in usb platfrom device shutdown routine:

drivers/usb/host/ehci-atmel.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-brcm.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-exynos.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-fsl.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-grlib.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-mxc.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-npcm7xx.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-omap.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-orion.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-platform.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-ppc-of.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-spear.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-st.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ehci-xilinx-of.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-at91.c: usb_hcd_platform_shutdown(pdev);
drivers/usb/host/ohci-at91.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-da8xx.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-omap.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-platform.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-ppc-of.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-pxa27x.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-s3c2410.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-sm501.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-st.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/ohci-tmio.c: .shutdown = usb_hcd_platform_shutdown,
drivers/usb/host/xhci-plat.c: .shutdown = usb_hcd_platform_shutdown,
For the mainline patch seems does not want to call xhci_pci_shutdown() when CONFIG_PM is diabled, is there something wrong with the stable patch?