drivers/usb/dwc3/drd.c:508: undefined reference to `usb_role_switch_get_drvdata'

From: kbuild test robot
Date: Tue Jun 02 2020 - 17:07:43 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 194098915ac74daddca9d6ed46fd11be57f45e16
commit: 0339f7fbc82efb66504ededc49502856dccbfccf usb: dwc3: fix up for role switch API change
date: 3 months ago
config: ia64-randconfig-r013-20200602 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 0339f7fbc82efb66504ededc49502856dccbfccf
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64

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

All errors (new ones prefixed by >>, old ones prefixed by <<):

ia64-linux-ld: arch/ia64/kernel/elfcore.o: in function `elf_core_write_extra_phdrs':
arch/ia64/kernel/elfcore.c:38: undefined reference to `dump_emit'
ia64-linux-ld: arch/ia64/kernel/elfcore.o: in function `elf_core_write_extra_data':
arch/ia64/kernel/elfcore.c:55: undefined reference to `dump_emit'
ia64-linux-ld: drivers/usb/dwc3/drd.o: in function `dwc3_usb_role_switch_get':
>> drivers/usb/dwc3/drd.c:508: undefined reference to `usb_role_switch_get_drvdata'
ia64-linux-ld: drivers/usb/dwc3/drd.o: in function `dwc3_usb_role_switch_set':
drivers/usb/dwc3/drd.c:484: undefined reference to `usb_role_switch_get_drvdata'
ia64-linux-ld: drivers/usb/dwc3/drd.o: in function `dwc3_setup_role_switch':
>> drivers/usb/dwc3/drd.c:555: undefined reference to `usb_role_switch_register'
ia64-linux-ld: drivers/usb/dwc3/drd.o: in function `dwc3_drd_exit':
>> drivers/usb/dwc3/drd.c:628: undefined reference to `usb_role_switch_unregister'

vim +508 drivers/usb/dwc3/drd.c

505
506 static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
507 {
> 508 struct dwc3 *dwc = usb_role_switch_get_drvdata(sw);
509 unsigned long flags;
510 enum usb_role role;
511
512 spin_lock_irqsave(&dwc->lock, flags);
513 switch (dwc->current_dr_role) {
514 case DWC3_GCTL_PRTCAP_HOST:
515 role = USB_ROLE_HOST;
516 break;
517 case DWC3_GCTL_PRTCAP_DEVICE:
518 role = USB_ROLE_DEVICE;
519 break;
520 case DWC3_GCTL_PRTCAP_OTG:
521 role = dwc->current_otg_role;
522 break;
523 default:
524 if (dwc->role_switch_default_mode == USB_DR_MODE_HOST)
525 role = USB_ROLE_HOST;
526 else
527 role = USB_ROLE_DEVICE;
528 break;
529 }
530 spin_unlock_irqrestore(&dwc->lock, flags);
531 return role;
532 }
533
534 static int dwc3_setup_role_switch(struct dwc3 *dwc)
535 {
536 struct usb_role_switch_desc dwc3_role_switch = {NULL};
537 const char *str;
538 u32 mode;
539 int ret;
540
541 ret = device_property_read_string(dwc->dev, "role-switch-default-mode",
542 &str);
543 if (ret >= 0 && !strncmp(str, "host", strlen("host"))) {
544 dwc->role_switch_default_mode = USB_DR_MODE_HOST;
545 mode = DWC3_GCTL_PRTCAP_HOST;
546 } else {
547 dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
548 mode = DWC3_GCTL_PRTCAP_DEVICE;
549 }
550
551 dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
552 dwc3_role_switch.set = dwc3_usb_role_switch_set;
553 dwc3_role_switch.get = dwc3_usb_role_switch_get;
554 dwc3_role_switch.driver_data = dwc;
> 555 dwc->role_sw = usb_role_switch_register(dwc->dev, &dwc3_role_switch);
556 if (IS_ERR(dwc->role_sw))
557 return PTR_ERR(dwc->role_sw);
558
559 dwc3_set_mode(dwc, mode);
560 return 0;
561 }
562 #else
563 #define ROLE_SWITCH 0
564 #define dwc3_setup_role_switch(x) 0
565 #endif
566
567 int dwc3_drd_init(struct dwc3 *dwc)
568 {
569 int ret, irq;
570
571 dwc->edev = dwc3_get_extcon(dwc);
572 if (IS_ERR(dwc->edev))
573 return PTR_ERR(dwc->edev);
574
575 if (ROLE_SWITCH &&
576 device_property_read_bool(dwc->dev, "usb-role-switch")) {
577 ret = dwc3_setup_role_switch(dwc);
578 if (ret < 0)
579 return ret;
580 } else if (dwc->edev) {
581 dwc->edev_nb.notifier_call = dwc3_drd_notifier;
582 ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,
583 &dwc->edev_nb);
584 if (ret < 0) {
585 dev_err(dwc->dev, "couldn't register cable notifier\n");
586 return ret;
587 }
588
589 dwc3_drd_update(dwc);
590 } else {
591 dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG);
592 dwc->current_dr_role = DWC3_GCTL_PRTCAP_OTG;
593
594 /* use OTG block to get ID event */
595 irq = dwc3_otg_get_irq(dwc);
596 if (irq < 0)
597 return irq;
598
599 dwc->otg_irq = irq;
600
601 /* disable all OTG IRQs */
602 dwc3_otg_disable_events(dwc, DWC3_OTG_ALL_EVENTS);
603 /* clear all events */
604 dwc3_otg_clear_events(dwc);
605
606 ret = request_threaded_irq(dwc->otg_irq, dwc3_otg_irq,
607 dwc3_otg_thread_irq,
608 IRQF_SHARED, "dwc3-otg", dwc);
609 if (ret) {
610 dev_err(dwc->dev, "failed to request irq #%d --> %d\n",
611 dwc->otg_irq, ret);
612 ret = -ENODEV;
613 return ret;
614 }
615
616 dwc3_otg_init(dwc);
617 dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG);
618 }
619
620 return 0;
621 }
622
623 void dwc3_drd_exit(struct dwc3 *dwc)
624 {
625 unsigned long flags;
626
627 if (dwc->role_sw)
> 628 usb_role_switch_unregister(dwc->role_sw);

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

Attachment: .config.gz
Description: application/gzip