* [PATCH] net/ipv4: don't use module_init in non-modular gre_offload
@ 2014-01-15 14:52 Paul Gortmaker
2014-01-15 15:11 ` Eric Dumazet
0 siblings, 1 reply; 2+ messages in thread
From: Paul Gortmaker @ 2014-01-15 14:52 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Paul Gortmaker, Eric Dumazet
Recent commit 438e38fadca2f6e57eeecc08326c8a95758594d4
("gre_offload: statically build GRE offloading support") added
new module_init/module_exit calls to the gre_offload.c file.
The file is obj-y and can't be anything other than built-in.
Currently it can never be built modular, so using module_init
as an alias for __initcall can be somewhat misleading.
Fix this up now, so that we can relocate module_init from
init.h into module.h in the future. If we don't do this, we'd
have to add module.h to obviously non-modular code, and that
would be a worse thing. We also make the inclusion explicit.
Note that direct use of __initcall is discouraged, vs. one
of the priority categorized subgroups. As __initcall gets
mapped onto device_initcall, our use of device_initcall
directly in this change means that the runtime impact is
zero -- it will remain at level 6 in initcall ordering.
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index 29512e3e7e7c..ed968daf2380 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -11,6 +11,7 @@
*/
#include <linux/skbuff.h>
+#include <linux/init.h>
#include <net/protocol.h>
#include <net/gre.h>
@@ -283,11 +284,10 @@ static int __init gre_offload_init(void)
{
return inet_add_offload(&gre_offload, IPPROTO_GRE);
}
+device_initcall(gre_offload_init);
static void __exit gre_offload_exit(void)
{
inet_del_offload(&gre_offload, IPPROTO_GRE);
}
-
-module_init(gre_offload_init);
-module_exit(gre_offload_exit);
+__exitcall(gre_offload_exit);
--
1.8.5.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] net/ipv4: don't use module_init in non-modular gre_offload
2014-01-15 14:52 [PATCH] net/ipv4: don't use module_init in non-modular gre_offload Paul Gortmaker
@ 2014-01-15 15:11 ` Eric Dumazet
0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2014-01-15 15:11 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: David S. Miller, netdev, Eric Dumazet
On Wed, 2014-01-15 at 09:52 -0500, Paul Gortmaker wrote:
> Recent commit 438e38fadca2f6e57eeecc08326c8a95758594d4
> ("gre_offload: statically build GRE offloading support") added
> new module_init/module_exit calls to the gre_offload.c file.
>
> The file is obj-y and can't be anything other than built-in.
> Currently it can never be built modular, so using module_init
> as an alias for __initcall can be somewhat misleading.
>
> Fix this up now, so that we can relocate module_init from
> init.h into module.h in the future. If we don't do this, we'd
> have to add module.h to obviously non-modular code, and that
> would be a worse thing. We also make the inclusion explicit.
>
> Note that direct use of __initcall is discouraged, vs. one
> of the priority categorized subgroups. As __initcall gets
> mapped onto device_initcall, our use of device_initcall
> directly in this change means that the runtime impact is
> zero -- it will remain at level 6 in initcall ordering.
>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>
> diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
> index 29512e3e7e7c..ed968daf2380 100644
> --- a/net/ipv4/gre_offload.c
> +++ b/net/ipv4/gre_offload.c
> @@ -11,6 +11,7 @@
> */
>
> #include <linux/skbuff.h>
> +#include <linux/init.h>
> #include <net/protocol.h>
> #include <net/gre.h>
>
> @@ -283,11 +284,10 @@ static int __init gre_offload_init(void)
> {
> return inet_add_offload(&gre_offload, IPPROTO_GRE);
> }
> +device_initcall(gre_offload_init);
>
> static void __exit gre_offload_exit(void)
> {
> inet_del_offload(&gre_offload, IPPROTO_GRE);
> }
> -
> -module_init(gre_offload_init);
> -module_exit(gre_offload_exit);
> +__exitcall(gre_offload_exit);
I guess we could remove gre_offload_exit() instead of using
this strange __exitcall()
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-15 15:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-15 14:52 [PATCH] net/ipv4: don't use module_init in non-modular gre_offload Paul Gortmaker
2014-01-15 15:11 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox