Whats the easiest way to debug ?
The easiest way is the one you know. For most of us thats printf(), or its kernel version:
printk(KERN_INFO DRVNAME "%s %s\n", info1, info2);
printk(KERN_ERR DRVNAME "something bad: %s\n", errstr);
printk("logged at (what?) default\n");
In lines 1,2, note the lack of comma after KERN_INFO and DRVNAME. These are string values that are catenated, per C language spec, to the front of the format string.
KERN_INFO and friends are defined here: http://lxr.linux.no/lxr/http/source/include/linux/kernel.h#L44
The logging system reads the numbers, and steers the message accorgingly.
Anything with less typing ?
For drivers with a struct device, device.h provides an easier way:
dev_info("%s %s\n", info1, info2);
dev_err("something bad: %s\n", errstr);
Messages issued by these statements include driver name, etc.
This symbol has additional feature - the statement typically disappears at compile-time, allowing developer to keep debug code w/o runtime penalties.
#define DEBUG 1
dev_dbg("%s %s\n", info1, info2);
I'm still not seeing the debug messages !
If you're looking at the console for messages, may be you need to raise its verbosity:
echo 8 > /proc/sys/kernel/printk
this will cause dev_dbg() messages, which are logged at level "<7>", to be reported to the console.