net :ethernet : replace cleanup_module with __exit()
Subsystems (2)
PATCH 1/1 net :ethernet : replace cleanup_module with __exit()
update old legacy cleanup_module function from the file with __exit module as per kernel code practices.
The file had an old cleanup_module function still in use which could be updated with __exit function all though its init_module is indeed newer however the cleanup_module was still using the older version of exit.
To set proper exit module function replace cleanup_module with __exit() corkscrew_exit_module to align it to the kernel code consistency.
--- drivers/net/ethernet/3com/3c515.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/3com/3c515.c +2 -4
@@ -1547,9 +1547,7 @@ static const struct ethtool_ops netdev_ethtool_ops = { .set_msglevel = netdev_set_msglevel, }; - -#ifdef MODULE -void cleanup_module (void ) +static void __exit corkscrew_exit_module(void) {while (!list_empty (&root_corkscrew_dev)) {struct net_device *dev;
@@ -1563,4 +1561,4 @@ void cleanup_module(void)free_netdev (dev); } } -#endif /* MODULE */ +module_exit (corkscrew_exit_module);
--
2.51.0
Simon Horman
reviewerQuoted 33 lines · Shi Hao
update old legacy
cleanup_modulefunction from the file with__exitmodule as per kernel code practices.The file had an old
cleanup_modulefunction still in use which could be updated with__exitfunction all though itsinit_moduleis indeed newer however thecleanup_modulewas still using the older version of exit.To set proper exit module function replace
cleanup_modulewith__exit()corkscrew_exit_moduleto align it to the kernel code consistency.Signed-off-by Shi Hao <[email protected]>--- drivers/net/ethernet/3com/3c515.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/net/ethernet/3com/3c515.c +1
-3@@ -1547,9 +1547,7 @@ static const struct ethtool_ops netdev_ethtool_ops = { .set_msglevel = netdev_set_msglevel, }; - -#ifdef MODULE -void cleanup_module (void ) +static void __exit corkscrew_exit_module(void) {while (!list_empty (&root_corkscrew_dev)) {struct net_device *dev;
drivers/net/ethernet/3com/3c515.c void cleanup_module(void) · line 1564
Quoted 5 lines
drivers/net/ethernet/3com/3c515.c +1
-1@@ -1563,4 +1561,4 @@ void cleanup_module(void)free_netdev (dev); } } -#endif /* MODULE */ +module_exit (corkscrew_exit_module);
Hi Shi Hao,
Thanks for your patch.
Unfortunately this does not compile as a built-in because
is only defined (and initialised) when this driver is configured as a module.
I was able to verify this using a configuration generated like this:
ARCH=arm make footbridge_defconfig
echo "CONFIG_3C515=y" >> .config
ARCH=arm make oldconfig
And building using the GCC 15.2.0 toolchain available here
https://mirrors.edge.kernel.org/pub/tools/crosstool/
Also, looking at git history, I think that '3c515:' would be an appropriate prefix for this patch.
Subject: [PATCH net-next v2] 3c515: ...
And if you do post an update, please be sure to observe the 24h rule.
https://docs.kernel.org/process/maintainer-netdev.html
Thanks!
Signature · 1 line
pw-bot: changes-requested
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Shi,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on horms-ipvs/master v6.18-rc1 next-20251016] [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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shi-Hao/net-ethernet-replace-cleanup_module-with-__exit/20251016-195352 base: linus/master patch link: https://lore.kernel.org/r/20251016115113.43986-1-i.shihao.999%40gmail.com patch subject: [PATCH] net :ethernet : replace cleanup_module with __exit() config: i386-randconfig-002-20251017 (https://download.01.org/0day-ci/archive/20251017/[email protected]/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251017/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/net/ethernet/3com/3c515.c:478:13: warning: variable 'pnp_cards' set but not used [-Wunused-but-set-variable]
478 | static int pnp_cards;
| ^
>> drivers/net/ethernet/3com/3c515.c:1552:22: error: use of undeclared identifier 'root_corkscrew_dev'
1552 | while (!list_empty(&root_corkscrew_dev)) {
| ^ drivers/net/ethernet/3com/3c515.c:1556:19: error: use of undeclared identifier 'root_corkscrew_dev'
1556 | vp = list_entry(root_corkscrew_dev.next,
| ^
drivers/net/ethernet/3com/3c515.c:1556:19: error: use of undeclared identifier 'root_corkscrew_dev' drivers/net/ethernet/3com/3c515.c:1556:19: error: use of undeclared identifier 'root_corkscrew_dev' 1 warning and 4 errors generated.
vim +/root_corkscrew_dev +1552 drivers/net/ethernet/3com/3c515.c
^1da177e4c3f415 drivers/net/3c515.c Linus Torvalds 2005-04-16 1549
c244e2488b92ba8 drivers/net/ethernet/3com/3c515.c Shi Hao 2025-10-16 1550 static void __exit corkscrew_exit_module(void)
^1da177e4c3f415 drivers/net/3c515.c Linus Torvalds 2005-04-16 1551 {^1da177e4c3f415 drivers/net/3c515.c Linus Torvalds 2005-04-16 @1552 while (!list_empty(&root_corkscrew_dev)) {
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Shi,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on horms-ipvs/master v6.18-rc1 next-20251016] [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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shi-Hao/net-ethernet-replace-cleanup_module-with-__exit/20251016-195352 base: linus/master patch link: https://lore.kernel.org/r/20251016115113.43986-1-i.shihao.999%40gmail.com patch subject: [PATCH] net :ethernet : replace cleanup_module with __exit() config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20251017/[email protected]/config) compiler: alpha-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251017/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/net/ethernet/3com/3c515.c: In function 'corkscrew_exit_module':
>> drivers/net/ethernet/3com/3c515.c:1552:29: error: 'root_corkscrew_dev' undeclared (first use in this function)
1552 | while (!list_empty(&root_corkscrew_dev)) {
| ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/3com/3c515.c:1552:29: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/module.h:12,
from drivers/net/ethernet/3com/3c515.c:52:
include/linux/compiler_types.h:532:27: error: expression in static assertion is not an integer
532 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
include/linux/container_of.h:21:9: note: in expansion of macro 'static_assert'
21 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ^~~~~~~~~~~~~
include/linux/container_of.h:21:23: note: in expansion of macro '__same_type'
21 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ^~~~~~~~~~~
include/linux/list.h:609:9: note: in expansion of macro 'container_of'
609 | container_of(ptr, type, member)
| ^~~~~~~~~~~~ drivers/net/ethernet/3com/3c515.c:1556:22: note: in expansion of macro 'list_entry'
1556 | vp = list_entry(root_corkscrew_dev.next,
| ^~~~~~~~~~
vim +/root_corkscrew_dev +1552 drivers/net/ethernet/3com/3c515.c
^1da177e4c3f415 drivers/net/3c515.c Linus Torvalds 2005-04-16 1549
c244e2488b92ba8 drivers/net/ethernet/3com/3c515.c Shi Hao 2025-10-16 1550 static void __exit corkscrew_exit_module(void)
^1da177e4c3f415 drivers/net/3c515.c Linus Torvalds 2005-04-16 1551 {^1da177e4c3f415 drivers/net/3c515.c Linus Torvalds 2005-04-16 @1552 while (!list_empty(&root_corkscrew_dev)) {
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki