Thanks for posting and emailing your code.
You were compiling your module incorrectly.
Before you can compile your module, you must be
sure that the kernel sources you have installed are
the same version as the running kernel. To remedy this,
you need to do two things.
1) execute this command...
cp /boot/vmlinuz.version.h /lib/modules/`uname -r`/build/include/linux/version.h
The file /boot/vmlinuz.version.h contains the running kernel's version
information, and will override the kernel source's version macros.
2) you need to compile your modules like this...
gcc -I/lib/modules/`uname -r`/build/include -c mymod.c -o mymod
Then, your module should be compiled and ready to be loaded.
and your module
should be loaded. On my machine printk's output was printed in my logs and not on the terminal. Depending on your kernel version and your klogd configuration, your results may vary.
Hope I helped.