diff mbox series

[net-next,v3,03/17] net: ibm: emac: use module_platform_driver for modules

Message ID 20241003021135.1952928-4-rosenp@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series ibm: emac: more cleanups | expand

Checks

Context Check Description
netdev/series_format fail Series longer than 15 patches
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: leitao@debian.org
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 52 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-04--18-00 (tests: 773)

Commit Message

Rosen Penev Oct. 3, 2024, 2:11 a.m. UTC
These init and exit functions don't do anything special. Just macro it
away.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/ethernet/ibm/emac/mal.c   | 10 +---------
 drivers/net/ethernet/ibm/emac/rgmii.c | 10 +---------
 drivers/net/ethernet/ibm/emac/tah.c   | 10 +---------
 drivers/net/ethernet/ibm/emac/zmii.c  | 10 +---------
 4 files changed, 4 insertions(+), 36 deletions(-)

Comments

Jakub Kicinski Oct. 4, 2024, 11:32 p.m. UTC | #1
On Wed,  2 Oct 2024 19:11:21 -0700 Rosen Penev wrote:
> These init and exit functions don't do anything special. Just macro it
> away.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  drivers/net/ethernet/ibm/emac/mal.c   | 10 +---------
>  drivers/net/ethernet/ibm/emac/rgmii.c | 10 +---------
>  drivers/net/ethernet/ibm/emac/tah.c   | 10 +---------
>  drivers/net/ethernet/ibm/emac/zmii.c  | 10 +---------
>  4 files changed, 4 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
> index d92dd9c83031..a632d3a207d3 100644
> --- a/drivers/net/ethernet/ibm/emac/mal.c
> +++ b/drivers/net/ethernet/ibm/emac/mal.c
> @@ -779,12 +779,4 @@ static struct platform_driver mal_of_driver = {
>  	.remove_new = mal_remove,
>  };
>  
> -int __init mal_init(void)
> -{
> -	return platform_driver_register(&mal_of_driver);
> -}
> -
> -void mal_exit(void)
> -{
> -	platform_driver_unregister(&mal_of_driver);
> -}
> +module_platform_driver(mal_of_driver);

This is not 1:1, right? We're now implicitly adding module_init()
module_exit() annotations which weren't there before. Needs to be
at least mentioned in the commit msg.
Rosen Penev Oct. 5, 2024, 12:10 a.m. UTC | #2
On Fri, Oct 4, 2024 at 4:32 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Wed,  2 Oct 2024 19:11:21 -0700 Rosen Penev wrote:
> > These init and exit functions don't do anything special. Just macro it
> > away.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> >  drivers/net/ethernet/ibm/emac/mal.c   | 10 +---------
> >  drivers/net/ethernet/ibm/emac/rgmii.c | 10 +---------
> >  drivers/net/ethernet/ibm/emac/tah.c   | 10 +---------
> >  drivers/net/ethernet/ibm/emac/zmii.c  | 10 +---------
> >  4 files changed, 4 insertions(+), 36 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
> > index d92dd9c83031..a632d3a207d3 100644
> > --- a/drivers/net/ethernet/ibm/emac/mal.c
> > +++ b/drivers/net/ethernet/ibm/emac/mal.c
> > @@ -779,12 +779,4 @@ static struct platform_driver mal_of_driver = {
> >       .remove_new = mal_remove,
> >  };
> >
> > -int __init mal_init(void)
> > -{
> > -     return platform_driver_register(&mal_of_driver);
> > -}
> > -
> > -void mal_exit(void)
> > -{
> > -     platform_driver_unregister(&mal_of_driver);
> > -}
> > +module_platform_driver(mal_of_driver);
>
> This is not 1:1, right? We're now implicitly adding module_init()
> module_exit() annotations which weren't there before. Needs to be
> at least mentioned in the commit msg.
Sure. The prior commit removes direct usage by core.c of these functions.
kernel test robot Oct. 6, 2024, 11:53 a.m. UTC | #3
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-ibm-emac-use-netif_receive_skb_list/20241003-101754
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241003021135.1952928-4-rosenp%40gmail.com
patch subject: [PATCH net-next v3 03/17] net: ibm: emac: use module_platform_driver for modules
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20241006/202410061910.his99w1N-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241006/202410061910.his99w1N-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/202410061910.his99w1N-lkp@intel.com/

