Message ID | 20210907044527.2137211-1-linux@roeck-us.net (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | usb: ehci: Simplify platform driver registration | expand |
Hi Guenter, I love your patch! Yet something to improve: [auto build test ERROR on usb/usb-testing] [also build test ERROR on v5.14 next-20210907] [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/Guenter-Roeck/usb-ehci-Simplify-platform-driver-registration/20210907-124747 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: x86_64-randconfig-a011-20210906 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 9c476172b93367d2cb88d7d3f4b1b5b456fa6020) 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 # https://github.com/0day-ci/linux/commit/bd9aa6646a29d48171474905fedca85ac7ff6ce5 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Guenter-Roeck/usb-ehci-Simplify-platform-driver-registration/20210907-124747 git checkout bd9aa6646a29d48171474905fedca85ac7ff6ce5 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 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 >>): >> drivers/usb/host/ehci-hcd.c:1340:11: error: implicit declaration of function 'platform_register_drivers' [-Werror,-Wimplicit-function-declaration] retval = platform_register_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); ^ >> drivers/usb/host/ehci-hcd.c:1357:2: error: implicit declaration of function 'platform_unregister_drivers' [-Werror,-Wimplicit-function-declaration] platform_unregister_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); ^ drivers/usb/host/ehci-hcd.c:1357:2: note: did you mean 'pci_unregister_driver'? include/linux/pci.h:1433:6: note: 'pci_unregister_driver' declared here void pci_unregister_driver(struct pci_driver *dev); ^ 2 errors generated. Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for SND_SOC_MT6359 Depends on SOUND && !UML && SND && SND_SOC && MTK_PMIC_WRAP Selected by - SND_SOC_MT8195_MT6359_RT1019_RT5682 && SOUND && !UML && SND && SND_SOC && I2C && SND_SOC_MT8195 vim +/platform_register_drivers +1340 drivers/usb/host/ehci-hcd.c 1339 > 1340 retval = platform_register_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); 1341 if (retval < 0) 1342 goto clean0; 1343 return 0; 1344 1345 clean0: 1346 #ifdef CONFIG_DYNAMIC_DEBUG 1347 debugfs_remove(ehci_debug_root); 1348 ehci_debug_root = NULL; 1349 #endif 1350 clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded); 1351 return retval; 1352 } 1353 module_init(ehci_hcd_init); 1354 1355 static void __exit ehci_hcd_cleanup(void) 1356 { > 1357 platform_unregister_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Guenter, I love your patch! Yet something to improve: [auto build test ERROR on usb/usb-testing] [also build test ERROR on v5.14 next-20210907] [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/Guenter-Roeck/usb-ehci-Simplify-platform-driver-registration/20210907-124747 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: alpha-randconfig-r023-20210906 (attached as .config) compiler: alpha-linux-gcc (GCC) 11.2.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 # https://github.com/0day-ci/linux/commit/bd9aa6646a29d48171474905fedca85ac7ff6ce5 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Guenter-Roeck/usb-ehci-Simplify-platform-driver-registration/20210907-124747 git checkout bd9aa6646a29d48171474905fedca85ac7ff6ce5 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=alpha 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 >>): drivers/usb/host/ehci-hcd.c: In function 'ehci_hcd_init': >> drivers/usb/host/ehci-hcd.c:1340:18: error: implicit declaration of function 'platform_register_drivers'; did you mean 'pci_register_driver'? [-Werror=implicit-function-declaration] 1340 | retval = platform_register_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); | ^~~~~~~~~~~~~~~~~~~~~~~~~ | pci_register_driver drivers/usb/host/ehci-hcd.c: In function 'ehci_hcd_cleanup': >> drivers/usb/host/ehci-hcd.c:1357:9: error: implicit declaration of function 'platform_unregister_drivers'; did you mean 'pci_unregister_driver'? [-Werror=implicit-function-declaration] 1357 | platform_unregister_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | pci_unregister_driver cc1: some warnings being treated as errors vim +1340 drivers/usb/host/ehci-hcd.c 1339 > 1340 retval = platform_register_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); 1341 if (retval < 0) 1342 goto clean0; 1343 return 0; 1344 1345 clean0: 1346 #ifdef CONFIG_DYNAMIC_DEBUG 1347 debugfs_remove(ehci_debug_root); 1348 ehci_debug_root = NULL; 1349 #endif 1350 clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded); 1351 return retval; 1352 } 1353 module_init(ehci_hcd_init); 1354 1355 static void __exit ehci_hcd_cleanup(void) 1356 { > 1357 platform_unregister_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 6bdc6d6bf74d..8a32a9531ad2 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1278,29 +1278,42 @@ MODULE_LICENSE ("GPL"); #ifdef CONFIG_USB_EHCI_SH #include "ehci-sh.c" -#define PLATFORM_DRIVER ehci_hcd_sh_driver #endif #ifdef CONFIG_PPC_PS3 #include "ehci-ps3.c" -#define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver #endif #ifdef CONFIG_USB_EHCI_HCD_PPC_OF #include "ehci-ppc-of.c" -#define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver #endif #ifdef CONFIG_XPS_USB_HCD_XILINX #include "ehci-xilinx-of.c" -#define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver #endif #ifdef CONFIG_SPARC_LEON #include "ehci-grlib.c" -#define PLATFORM_DRIVER ehci_grlib_driver #endif +static struct platform_driver * const platform_drivers[] = { +#ifdef CONFIG_USB_EHCI_SH + &ehci_hcd_sh_driver, +#endif +#ifdef CONFIG_PPC_PS3 + &ps3_ehci_driver, +#endif +#ifdef CONFIG_USB_EHCI_HCD_PPC_OF + &ehci_hcd_ppc_of_driver, +#endif +#ifdef CONFIG_XPS_USB_HCD_XILINX + &ehci_hcd_xilinx_of_driver, +#endif +#ifdef CONFIG_SPARC_LEON + &ehci_grlib_driver, +#endif +}; + static int __init ehci_hcd_init(void) { int retval = 0; @@ -1324,47 +1337,12 @@ static int __init ehci_hcd_init(void) ehci_debug_root = debugfs_create_dir("ehci", usb_debug_root); #endif -#ifdef PLATFORM_DRIVER - retval = platform_driver_register(&PLATFORM_DRIVER); + retval = platform_register_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); if (retval < 0) goto clean0; -#endif - -#ifdef PS3_SYSTEM_BUS_DRIVER - retval = ps3_ehci_driver_register(&PS3_SYSTEM_BUS_DRIVER); - if (retval < 0) - goto clean2; -#endif - -#ifdef OF_PLATFORM_DRIVER - retval = platform_driver_register(&OF_PLATFORM_DRIVER); - if (retval < 0) - goto clean3; -#endif - -#ifdef XILINX_OF_PLATFORM_DRIVER - retval = platform_driver_register(&XILINX_OF_PLATFORM_DRIVER); - if (retval < 0) - goto clean4; -#endif - return retval; + return 0; -#ifdef XILINX_OF_PLATFORM_DRIVER - /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */ -clean4: -#endif -#ifdef OF_PLATFORM_DRIVER - platform_driver_unregister(&OF_PLATFORM_DRIVER); -clean3: -#endif -#ifdef PS3_SYSTEM_BUS_DRIVER - ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); -clean2: -#endif -#ifdef PLATFORM_DRIVER - platform_driver_unregister(&PLATFORM_DRIVER); clean0: -#endif #ifdef CONFIG_DYNAMIC_DEBUG debugfs_remove(ehci_debug_root); ehci_debug_root = NULL; @@ -1376,18 +1354,7 @@ module_init(ehci_hcd_init); static void __exit ehci_hcd_cleanup(void) { -#ifdef XILINX_OF_PLATFORM_DRIVER - platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); -#endif -#ifdef OF_PLATFORM_DRIVER - platform_driver_unregister(&OF_PLATFORM_DRIVER); -#endif -#ifdef PLATFORM_DRIVER - platform_driver_unregister(&PLATFORM_DRIVER); -#endif -#ifdef PS3_SYSTEM_BUS_DRIVER - ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); -#endif + platform_unregister_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); #ifdef CONFIG_DYNAMIC_DEBUG debugfs_remove(ehci_debug_root); #endif
Use platform_register_drivers() and platform_unregister_drivers() to register and unregister ehci platform drivers. This simplifies the code and prevents the following build errors seen with sparc:allmodconfig. drivers/usb/host/ehci-hcd.c:1301: error: "PLATFORM_DRIVER" redefined drivers/usb/host/ehci-sh.c:173:31: error: 'ehci_hcd_sh_driver' defined but not used Signed-off-by: Guenter Roeck <linux@roeck-us.net> --- drivers/usb/host/ehci-hcd.c | 75 +++++++++++-------------------------- 1 file changed, 21 insertions(+), 54 deletions(-)