hello-mod/hello.c: convert to module_init/module_exit
PATCH 1/2 hello-mod/hello.c: convert to module_init/module_exit
Switch away from the old init_module/cleanup_module function names for the main entry points. Change them to the documented method with module_init() and module_exit() markers next to static functions.
--- meta-skeleton/recipes-kernel/hello-mod/files/hello.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
meta-skeleton/recipes-kernel/hello-mod/files/hello.c +4 -2
@@ -19,15 +19,17 @@#include <linux/module.h> -int init_module (void ) +static int __init hello_init (void ) {printk ("Hello World!\n" );return 0 ; } -void cleanup_module (void ) +static void __exit hello_exit(void) {printk ("Goodbye Cruel World!\n" ); } +module_init (hello_init); +module_exit (hello_exit);MODULE_LICENSE ("GPL" );
Signature · 1 line
2.30.0.rc0
PATCH 2/2 hello-mod/hello.c: convert printk to pr_xxx
Convert to the newer pr_xxx aliases for logging, which embed the log level in the macro names.
--- meta-skeleton/recipes-kernel/hello-mod/files/hello.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta-skeleton/recipes-kernel/hello-mod/files/hello.c +2 -2
@@ -21,13 +21,13 @@static int __init hello_init (void ) { -printk ("Hello World!\n" ); +pr_info ("Hello World!\n" );return 0 ; } static void __exit hello_exit(void) { -printk ("Goodbye Cruel World!\n" ); +pr_info ("Goodbye Cruel World!\n" ); }module_init (hello_init);
Signature · 1 line
2.30.0.rc0
Re: [OE-core] [meta-skeleton][PATCH 2/2] hello-mod/hello.c: convert printk to pr_xxx
Hi Trevor,
Quoted 4 lines · Trevor Woerner
Convert to the newer
pr_xxxaliases for logging, which embed the log level in the macro names.Signed-off-by Trevor Woerner <[email protected]>
Thanks!
Quentin
Re: [OE-core] [meta-skeleton][PATCH 2/2] hello-mod/hello.c: convert printk to pr_xxx
ping?
It seems 1/2 got applied, but I didn't see an NAKs for 2/2?
Quoted 14 lines · Quentin Schulz
Hi Trevor,
Quoted 1 line · Trevor Woerner
Convert to the newer
pr_xxxaliases for logging, which embed the loglevel in
Quoted 3 lines
the macro names.
Signed-off-by Trevor Woerner <[email protected]>Reviewed-by Quentin Schulz <[email protected]>Thanks!
Quentin
Re: [OE-core] [meta-skeleton][PATCH 2/2] hello-mod/hello.c: convert printk to pr_xxx
Quoted 3 lines · Trevor Woerner
ping?
It seems 1/2 got applied, but I didn't see an NAKs for 2/2?
My intention was to apply both, not sure what happened, sorry. I've queued it.
Cheers,
Richard
Hi Trevor,
Quoted 5 lines · Trevor Woerner
Switch away from the old init_module/cleanup_module function names for the main entry points. Change them to the documented method with
module_init()andmodule_exit()markers next to static functions.Signed-off-by Trevor Woerner <[email protected]>
Thanks!
Quentin