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

Rosen Penev posted 17 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH net-next v3 03/17] net: ibm: emac: use module_platform_driver for modules
Posted by Rosen Penev 1 month, 3 weeks ago
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);
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);
-- 
2.46.2
Re: [PATCH net-next v3 03/17] net: ibm: emac: use module_platform_driver for modules
Posted by kernel test robot 1 month, 3 weeks ago
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  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH net-next v3 03/17] net: ibm: emac: use module_platform_driver for modules
Posted by kernel test robot 1 month, 3 weeks ago
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

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH net-next v3 03/17] net: ibm: emac: use module_platform_driver for modules
Posted by Jakub Kicinski 1 month, 3 weeks ago
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.
Re: [PATCH net-next v3 03/17] net: ibm: emac: use module_platform_driver for modules
Posted by Rosen Penev 1 month, 3 weeks ago
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.