Hi, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [cannot apply to v5.3-rc3 next-20190807] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/jun-li-nxp-com/usb-chipidea-replace-ci_role-with-usb_role/20190807-185922 config: x86_64-randconfig-c002-201931 (attached as .config) compiler: gcc-7 (Debian 7.4.0-10) 7.4.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): ld: drivers/usb/chipidea/core.o: in function `ci_hdrc_remove': >> drivers/usb/chipidea/core.c:1196: undefined reference to `usb_role_switch_unregister' ld: drivers/usb/chipidea/core.o: in function `ci_hdrc_probe': >> drivers/usb/chipidea/core.c:1146: undefined reference to `usb_role_switch_register' vim +1196 drivers/usb/chipidea/core.c 986 987 static int ci_hdrc_probe(struct platform_device *pdev) 988 { 989 struct device *dev = &pdev->dev; 990 struct ci_hdrc *ci; 991 struct resource *res; 992 void __iomem *base; 993 int ret; 994 enum usb_dr_mode dr_mode; 995 996 if (!dev_get_platdata(dev)) { 997 dev_err(dev, "platform data missing\n"); 998 return -ENODEV; 999 } 1000 1001 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1002 base = devm_ioremap_resource(dev, res); 1003 if (IS_ERR(base)) 1004 return PTR_ERR(base); 1005 1006 ci = devm_kzalloc(dev, sizeof(*ci), GFP_KERNEL); 1007 if (!ci) 1008 return -ENOMEM; 1009 1010 spin_lock_init(&ci->lock); 1011 ci->dev = dev; 1012 ci->platdata = dev_get_platdata(dev); 1013 ci->imx28_write_fix = !!(ci->platdata->flags & 1014 CI_HDRC_IMX28_WRITE_FIX); 1015 ci->supports_runtime_pm = !!(ci->platdata->flags & 1016 CI_HDRC_SUPPORTS_RUNTIME_PM); 1017 platform_set_drvdata(pdev, ci); 1018 1019 ret = hw_device_init(ci, base); 1020 if (ret < 0) { 1021 dev_err(dev, "can't initialize hardware\n"); 1022 return -ENODEV; 1023 } 1024 1025 ret = ci_ulpi_init(ci); 1026 if (ret) 1027 return ret; 1028 1029 if (ci->platdata->phy) { 1030 ci->phy = ci->platdata->phy; 1031 } else if (ci->platdata->usb_phy) { 1032 ci->usb_phy = ci->platdata->usb_phy; 1033 } else { 1034 /* Look for a generic PHY first */ 1035 ci->phy = devm_phy_get(dev->parent, "usb-phy"); 1036 1037 if (PTR_ERR(ci->phy) == -EPROBE_DEFER) { 1038 ret = -EPROBE_DEFER; 1039 goto ulpi_exit; 1040 } else if (IS_ERR(ci->phy)) { 1041 ci->phy = NULL; 1042 } 1043 1044 /* Look for a legacy USB PHY from device-tree next */ 1045 if (!ci->phy) { 1046 ci->usb_phy = devm_usb_get_phy_by_phandle(dev->parent, 1047 "phys", 0); 1048 1049 if (PTR_ERR(ci->usb_phy) == -EPROBE_DEFER) { 1050 ret = -EPROBE_DEFER; 1051 goto ulpi_exit; 1052 } else if (IS_ERR(ci->usb_phy)) { 1053 ci->usb_phy = NULL; 1054 } 1055 } 1056 1057 /* Look for any registered legacy USB PHY as last resort */ 1058 if (!ci->phy && !ci->usb_phy) { 1059 ci->usb_phy = devm_usb_get_phy(dev->parent, 1060 USB_PHY_TYPE_USB2); 1061 1062 if (PTR_ERR(ci->usb_phy) == -EPROBE_DEFER) { 1063 ret = -EPROBE_DEFER; 1064 goto ulpi_exit; 1065 } else if (IS_ERR(ci->usb_phy)) { 1066 ci->usb_phy = NULL; 1067 } 1068 } 1069 1070 /* No USB PHY was found in the end */ 1071 if (!ci->phy && !ci->usb_phy) { 1072 ret = -ENXIO; 1073 goto ulpi_exit; 1074 } 1075 } 1076 1077 ret = ci_usb_phy_init(ci); 1078 if (ret) { 1079 dev_err(dev, "unable to init phy: %d\n", ret); 1080 return ret; 1081 } 1082 1083 ci->hw_bank.phys = res->start; 1084 1085 ci->irq = platform_get_irq(pdev, 0); 1086 if (ci->irq < 0) { 1087 dev_err(dev, "missing IRQ\n"); 1088 ret = ci->irq; 1089 goto deinit_phy; 1090 } 1091 1092 ci_get_otg_capable(ci); 1093 1094 dr_mode = ci->platdata->dr_mode; 1095 /* initialize role(s) before the interrupt is requested */ 1096 if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) { 1097 ret = ci_hdrc_host_init(ci); 1098 if (ret) { 1099 if (ret == -ENXIO) 1100 dev_info(dev, "doesn't support host\n"); 1101 else 1102 goto deinit_phy; 1103 } 1104 } 1105 1106 if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) { 1107 ret = ci_hdrc_gadget_init(ci); 1108 if (ret) { 1109 if (ret == -ENXIO) 1110 dev_info(dev, "doesn't support gadget\n"); 1111 else 1112 goto deinit_host; 1113 } 1114 } 1115 1116 if (!ci->roles[USB_ROLE_HOST] && !ci->roles[USB_ROLE_DEVICE]) { 1117 dev_err(dev, "no supported roles\n"); 1118 ret = -ENODEV; 1119 goto deinit_gadget; 1120 } 1121 1122 if (ci->is_otg && ci->roles[USB_ROLE_DEVICE]) { 1123 ret = ci_hdrc_otg_init(ci); 1124 if (ret) { 1125 dev_err(dev, "init otg fails, ret = %d\n", ret); 1126 goto deinit_gadget; 1127 } 1128 } 1129 1130 if (!ci_role_switch.fwnode) { 1131 ret = ci_start_initial_role(ci); 1132 if (ret) 1133 goto stop; 1134 } 1135 1136 ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED, 1137 ci->platdata->name, ci); 1138 if (ret) 1139 goto stop; 1140 1141 ret = ci_extcon_register(ci); 1142 if (ret) 1143 goto stop; 1144 1145 if (ci_role_switch.fwnode) { > 1146 ci->role_switch = usb_role_switch_register(dev, 1147 &ci_role_switch); 1148 if (IS_ERR(ci->role_switch)) { 1149 ret = PTR_ERR(ci->role_switch); 1150 goto stop; 1151 } 1152 } 1153 1154 if (ci->supports_runtime_pm) { 1155 pm_runtime_set_active(&pdev->dev); 1156 pm_runtime_enable(&pdev->dev); 1157 pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); 1158 pm_runtime_mark_last_busy(ci->dev); 1159 pm_runtime_use_autosuspend(&pdev->dev); 1160 } 1161 1162 if (ci_otg_is_fsm_mode(ci)) 1163 ci_hdrc_otg_fsm_start(ci); 1164 1165 device_set_wakeup_capable(&pdev->dev, true); 1166 dbg_create_files(ci); 1167 1168 ret = sysfs_create_group(&dev->kobj, &ci_attr_group); 1169 if (ret) 1170 goto remove_debug; 1171 1172 return 0; 1173 1174 remove_debug: 1175 dbg_remove_files(ci); 1176 stop: 1177 if (ci->is_otg && ci->roles[USB_ROLE_DEVICE]) 1178 ci_hdrc_otg_destroy(ci); 1179 deinit_gadget: 1180 ci_hdrc_gadget_destroy(ci); 1181 deinit_host: 1182 ci_hdrc_host_destroy(ci); 1183 deinit_phy: 1184 ci_usb_phy_exit(ci); 1185 ulpi_exit: 1186 ci_ulpi_exit(ci); 1187 1188 return ret; 1189 } 1190 1191 static int ci_hdrc_remove(struct platform_device *pdev) 1192 { 1193 struct ci_hdrc *ci = platform_get_drvdata(pdev); 1194 1195 if (ci->role_switch) > 1196 usb_role_switch_unregister(ci->role_switch); 1197 1198 if (ci->supports_runtime_pm) { 1199 pm_runtime_get_sync(&pdev->dev); 1200 pm_runtime_disable(&pdev->dev); 1201 pm_runtime_put_noidle(&pdev->dev); 1202 } 1203 1204 dbg_remove_files(ci); 1205 sysfs_remove_group(&ci->dev->kobj, &ci_attr_group); 1206 ci_role_destroy(ci); 1207 ci_hdrc_enter_lpm(ci, true); 1208 ci_usb_phy_exit(ci); 1209 ci_ulpi_exit(ci); 1210 1211 return 0; 1212 } 1213 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip