Commits

Alexander Dahl committed baf3a50

add __init and __exit tokens, some module description stuff, and play with linux/version.h

Comments (0)

Files changed (1)

misc-modules/hello.c

 #include <linux/init.h>
 #include <linux/module.h>
-//MODULE_LICENSE( "Dual BSD/GPL" );
+#include <linux/version.h>
 
-static int hello_init( void ) {
-    printk( KERN_ALERT "Hello world!\n" );
+static int __init hello_init( void ) {
+    printk( KERN_ALERT "Hello world! Module compiled against Linux %u.%u.%u.\n",
+			( LINUX_VERSION_CODE & 0xFF0000 ) >> 16,
+			( LINUX_VERSION_CODE & 0x00FF00 ) >> 8,
+			( LINUX_VERSION_CODE & 0x0000FF ) );
     return 0;
 }
 
-static void hello_exit( void ) {
+static void __exit hello_exit( void ) {
     printk( KERN_ALERT "Goodbye world!\n" );
 }
 
 module_init( hello_init );
 module_exit( hello_exit );
+
+MODULE_LICENSE( "GPL" );
+MODULE_AUTHOR( "Alexander Dahl <post@lespocky.de>" );
+MODULE_DESCRIPTION( "Hello World as described in book 'Linux Device Drivers'" );