ntb.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ntb_netdev: Fix module_init problem
@ 2023-06-30 21:58 Geoff Levand
  2023-06-30 22:00 ` Dave Jiang
  0 siblings, 1 reply; 2+ messages in thread
From: Geoff Levand @ 2023-06-30 21:58 UTC (permalink / raw)
  To: ntb, Jon Mason, Dave Jiang, Allen Hubbe

With both the ntb_transport_init and the ntb_netdev_init_module routines in the
module_init init group, the ntb_netdev_init_module routine can be called before
the ntb_transport_init routine that it depends on is called.  To assure the
proper initialization order put ntb_netdev_init_module in the late_initcall
group.

Fixes runtime errors where the ntb_netdev_init_module call fails with ENODEV.

Signed-off-by: Geoff Levand <geoff@infradead.org> for Sony Interactive Entertainment
---
 drivers/net/ntb_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index 85dbe7f73e31..536bd6564f8b 100644
--- a/drivers/net/ntb_netdev.c
+++ b/drivers/net/ntb_netdev.c
@@ -493,7 +493,7 @@ static int __init ntb_netdev_init_module(void)
 
 	return 0;
 }
-module_init(ntb_netdev_init_module);
+late_initcall(ntb_netdev_init_module);
 
 static void __exit ntb_netdev_exit_module(void)
 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] ntb_netdev: Fix module_init problem
  2023-06-30 21:58 [PATCH v1 1/1] ntb_netdev: Fix module_init problem Geoff Levand
@ 2023-06-30 22:00 ` Dave Jiang
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Jiang @ 2023-06-30 22:00 UTC (permalink / raw)
  To: Geoff Levand, ntb, Jon Mason, Allen Hubbe



On 6/30/23 14:58, Geoff Levand wrote:
> With both the ntb_transport_init and the ntb_netdev_init_module routines in the
> module_init init group, the ntb_netdev_init_module routine can be called before
> the ntb_transport_init routine that it depends on is called.  To assure the
> proper initialization order put ntb_netdev_init_module in the late_initcall
> group.
> 
> Fixes runtime errors where the ntb_netdev_init_module call fails with ENODEV.
> 
> Signed-off-by: Geoff Levand <geoff@infradead.org> for Sony Interactive Entertainment

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>   drivers/net/ntb_netdev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
> index 85dbe7f73e31..536bd6564f8b 100644
> --- a/drivers/net/ntb_netdev.c
> +++ b/drivers/net/ntb_netdev.c
> @@ -493,7 +493,7 @@ static int __init ntb_netdev_init_module(void)
>   
>   	return 0;
>   }
> -module_init(ntb_netdev_init_module);
> +late_initcall(ntb_netdev_init_module);
>   
>   static void __exit ntb_netdev_exit_module(void)
>   {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-30 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30 21:58 [PATCH v1 1/1] ntb_netdev: Fix module_init problem Geoff Levand
2023-06-30 22:00 ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).