| Message ID | 20251124183534.870124-1-ross.burton@arm.com |
|---|---|
| State | New |
| Headers | show |
| Series | [kernel-module-hello-world,1/2] hello-world: some cleanups | expand |
Acked-by: Bruce Ashfield <bruce.ashfield@gmail.com> On Mon, Nov 24, 2025 at 1:35 PM Ross Burton <ross.burton@arm.com> wrote: > No need to include linux/init.h as module.h does this. > > Set the author to a real name for clarity. > > Print the filename of the module to verify that path remapping is > working if specified. > > Fix a typo in the comments. > > Signed-off-by: Ross Burton <ross.burton@arm.com> > --- > hello-world.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/hello-world.c b/hello-world.c > index 8ca2dc6..9c22cde 100644 > --- a/hello-world.c > +++ b/hello-world.c > @@ -7,27 +7,26 @@ > * > * > */ > -#include <linux/init.h> > #include <linux/module.h> > > > /* See module.h for additional #defines you may want to customize*/ > MODULE_LICENSE("Dual MIT/GPL"); /* See module.h for acceptable options */ > -MODULE_AUTHOR("Homer Simpson"); > +MODULE_AUTHOR("Mark Asselstine"); > MODULE_DESCRIPTION("A hello-world kernel module"); > MODULE_VERSION("0.1"); > > /* Initialize the module, called when first loaded */ > static int __init hello_world_init(void) { > /* print "Hello World" to the dmesg on module load */ > - printk(KERN_INFO "Hello World\n"); > + printk(KERN_INFO "Hello World from " __FILE__ "\n"); > > return 0; > } > > /* Last call before module unload, complete any cleanup */ > static void __exit hello_world_exit(void) { > - /* print "Goodby World" to the dmesg on module unload */ > + /* print "Goodbye World" to the dmesg on module unload */ > printk(KERN_INFO "Goodbye World\n"); > } > > -- > 2.43.0 > >
diff --git a/hello-world.c b/hello-world.c index 8ca2dc6..9c22cde 100644 --- a/hello-world.c +++ b/hello-world.c @@ -7,27 +7,26 @@ * * */ -#include <linux/init.h> #include <linux/module.h> /* See module.h for additional #defines you may want to customize*/ MODULE_LICENSE("Dual MIT/GPL"); /* See module.h for acceptable options */ -MODULE_AUTHOR("Homer Simpson"); +MODULE_AUTHOR("Mark Asselstine"); MODULE_DESCRIPTION("A hello-world kernel module"); MODULE_VERSION("0.1"); /* Initialize the module, called when first loaded */ static int __init hello_world_init(void) { /* print "Hello World" to the dmesg on module load */ - printk(KERN_INFO "Hello World\n"); + printk(KERN_INFO "Hello World from " __FILE__ "\n"); return 0; } /* Last call before module unload, complete any cleanup */ static void __exit hello_world_exit(void) { - /* print "Goodby World" to the dmesg on module unload */ + /* print "Goodbye World" to the dmesg on module unload */ printk(KERN_INFO "Goodbye World\n"); }
No need to include linux/init.h as module.h does this. Set the author to a real name for clarity. Print the filename of the module to verify that path remapping is working if specified. Fix a typo in the comments. Signed-off-by: Ross Burton <ross.burton@arm.com> --- hello-world.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)