The explicit init and exit functions don't do anything special. Just use
the macro.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
drivers/net/ethernet/lantiq_etop.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 3e9937c7371a..1458796c4e30 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -686,24 +686,7 @@ static struct platform_driver ltq_mii_driver = {
},
};
-static int __init
-init_ltq_etop(void)
-{
- int ret = platform_driver_probe(<q_mii_driver, ltq_etop_probe);
-
- if (ret)
- pr_err("ltq_etop: Error registering platform driver!");
- return ret;
-}
-
-static void __exit
-exit_ltq_etop(void)
-{
- platform_driver_unregister(<q_mii_driver);
-}
-
-module_init(init_ltq_etop);
-module_exit(exit_ltq_etop);
+module_platform_driver_probe(<q_mii_driver, ltq_etop_probe);
MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
MODULE_DESCRIPTION("Lantiq SoC ETOP");
--
2.46.2
Hi Rosen, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/net-lantiq_etop-use-netif_receive_skb_list/20241002-025104 base: net-next/main patch link: https://lore.kernel.org/r/20241001184607.193461-9-rosenp%40gmail.com patch subject: [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe config: mips-xway_defconfig (https://download.01.org/0day-ci/archive/20241004/202410040710.C5horFtF-lkp@intel.com/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241004/202410040710.C5horFtF-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202410040710.C5horFtF-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from drivers/net/ethernet/lantiq_etop.c:14: In file included from include/linux/netdevice.h:38: In file included from include/net/net_namespace.h:43: In file included from include/linux/skbuff.h:17: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:8: In file included from include/linux/cacheflush.h:5: In file included from arch/mips/include/asm/cacheflush.h:13: In file included from include/linux/mm.h:2213: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ >> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected identifier or '(' 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^ >> drivers/net/ethernet/lantiq_etop.c:689:1: error: pasting formed '_&', an invalid preprocessing token 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^ include/linux/platform_device.h:324:3: note: expanded from macro 'module_platform_driver_probe' 324 | } \ | ^ include/linux/module.h:88:24: note: expanded from macro '\ module_init' 88 | #define module_init(x) __initcall(x); | ^ include/linux/init.h:316:24: note: expanded from macro '__initcall' 316 | #define __initcall(fn) device_initcall(fn) | ^ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/init.h:214:2: note: expanded from macro '__initcall_id' 214 | __PASTE(_, fn)))))) | ^ include/linux/compiler_types.h:84:22: note: expanded from macro '__PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^ include/linux/compiler_types.h:83:24: note: expanded from macro '___PASTE' 83 | #define ___PASTE(a,b) a##b | ^ >> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected ';' after top level declarator 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^ >> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected identifier or '(' >> drivers/net/ethernet/lantiq_etop.c:689:1: error: pasting formed '__exitcall_&', an invalid preprocessing token 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^ include/linux/platform_device.h:329:3: note: expanded from macro 'module_platform_driver_probe' 329 | } \ | ^ include/linux/module.h:100:24: note: expanded from macro '\ module_exit' 100 | #define module_exit(x) __exitcall(x); | ^ include/linux/init.h:319:31: note: expanded from macro '__exitcall' 319 | static exitcall_t __exitcall_##fn __exit_call = fn | ^ >> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected ';' after top level declarator 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^ 1 warning and 6 errors generated. vim +689 drivers/net/ethernet/lantiq_etop.c 688 > 689 module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); 690 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Rosen, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/net-lantiq_etop-use-netif_receive_skb_list/20241002-025104 base: net-next/main patch link: https://lore.kernel.org/r/20241001184607.193461-9-rosenp%40gmail.com patch subject: [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe config: mips-xway_defconfig (https://download.01.org/0day-ci/archive/20241004/202410040101.1HX2nS2j-lkp@intel.com/config) compiler: mips-linux-gcc (GCC) 13.3.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241004/202410040101.1HX2nS2j-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202410040101.1HX2nS2j-lkp@intel.com/ All error/warnings (new ones prefixed by >>): In file included from drivers/net/ethernet/lantiq_etop.c:21: >> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected identifier or '(' before '&' token 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^ include/linux/platform_device.h:320:19: note: in definition of macro 'module_platform_driver_probe' 320 | static int __init __platform_driver##_init(void) \ | ^~~~~~~~~~~~~~~~~ In file included from <command-line>: >> include/linux/init.h:214:17: error: pasting "_" and "&" does not give a valid preprocessing token 214 | __PASTE(_, fn)))))) | ^ include/linux/compiler_types.h:83:23: note: in definition of macro '___PASTE' 83 | #define ___PASTE(a,b) a##b | ^ include/linux/init.h:214:9: note: in expansion of macro '__PASTE' 214 | __PASTE(_, fn)))))) | ^~~~~~~ include/linux/init.h:280:42: note: in expansion of macro '__initcall_id' 280 | __unique_initcall(fn, id, __sec, __initcall_id(fn)) | ^~~~~~~~~~~~~ include/linux/init.h:282:35: note: in expansion of macro '___define_initcall' 282 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id) | ^~~~~~~~~~~~~~~~~~ include/linux/init.h:311:41: note: in expansion of macro '__define_initcall' 311 | #define device_initcall(fn) __define_initcall(fn, 6) | ^~~~~~~~~~~~~~~~~ include/linux/init.h:316:24: note: in expansion of macro 'device_initcall' 316 | #define __initcall(fn) device_initcall(fn) | ^~~~~~~~~~~~~~~ include/linux/module.h:88:25: note: in expansion of macro '__initcall' 88 | #define module_init(x) __initcall(x); | ^~~~~~~~~~ include/linux/platform_device.h:325:1: note: in expansion of macro 'module_init' 325 | module_init(__platform_driver##_init); \ | ^~~~~~~~~~~ drivers/net/ethernet/lantiq_etop.c:689:1: note: in expansion of macro 'module_platform_driver_probe' 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/printk.h:6, from include/linux/kernel.h:31, from drivers/net/ethernet/lantiq_etop.c:7: >> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^ include/linux/init.h:269:27: note: in definition of macro '____define_initcall' 269 | static initcall_t __name __used \ | ^~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:218:9: note: in expansion of macro '__PASTE' 218 | __PASTE(__, \ | ^~~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:219:9: note: in expansion of macro '__PASTE' 219 | __PASTE(prefix, \ | ^~~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:220:9: note: in expansion of macro '__PASTE' 220 | __PASTE(__, \ | ^~~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:221:9: note: in expansion of macro '__PASTE' 221 | __PASTE(__iid, id)))) | ^~~~~~~ include/linux/init.h:276:17: note: in expansion of macro '__initcall_name' 276 | __initcall_name(initcall, __iid, id), \ | ^~~~~~~~~~~~~~~ include/linux/init.h:280:9: note: in expansion of macro '__unique_initcall' 280 | __unique_initcall(fn, id, __sec, __initcall_id(fn)) | ^~~~~~~~~~~~~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:209:9: note: in expansion of macro '__PASTE' 209 | __PASTE(__KBUILD_MODNAME, \ | ^~~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:210:9: note: in expansion of macro '__PASTE' 210 | __PASTE(__, \ | ^~~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:211:9: note: in expansion of macro '__PASTE' 211 | __PASTE(__COUNTER__, \ | ^~~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:212:9: note: in expansion of macro '__PASTE' 212 | __PASTE(_, \ | ^~~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:213:9: note: in expansion of macro '__PASTE' 213 | __PASTE(__LINE__, \ | ^~~~~~~ include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE' 84 | #define __PASTE(a,b) ___PASTE(a,b) | ^~~~~~~~ include/linux/init.h:214:9: note: in expansion of macro '__PASTE' 214 | __PASTE(_, fn)))))) | ^~~~~~~ include/linux/init.h:280:42: note: in expansion of macro '__initcall_id' 280 | __unique_initcall(fn, id, __sec, __initcall_id(fn)) | ^~~~~~~~~~~~~ include/linux/init.h:282:35: note: in expansion of macro '___define_initcall' 282 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id) | ^~~~~~~~~~~~~~~~~~ include/linux/init.h:311:41: note: in expansion of macro '__define_initcall' 311 | #define device_initcall(fn) __define_initcall(fn, 6) | ^~~~~~~~~~~~~~~~~ include/linux/init.h:316:24: note: in expansion of macro 'device_initcall' 316 | #define __initcall(fn) device_initcall(fn) | ^~~~~~~~~~~~~~~ include/linux/module.h:88:25: note: in expansion of macro '__initcall' 88 | #define module_init(x) __initcall(x); | ^~~~~~~~~~ include/linux/platform_device.h:325:1: note: in expansion of macro 'module_init' 325 | module_init(__platform_driver##_init); \ | ^~~~~~~~~~~ drivers/net/ethernet/lantiq_etop.c:689:1: note: in expansion of macro 'module_platform_driver_probe' 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected identifier or '(' before '&' token 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^ include/linux/platform_device.h:326:20: note: in definition of macro 'module_platform_driver_probe' 326 | static void __exit __platform_driver##_exit(void) \ | ^~~~~~~~~~~~~~~~~ >> include/linux/init.h:319:27: error: pasting "__exitcall_" and "&" does not give a valid preprocessing token 319 | static exitcall_t __exitcall_##fn __exit_call = fn | ^~~~~~~~~~~ include/linux/module.h:100:25: note: in expansion of macro '__exitcall' 100 | #define module_exit(x) __exitcall(x); | ^~~~~~~~~~ include/linux/platform_device.h:330:1: note: in expansion of macro 'module_exit' 330 | module_exit(__platform_driver##_exit); | ^~~~~~~~~~~ drivers/net/ethernet/lantiq_etop.c:689:1: note: in expansion of macro 'module_platform_driver_probe' 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^ include/linux/init.h:319:40: note: in definition of macro '__exitcall' 319 | static exitcall_t __exitcall_##fn __exit_call = fn | ^~ include/linux/platform_device.h:330:1: note: in expansion of macro 'module_exit' 330 | module_exit(__platform_driver##_exit); | ^~~~~~~~~~~ drivers/net/ethernet/lantiq_etop.c:689:1: note: in expansion of macro 'module_platform_driver_probe' 689 | module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/net/ethernet/lantiq_etop.c:682:31: warning: 'ltq_mii_driver' defined but not used [-Wunused-variable] 682 | static struct platform_driver ltq_mii_driver = { | ^~~~~~~~~~~~~~ >> drivers/net/ethernet/lantiq_etop.c:618:1: warning: 'ltq_etop_probe' defined but not used [-Wunused-function] 618 | ltq_etop_probe(struct platform_device *pdev) | ^~~~~~~~~~~~~~ vim +689 drivers/net/ethernet/lantiq_etop.c 616 617 static int __init > 618 ltq_etop_probe(struct platform_device *pdev) 619 { 620 struct net_device *dev; 621 struct ltq_etop_priv *priv; 622 int err; 623 int i; 624 625 ltq_etop_membase = devm_platform_ioremap_resource(pdev, 0); 626 if (IS_ERR(ltq_etop_membase)) { 627 dev_err(&pdev->dev, "failed to remap etop engine %d", pdev->id); 628 return PTR_ERR(ltq_etop_membase); 629 } 630 631 dev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct ltq_etop_priv), 632 4, 4); 633 if (!dev) 634 return -ENOMEM; 635 dev->netdev_ops = <q_eth_netdev_ops; 636 dev->ethtool_ops = <q_etop_ethtool_ops; 637 priv = netdev_priv(dev); 638 priv->pdev = pdev; 639 priv->pldata = dev_get_platdata(&pdev->dev); 640 priv->netdev = dev; 641 spin_lock_init(&priv->lock); 642 SET_NETDEV_DEV(dev, &pdev->dev); 643 644 err = device_property_read_u32(&pdev->dev, "lantiq,tx-burst-length", &priv->tx_burst_len); 645 if (err < 0) 646 return dev_err_probe(&pdev->dev, err, 647 "unable to read tx-burst-length property"); 648 649 err = device_property_read_u32(&pdev->dev, "lantiq,rx-burst-length", &priv->rx_burst_len); 650 if (err < 0) 651 return dev_err_probe(&pdev->dev, err, 652 "unable to read rx-burst-length property"); 653 654 for (i = 0; i < MAX_DMA_CHAN; i++) { 655 if (IS_TX(i)) 656 netif_napi_add_weight(dev, &priv->ch[i].napi, 657 ltq_etop_poll_tx, 8); 658 else if (IS_RX(i)) 659 netif_napi_add_weight(dev, &priv->ch[i].napi, 660 ltq_etop_poll_rx, 32); 661 priv->ch[i].netdev = dev; 662 } 663 664 err = devm_register_netdev(&pdev->dev, dev); 665 if (err) 666 return err; 667 668 platform_set_drvdata(pdev, dev); 669 return 0; 670 } 671 672 static void ltq_etop_remove(struct platform_device *pdev) 673 { 674 struct net_device *dev = platform_get_drvdata(pdev); 675 676 if (dev) { 677 netif_tx_stop_all_queues(dev); 678 ltq_etop_hw_exit(dev); 679 } 680 } 681 > 682 static struct platform_driver ltq_mii_driver = { 683 .remove_new = ltq_etop_remove, 684 .driver = { 685 .name = "ltq_etop", 686 }, 687 }; 688 > 689 module_platform_driver_probe(<q_mii_driver, ltq_etop_probe); 690 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
© 2016 - 2024 Red Hat, Inc.