All errors (new ones prefixed by >>):

   powerpc64-linux-ld: drivers/net/ethernet/ibm/emac/core.o: in function `emac_init':
>> core.c:(.init.text+0x8): multiple definition of `init_module'; drivers/net/ethernet/ibm/emac/mal.o:mal.c:(.init.text+0x8): first defined here
   powerpc64-linux-ld: drivers/net/ethernet/ibm/emac/core.o: in function `emac_exit':
>> core.c:(.exit.text+0x8): multiple definition of `cleanup_module'; drivers/net/ethernet/ibm/emac/mal.o:mal.c:(.exit.text+0x8): first defined here
   powerpc64-linux-ld: drivers/net/ethernet/ibm/emac/zmii.o: in function `zmii_driver_init':
   zmii.c:(.init.text+0x8): multiple definition of `init_module'; drivers/net/ethernet/ibm/emac/mal.o:mal.c:(.init.text+0x8): first defined here
   powerpc64-linux-ld: drivers/net/ethernet/ibm/emac/zmii.o: in function `zmii_driver_exit':
   zmii.c:(.exit.text+0x8): multiple definition of `cleanup_module'; drivers/net/ethernet/ibm/emac/mal.o:mal.c:(.exit.text+0x8): first defined here
   powerpc64-linux-ld: drivers/net/ethernet/ibm/emac/rgmii.o: in function `rgmii_driver_init':
   rgmii.c:(.init.text+0x8): multiple definition of `init_module'; drivers/net/ethernet/ibm/emac/mal.o:mal.c:(.init.text+0x8): first defined here
   powerpc64-linux-ld: drivers/net/ethernet/ibm/emac/rgmii.o: in function `rgmii_driver_exit':
   rgmii.c:(.exit.text+0x8): multiple definition of `cleanup_module'; drivers/net/ethernet/ibm/emac/mal.o:mal.c:(.exit.text+0x8): first defined here
   powerpc64-linux-ld: drivers/net/ethernet/ibm/emac/tah.o: in function `tah_driver_init':
   tah.c:(.init.text+0x8): multiple definition of `init_module'; drivers/net/ethernet/ibm/emac/mal.o:mal.c:(.init.text+0x8): first defined here
   powerpc64-linux-ld: drivers/net/ethernet/ibm/emac/tah.o: in function `tah_driver_exit':
   tah.c:(.exit.text+0x8): multiple definition of `cleanup_module'; drivers/net/ethernet/ibm/emac/mal.o:mal.c:(.exit.text+0x8): first defined here
