Re: [balbi-usb:testing/next 32/38] drivers/usb/dwc2/drd.c:71: undefined reference to `usb_role_switch_get_drvdata'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 9/15/20 7:16 AM, kernel test robot wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git testing/next
head:   3c9722514c3fb74bbe0af87c20bc6b4c47121287
commit: a0f0bc95705446b8b1476338056bf869271ba36a [32/38] usb: dwc2: override PHY input signals with usb role switch support
config: i386-randconfig-a014-20200914 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
         git checkout a0f0bc95705446b8b1476338056bf869271ba36a
         # save the attached .config to linux build tree
         make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

    ld: drivers/usb/dwc2/drd.o: in function `dwc2_drd_role_sw_set':
drivers/usb/dwc2/drd.c:71: undefined reference to `usb_role_switch_get_drvdata'
    ld: drivers/usb/dwc2/drd.o: in function `dwc2_drd_init':
drivers/usb/dwc2/drd.c:134: undefined reference to `usb_role_switch_register'
    ld: drivers/usb/dwc2/drd.o: in function `dwc2_drd_exit':
drivers/usb/dwc2/drd.c:179: undefined reference to `usb_role_switch_unregister'

# https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git/commit/?id=a0f0bc95705446b8b1476338056bf869271ba36a
git remote add balbi-usb https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
git fetch --no-tags balbi-usb testing/next
git checkout a0f0bc95705446b8b1476338056bf869271ba36a
vim +71 drivers/usb/dwc2/drd.c

     68	
     69	static int dwc2_drd_role_sw_set(struct usb_role_switch *sw, enum usb_role role)
     70	{
   > 71		struct dwc2_hsotg *hsotg = usb_role_switch_get_drvdata(sw);
     72		unsigned long flags;
     73		int already = 0;
     74	
     75		/* Skip session not in line with dr_mode */
     76		if ((role == USB_ROLE_DEVICE && hsotg->dr_mode == USB_DR_MODE_HOST) ||
     77		    (role == USB_ROLE_HOST && hsotg->dr_mode == USB_DR_MODE_PERIPHERAL))
     78			return -EINVAL;
     79	
     80	#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
     81		IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
     82		/* Skip session if core is in test mode */
     83		if (role == USB_ROLE_NONE && hsotg->test_mode) {
     84			dev_dbg(hsotg->dev, "Core is in test mode\n");
     85			return -EBUSY;
     86		}
     87	#endif
     88	
     89		spin_lock_irqsave(&hsotg->lock, flags);
     90	
     91		if (role == USB_ROLE_HOST) {
     92			already = dwc2_ovr_avalid(hsotg, true);
     93		} else if (role == USB_ROLE_DEVICE) {
     94			already = dwc2_ovr_bvalid(hsotg, true);
     95			/* This clear DCTL.SFTDISCON bit */
     96			dwc2_hsotg_core_connect(hsotg);
     97		} else {
     98			if (dwc2_is_device_mode(hsotg)) {
     99				if (!dwc2_ovr_bvalid(hsotg, false))
    100					/* This set DCTL.SFTDISCON bit */
    101					dwc2_hsotg_core_disconnect(hsotg);
    102			} else {
    103				dwc2_ovr_avalid(hsotg, false);
    104			}
    105		}
    106	
    107		spin_unlock_irqrestore(&hsotg->lock, flags);
    108	
    109		if (!already && hsotg->dr_mode == USB_DR_MODE_OTG)
    110			/* This will raise a Connector ID Status Change Interrupt */
    111			dwc2_force_mode(hsotg, role == USB_ROLE_HOST);
    112	
    113		dev_dbg(hsotg->dev, "%s-session valid\n",
    114			role == USB_ROLE_NONE ? "No" :
    115			role == USB_ROLE_HOST ? "A" : "B");
    116	
    117		return 0;
    118	}
    119	
    120	int dwc2_drd_init(struct dwc2_hsotg *hsotg)
    121	{
    122		struct usb_role_switch_desc role_sw_desc = {0};
    123		struct usb_role_switch *role_sw;
    124		int ret;
    125	
    126		if (!device_property_read_bool(hsotg->dev, "usb-role-switch"))
    127			return 0;
    128	
    129		role_sw_desc.driver_data = hsotg;
    130		role_sw_desc.fwnode = dev_fwnode(hsotg->dev);
    131		role_sw_desc.set = dwc2_drd_role_sw_set;
    132		role_sw_desc.allow_userspace_control = true;
    133	
  > 134		role_sw = usb_role_switch_register(hsotg->dev, &role_sw_desc);
    135		if (IS_ERR(role_sw)) {
    136			ret = PTR_ERR(role_sw);
    137			dev_err(hsotg->dev,
    138				"failed to register role switch: %d\n", ret);
    139			return ret;
    140		}
    141	
    142		hsotg->role_sw = role_sw;
    143	
    144		/* Enable override and initialize values */
    145		dwc2_ovr_init(hsotg);
    146	
    147		return 0;
    148	}
    149	
    150	void dwc2_drd_suspend(struct dwc2_hsotg *hsotg)
    151	{
    152		u32 gintsts, gintmsk;
    153	
    154		if (hsotg->role_sw && !hsotg->params.external_id_pin_ctl) {
    155			gintmsk = dwc2_readl(hsotg, GINTMSK);
    156			gintmsk &= ~GINTSTS_CONIDSTSCHNG;
    157			dwc2_writel(hsotg, gintmsk, GINTMSK);
    158			gintsts = dwc2_readl(hsotg, GINTSTS);
    159			dwc2_writel(hsotg, gintsts | GINTSTS_CONIDSTSCHNG, GINTSTS);
    160		}
    161	}
    162	
    163	void dwc2_drd_resume(struct dwc2_hsotg *hsotg)
    164	{
    165		u32 gintsts, gintmsk;
    166	
    167		if (hsotg->role_sw && !hsotg->params.external_id_pin_ctl) {
    168			gintsts = dwc2_readl(hsotg, GINTSTS);
    169			dwc2_writel(hsotg, gintsts | GINTSTS_CONIDSTSCHNG, GINTSTS);
    170			gintmsk = dwc2_readl(hsotg, GINTMSK);
    171			gintmsk |= GINTSTS_CONIDSTSCHNG;
    172			dwc2_writel(hsotg, gintmsk, GINTMSK);
    173		}
    174	}
    175	
    176	void dwc2_drd_exit(struct dwc2_hsotg *hsotg)
    177	{
    178		if (hsotg->role_sw)
  > 179			usb_role_switch_unregister(hsotg->role_sw);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx


Fixed in v6 patchset: https://lore.kernel.org/patchwork/project/lkml/list/?series=461852.

Regards,
Amelie



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux