diff mbox series

[v14,4/6] usb: Specify dependencies on USB_XHCI_PLATFORM with 'depends on'

Message ID 20210719152055.v14.4.If248f05613bbb06a44eb0b0909be5d97218f417b@changeid (mailing list archive)
State Superseded
Headers show
Series usb: misc: Add onboard_usb_hub driver | expand

Commit Message

Matthias Kaehlcke July 19, 2021, 10:21 p.m. UTC
Some USB controller drivers that depend on the xhci-plat driver
specify this dependency using 'select' in Kconfig. This is not
recommended for symbols that have other dependencies as it may
lead to invalid configurations. Use 'depends on' to specify the
dependency instead of 'select'.

For DWC3 move the dependency from USB_DWC3 to USB_DWC3_HOST and
USB_DWC3_DUAL_ROLE, to make the DWC3 core selectable for
gadget-only mode when USB_XHCI_PLATFORM=n.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
With this patch no Kconfig conflicts were observed with
allmodconfig and in ~100 randconfig cycles.

Changes in v14:
- none

Changes in v13:
- patch added to the series

 drivers/usb/cdns3/Kconfig | 2 +-
 drivers/usb/dwc3/Kconfig  | 3 ++-
 drivers/usb/host/Kconfig  | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

Comments

kernel test robot July 21, 2021, 12:46 a.m. UTC | #1
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 <lkp@intel.com>

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
Matthias Kaehlcke July 23, 2021, 12:17 a.m. UTC | #2
On Wed, Jul 21, 2021 at 08:46:17AM +0800, kernel test robot wrote:
> 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 <lkp@intel.com>
> 
> 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'

What happened here is that USB_DWC3 was selected, but one of USB_DWC3_HOST,
USB_DWC3_GADGET or USB_DWC3_DUAL_ROLE.

Typically one of them would be selected by:

  choice
          bool "DWC3 Mode Selection"
          default USB_DWC3_DUAL_ROLE if (USB && USB_GADGET)
          default USB_DWC3_HOST if (USB && !USB_GADGET)
          default USB_DWC3_GADGET if (!USB && USB_GADGET)

In this case USB_XHCI_PLATFORM is not set (previously it would be selected
by USB_DWC3) and USB_DWC3_HOST (and USB_DWC3_DUAL_ROLE) now depends on it.

The following change should fix this:

  config USB_DWC3
 -        depends on (USB || USB_GADGET) && HAS_DMA
 +        depends on (USB && USB_XHCI_PLATFORM) || USB_GADGET)) && HAS_DMA
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/Kconfig b/drivers/usb/cdns3/Kconfig
index b98ca0a1352a..07e12f786d48 100644
--- a/drivers/usb/cdns3/Kconfig
+++ b/drivers/usb/cdns3/Kconfig
@@ -1,7 +1,7 @@ 
 config USB_CDNS_SUPPORT
 	tristate "Cadence USB Support"
 	depends on USB_SUPPORT && (USB || USB_GADGET) && HAS_DMA
-	select USB_XHCI_PLATFORM if USB_XHCI_HCD
+	depends on !USB_XHCI_HCD || USB_XHCI_PLATFORM
 	select USB_ROLE_SWITCH
 	help
 	  Say Y here if your system has a Cadence USBSS or USBSSP
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 66b1454c4db2..29a874644518 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -3,7 +3,6 @@ 
 config USB_DWC3
 	tristate "DesignWare USB3 DRD Core Support"
 	depends on (USB || USB_GADGET) && HAS_DMA
-	select USB_XHCI_PLATFORM if USB_XHCI_HCD
 	select USB_ROLE_SWITCH if USB_DWC3_DUAL_ROLE
 	help
 	  Say Y or M here if your system has a Dual Role SuperSpeed
@@ -30,6 +29,7 @@  choice
 config USB_DWC3_HOST
 	bool "Host only mode"
 	depends on USB=y || USB=USB_DWC3
+	depends on USB_XHCI_PLATFORM
 	help
 	  Select this when you want to use DWC3 in host mode only,
 	  thereby the gadget feature will be regressed.
@@ -44,6 +44,7 @@  config USB_DWC3_GADGET
 config USB_DWC3_DUAL_ROLE
 	bool "Dual Role mode"
 	depends on ((USB=y || USB=USB_DWC3) && (USB_GADGET=y || USB_GADGET=USB_DWC3))
+	depends on USB_XHCI_PLATFORM
 	depends on (EXTCON=y || EXTCON=USB_DWC3)
 	help
 	  This is the default mode of working of DWC3 controller where
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index df9428f1dc5e..518c2312ef0c 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -80,7 +80,7 @@  config USB_XHCI_MTK
 
 config USB_XHCI_MVEBU
 	tristate "xHCI support for Marvell Armada 375/38x/37xx"
-	select USB_XHCI_PLATFORM
+	depends on USB_XHCI_PLATFORM
 	depends on HAS_IOMEM
 	depends on ARCH_MVEBU || COMPILE_TEST
 	help
@@ -112,9 +112,9 @@  config USB_EHCI_BRCMSTB
 config USB_BRCMSTB
 	tristate "Broadcom STB USB support"
 	depends on (ARCH_BRCMSTB && PHY_BRCM_USB) || COMPILE_TEST
+	depends on !USB_XHCI_HCD || USB_XHCI_PLATFORM
 	select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
 	select USB_EHCI_BRCMSTB if USB_EHCI_HCD
-	select USB_XHCI_PLATFORM if USB_XHCI_HCD
 	help
 	  Enables support for XHCI, EHCI and OHCI host controllers
 	  found in Broadcom STB SoC's.