Hi Matthias, I love your patch! Yet something to improve: [auto build test ERROR on usb/usb-testing] [also build test ERROR on robh/for-next driver-core/driver-core-testing linus/master v5.14-rc2 next-20210720] [cannot apply to char-misc/char-misc-testing] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Matthias-Kaehlcke/usb-misc-Add-onboard_usb_hub-driver/20210720-144614 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: i386-randconfig-a003-20210720 (attached as .config) compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/1ac4caccda0f2e6904b0e1462bc9735c690d719f git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Matthias-Kaehlcke/usb-misc-Add-onboard_usb_hub-driver/20210720-144614 git checkout 1ac4caccda0f2e6904b0e1462bc9735c690d719f # save the attached .config to linux build tree mkdir build_dir make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): ld: drivers/usb/dwc3/core.o: in function `dwc3_resume_common': >> drivers/usb/dwc3/core.c:1853: undefined reference to `dwc3_gadget_resume' ld: drivers/usb/dwc3/core.o: in function `dwc3_runtime_resume': >> drivers/usb/dwc3/core.c:1912: undefined reference to `dwc3_gadget_process_pending_events' ld: drivers/usb/dwc3/core.o: in function `dwc3_suspend_common': >> drivers/usb/dwc3/core.c:1750: undefined reference to `dwc3_gadget_suspend' vim +1853 drivers/usb/dwc3/core.c fe8abf332b8f66 Masahiro Yamada 2018-05-16 1739 c4a5153e87fdf6 Manu Gautam 2018-01-18 1740 static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) 7415f17c9560c9 Felipe Balbi 2012-04-30 1741 { fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1742 unsigned long flags; bcb128777af5e9 Manu Gautam 2018-05-09 1743 u32 reg; 7415f17c9560c9 Felipe Balbi 2012-04-30 1744 689bf72c6e0dc9 Manu Gautam 2017-09-27 1745 switch (dwc->current_dr_role) { 689bf72c6e0dc9 Manu Gautam 2017-09-27 1746 case DWC3_GCTL_PRTCAP_DEVICE: 0227cc84c44417 Li Jun 2020-02-20 1747 if (pm_runtime_suspended(dwc->dev)) 0227cc84c44417 Li Jun 2020-02-20 1748 break; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1749 spin_lock_irqsave(&dwc->lock, flags); 7415f17c9560c9 Felipe Balbi 2012-04-30 @1750 dwc3_gadget_suspend(dwc); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1751 spin_unlock_irqrestore(&dwc->lock, flags); 41a91c606e7d2b Marek Szyprowski 2019-03-27 1752 synchronize_irq(dwc->irq_gadget); 689bf72c6e0dc9 Manu Gautam 2017-09-27 1753 dwc3_core_exit(dwc); 51f5d49ad6f011 Felipe Balbi 2016-05-16 1754 break; 689bf72c6e0dc9 Manu Gautam 2017-09-27 1755 case DWC3_GCTL_PRTCAP_HOST: bcb128777af5e9 Manu Gautam 2018-05-09 1756 if (!PMSG_IS_AUTO(msg)) { c4a5153e87fdf6 Manu Gautam 2018-01-18 1757 dwc3_core_exit(dwc); c4a5153e87fdf6 Manu Gautam 2018-01-18 1758 break; bcb128777af5e9 Manu Gautam 2018-05-09 1759 } bcb128777af5e9 Manu Gautam 2018-05-09 1760 bcb128777af5e9 Manu Gautam 2018-05-09 1761 /* Let controller to suspend HSPHY before PHY driver suspends */ bcb128777af5e9 Manu Gautam 2018-05-09 1762 if (dwc->dis_u2_susphy_quirk || bcb128777af5e9 Manu Gautam 2018-05-09 1763 dwc->dis_enblslpm_quirk) { bcb128777af5e9 Manu Gautam 2018-05-09 1764 reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); bcb128777af5e9 Manu Gautam 2018-05-09 1765 reg |= DWC3_GUSB2PHYCFG_ENBLSLPM | bcb128777af5e9 Manu Gautam 2018-05-09 1766 DWC3_GUSB2PHYCFG_SUSPHY; bcb128777af5e9 Manu Gautam 2018-05-09 1767 dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); bcb128777af5e9 Manu Gautam 2018-05-09 1768 bcb128777af5e9 Manu Gautam 2018-05-09 1769 /* Give some time for USB2 PHY to suspend */ bcb128777af5e9 Manu Gautam 2018-05-09 1770 usleep_range(5000, 6000); bcb128777af5e9 Manu Gautam 2018-05-09 1771 } bcb128777af5e9 Manu Gautam 2018-05-09 1772 bcb128777af5e9 Manu Gautam 2018-05-09 1773 phy_pm_runtime_put_sync(dwc->usb2_generic_phy); bcb128777af5e9 Manu Gautam 2018-05-09 1774 phy_pm_runtime_put_sync(dwc->usb3_generic_phy); bcb128777af5e9 Manu Gautam 2018-05-09 1775 break; f09cc79b4b338e Roger Quadros 2018-02-27 1776 case DWC3_GCTL_PRTCAP_OTG: f09cc79b4b338e Roger Quadros 2018-02-27 1777 /* do nothing during runtime_suspend */ f09cc79b4b338e Roger Quadros 2018-02-27 1778 if (PMSG_IS_AUTO(msg)) f09cc79b4b338e Roger Quadros 2018-02-27 1779 break; f09cc79b4b338e Roger Quadros 2018-02-27 1780 f09cc79b4b338e Roger Quadros 2018-02-27 1781 if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) { f09cc79b4b338e Roger Quadros 2018-02-27 1782 spin_lock_irqsave(&dwc->lock, flags); f09cc79b4b338e Roger Quadros 2018-02-27 1783 dwc3_gadget_suspend(dwc); f09cc79b4b338e Roger Quadros 2018-02-27 1784 spin_unlock_irqrestore(&dwc->lock, flags); 41a91c606e7d2b Marek Szyprowski 2019-03-27 1785 synchronize_irq(dwc->irq_gadget); f09cc79b4b338e Roger Quadros 2018-02-27 1786 } f09cc79b4b338e Roger Quadros 2018-02-27 1787 f09cc79b4b338e Roger Quadros 2018-02-27 1788 dwc3_otg_exit(dwc); f09cc79b4b338e Roger Quadros 2018-02-27 1789 dwc3_core_exit(dwc); f09cc79b4b338e Roger Quadros 2018-02-27 1790 break; 7415f17c9560c9 Felipe Balbi 2012-04-30 1791 default: 51f5d49ad6f011 Felipe Balbi 2016-05-16 1792 /* do nothing */ 7415f17c9560c9 Felipe Balbi 2012-04-30 1793 break; 7415f17c9560c9 Felipe Balbi 2012-04-30 1794 } 7415f17c9560c9 Felipe Balbi 2012-04-30 1795 7415f17c9560c9 Felipe Balbi 2012-04-30 1796 return 0; 7415f17c9560c9 Felipe Balbi 2012-04-30 1797 } 7415f17c9560c9 Felipe Balbi 2012-04-30 1798 c4a5153e87fdf6 Manu Gautam 2018-01-18 1799 static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg) 7415f17c9560c9 Felipe Balbi 2012-04-30 1800 { fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1801 unsigned long flags; 57303488cd37da Kishon Vijay Abraham I 2014-03-03 1802 int ret; bcb128777af5e9 Manu Gautam 2018-05-09 1803 u32 reg; 7415f17c9560c9 Felipe Balbi 2012-04-30 1804 689bf72c6e0dc9 Manu Gautam 2017-09-27 1805 switch (dwc->current_dr_role) { 689bf72c6e0dc9 Manu Gautam 2017-09-27 1806 case DWC3_GCTL_PRTCAP_DEVICE: fe8abf332b8f66 Masahiro Yamada 2018-05-16 1807 ret = dwc3_core_init_for_resume(dwc); 51f5d49ad6f011 Felipe Balbi 2016-05-16 1808 if (ret) 5c4ad318de3b8e Felipe Balbi 2016-04-11 1809 return ret; 5c4ad318de3b8e Felipe Balbi 2016-04-11 1810 7d11c3ac666940 Roger Quadros 2018-03-16 1811 dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1812 spin_lock_irqsave(&dwc->lock, flags); 7415f17c9560c9 Felipe Balbi 2012-04-30 1813 dwc3_gadget_resume(dwc); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1814 spin_unlock_irqrestore(&dwc->lock, flags); 689bf72c6e0dc9 Manu Gautam 2017-09-27 1815 break; 689bf72c6e0dc9 Manu Gautam 2017-09-27 1816 case DWC3_GCTL_PRTCAP_HOST: c4a5153e87fdf6 Manu Gautam 2018-01-18 1817 if (!PMSG_IS_AUTO(msg)) { fe8abf332b8f66 Masahiro Yamada 2018-05-16 1818 ret = dwc3_core_init_for_resume(dwc); c4a5153e87fdf6 Manu Gautam 2018-01-18 1819 if (ret) c4a5153e87fdf6 Manu Gautam 2018-01-18 1820 return ret; 7d11c3ac666940 Roger Quadros 2018-03-16 1821 dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); bcb128777af5e9 Manu Gautam 2018-05-09 1822 break; c4a5153e87fdf6 Manu Gautam 2018-01-18 1823 } bcb128777af5e9 Manu Gautam 2018-05-09 1824 /* Restore GUSB2PHYCFG bits that were modified in suspend */ bcb128777af5e9 Manu Gautam 2018-05-09 1825 reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); bcb128777af5e9 Manu Gautam 2018-05-09 1826 if (dwc->dis_u2_susphy_quirk) bcb128777af5e9 Manu Gautam 2018-05-09 1827 reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; bcb128777af5e9 Manu Gautam 2018-05-09 1828 bcb128777af5e9 Manu Gautam 2018-05-09 1829 if (dwc->dis_enblslpm_quirk) bcb128777af5e9 Manu Gautam 2018-05-09 1830 reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; bcb128777af5e9 Manu Gautam 2018-05-09 1831 bcb128777af5e9 Manu Gautam 2018-05-09 1832 dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); bcb128777af5e9 Manu Gautam 2018-05-09 1833 bcb128777af5e9 Manu Gautam 2018-05-09 1834 phy_pm_runtime_get_sync(dwc->usb2_generic_phy); bcb128777af5e9 Manu Gautam 2018-05-09 1835 phy_pm_runtime_get_sync(dwc->usb3_generic_phy); f09cc79b4b338e Roger Quadros 2018-02-27 1836 break; f09cc79b4b338e Roger Quadros 2018-02-27 1837 case DWC3_GCTL_PRTCAP_OTG: f09cc79b4b338e Roger Quadros 2018-02-27 1838 /* nothing to do on runtime_resume */ f09cc79b4b338e Roger Quadros 2018-02-27 1839 if (PMSG_IS_AUTO(msg)) f09cc79b4b338e Roger Quadros 2018-02-27 1840 break; f09cc79b4b338e Roger Quadros 2018-02-27 1841 0e5a3c8284a30f Gary Bisson 2021-01-25 1842 ret = dwc3_core_init_for_resume(dwc); f09cc79b4b338e Roger Quadros 2018-02-27 1843 if (ret) f09cc79b4b338e Roger Quadros 2018-02-27 1844 return ret; f09cc79b4b338e Roger Quadros 2018-02-27 1845 f09cc79b4b338e Roger Quadros 2018-02-27 1846 dwc3_set_prtcap(dwc, dwc->current_dr_role); f09cc79b4b338e Roger Quadros 2018-02-27 1847 f09cc79b4b338e Roger Quadros 2018-02-27 1848 dwc3_otg_init(dwc); f09cc79b4b338e Roger Quadros 2018-02-27 1849 if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST) { f09cc79b4b338e Roger Quadros 2018-02-27 1850 dwc3_otg_host_init(dwc); f09cc79b4b338e Roger Quadros 2018-02-27 1851 } else if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) { f09cc79b4b338e Roger Quadros 2018-02-27 1852 spin_lock_irqsave(&dwc->lock, flags); f09cc79b4b338e Roger Quadros 2018-02-27 @1853 dwc3_gadget_resume(dwc); f09cc79b4b338e Roger Quadros 2018-02-27 1854 spin_unlock_irqrestore(&dwc->lock, flags); c4a5153e87fdf6 Manu Gautam 2018-01-18 1855 } f09cc79b4b338e Roger Quadros 2018-02-27 1856 c4a5153e87fdf6 Manu Gautam 2018-01-18 1857 break; 7415f17c9560c9 Felipe Balbi 2012-04-30 1858 default: 7415f17c9560c9 Felipe Balbi 2012-04-30 1859 /* do nothing */ 7415f17c9560c9 Felipe Balbi 2012-04-30 1860 break; 7415f17c9560c9 Felipe Balbi 2012-04-30 1861 } 7415f17c9560c9 Felipe Balbi 2012-04-30 1862 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1863 return 0; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1864 } fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1865 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1866 static int dwc3_runtime_checks(struct dwc3 *dwc) fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1867 { 689bf72c6e0dc9 Manu Gautam 2017-09-27 1868 switch (dwc->current_dr_role) { c4a5153e87fdf6 Manu Gautam 2018-01-18 1869 case DWC3_GCTL_PRTCAP_DEVICE: fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1870 if (dwc->connected) fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1871 return -EBUSY; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1872 break; c4a5153e87fdf6 Manu Gautam 2018-01-18 1873 case DWC3_GCTL_PRTCAP_HOST: fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1874 default: fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1875 /* do nothing */ fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1876 break; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1877 } fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1878 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1879 return 0; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1880 } fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1881 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1882 static int dwc3_runtime_suspend(struct device *dev) fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1883 { fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1884 struct dwc3 *dwc = dev_get_drvdata(dev); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1885 int ret; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1886 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1887 if (dwc3_runtime_checks(dwc)) fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1888 return -EBUSY; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1889 c4a5153e87fdf6 Manu Gautam 2018-01-18 1890 ret = dwc3_suspend_common(dwc, PMSG_AUTO_SUSPEND); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1891 if (ret) fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1892 return ret; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1893 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1894 device_init_wakeup(dev, true); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1895 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1896 return 0; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1897 } fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1898 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1899 static int dwc3_runtime_resume(struct device *dev) fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1900 { fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1901 struct dwc3 *dwc = dev_get_drvdata(dev); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1902 int ret; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1903 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1904 device_init_wakeup(dev, false); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1905 c4a5153e87fdf6 Manu Gautam 2018-01-18 1906 ret = dwc3_resume_common(dwc, PMSG_AUTO_RESUME); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1907 if (ret) fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1908 return ret; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1909 689bf72c6e0dc9 Manu Gautam 2017-09-27 1910 switch (dwc->current_dr_role) { 689bf72c6e0dc9 Manu Gautam 2017-09-27 1911 case DWC3_GCTL_PRTCAP_DEVICE: fc8bb91bc83ef8 Felipe Balbi 2016-05-16 @1912 dwc3_gadget_process_pending_events(dwc); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1913 break; 689bf72c6e0dc9 Manu Gautam 2017-09-27 1914 case DWC3_GCTL_PRTCAP_HOST: fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1915 default: fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1916 /* do nothing */ fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1917 break; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1918 } fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1919 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1920 pm_runtime_mark_last_busy(dev); fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1921 fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1922 return 0; fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1923 } fc8bb91bc83ef8 Felipe Balbi 2016-05-16 1924 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org