kernel test robot Oct. 6, 2024, 7:13 p.m. UTC | #4
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-ibm-emac-use-netif_receive_skb_list/20241003-101754
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241003021135.1952928-4-rosenp%40gmail.com
patch subject: [PATCH net-next v3 03/17] net: ibm: emac: use module_platform_driver for modules
config: powerpc-fsp2_defconfig (https://download.01.org/0day-ci/archive/20241007/202410070205.fxayDTTJ-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241007/202410070205.fxayDTTJ-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/202410070205.fxayDTTJ-lkp@intel.com/

All errors (new ones prefixed by >>):

   powerpc-linux-ld: drivers/net/ethernet/ibm/emac/core.o: in function `emac_init':
>> drivers/net/ethernet/ibm/emac/core.c:3285: multiple definition of `init_module'; drivers/net/ethernet/ibm/emac/mal.o:drivers/net/ethernet/ibm/emac/mal.c:782: first defined here
   powerpc-linux-ld: drivers/net/ethernet/ibm/emac/core.o: in function `emac_exit':
>> drivers/net/ethernet/ibm/emac/core.c:3293: multiple definition of `cleanup_module'; drivers/net/ethernet/ibm/emac/mal.o:drivers/net/ethernet/ibm/emac/mal.c:782: first defined here
   powerpc-linux-ld: drivers/net/ethernet/ibm/emac/rgmii.o: in function `rgmii_driver_init':
   drivers/net/ethernet/ibm/emac/rgmii.c:306: multiple definition of `init_module'; drivers/net/ethernet/ibm/emac/mal.o:drivers/net/ethernet/ibm/emac/mal.c:782: first defined here
   powerpc-linux-ld: drivers/net/ethernet/ibm/emac/rgmii.o: in function `rgmii_driver_exit':
   drivers/net/ethernet/ibm/emac/rgmii.c:306: multiple definition of `cleanup_module'; drivers/net/ethernet/ibm/emac/mal.o:drivers/net/ethernet/ibm/emac/mal.c:782: first defined here


vim +3285 drivers/net/ethernet/ibm/emac/core.c

1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3283  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3284  static int __init emac_init(void)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23 @3285  {
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3286  	/* Build EMAC boot list */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3287  	emac_make_bootlist();
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3288  
c142fce2e67e1b drivers/net/ethernet/ibm/emac/core.c Rosen Penev  2024-10-02  3289  	return platform_driver_register(&emac_driver);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3290  }
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3291  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3292  static void __exit emac_exit(void)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23 @3293  {
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3294  	int i;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3295  
74888760d40b3a drivers/net/ibm_newemac/core.c       Grant Likely 2011-02-22  3296  	platform_driver_unregister(&emac_driver);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3297  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3298  	/* Destroy EMAC boot list */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3299  	for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3300  		of_node_put(emac_boot_list[i]);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3301  }
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson 2007-08-23  3302
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
index d92dd9c83031..a632d3a207d3 100644
--- a/drivers/net/ethernet/ibm/emac/mal.c
+++ b/drivers/net/ethernet/ibm/emac/mal.c
@@ -779,12 +779,4 @@  static struct platform_driver mal_of_driver = {
 	.remove_new = mal_remove,
 };
 
-int __init mal_init(void)
-{
-	return platform_driver_register(&mal_of_driver);
-}
-
-void mal_exit(void)
-{
-	platform_driver_unregister(&mal_of_driver);
-}
+module_platform_driver(mal_of_driver);
diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/ibm/emac/rgmii.c
index e1712fdc3c31..52f080661f87 100644
--- a/drivers/net/ethernet/ibm/emac/rgmii.c
+++ b/drivers/net/ethernet/ibm/emac/rgmii.c
@@ -303,12 +303,4 @@  static struct platform_driver rgmii_driver = {
 	.remove_new = rgmii_remove,
 };
 
-int __init rgmii_init(void)
-{
-	return platform_driver_register(&rgmii_driver);
-}
-
-void rgmii_exit(void)
-{
-	platform_driver_unregister(&rgmii_driver);
-}
+module_platform_driver(rgmii_driver);
diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm/emac/tah.c
index fa3488258ca2..8407ff83b1d3 100644
--- a/drivers/net/ethernet/ibm/emac/tah.c
+++ b/drivers/net/ethernet/ibm/emac/tah.c
@@ -161,12 +161,4 @@  static struct platform_driver tah_driver = {
 	.remove_new = tah_remove,
 };
 
-int __init tah_init(void)
-{
-	return platform_driver_register(&tah_driver);
-}
-
-void tah_exit(void)
-{
-	platform_driver_unregister(&tah_driver);
-}
+module_platform_driver(tah_driver);
diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ibm/emac/zmii.c
index 26e86cdee2f6..97cea64abe55 100644
--- a/drivers/net/ethernet/ibm/emac/zmii.c
+++ b/drivers/net/ethernet/ibm/emac/zmii.c
@@ -309,12 +309,4 @@  static struct platform_driver zmii_driver = {
 	.remove_new = zmii_remove,
 };
 
-int __init zmii_init(void)
-{
-	return platform_driver_register(&zmii_driver);
-}
-
-void zmii_exit(void)
-{
-	platform_driver_unregister(&zmii_driver);
-}
+module_platform_driver(zmii_driver);