what is the meaning of the word "DPRINTK"?

2,422 views
Skip to first unread message

sai

unread,
Sep 25, 2010, 7:56:33 AM9/25/10
to Android Linux Kernel Development
I am the student of android devices driver! I always see the
word"DPRINTK" in the drivers code.I do not the meaning of it. Also
how different between DPRINTK with printk? can someone tell me?Thank
you very much!

Peter Teoh

unread,
Sep 26, 2010, 10:10:02 PM9/26/10
to Android Linux Kernel Development
in drivers/atm/idt77252.h:

is the MACRO:

#define DPRINTK(args...) do { if (debug & DBG_GENERAL)
printk(args); } while(0)

which means JUST printk() when DEBUG is turned on.

archieval

unread,
Sep 26, 2010, 11:14:20 PM9/26/10
to Android Linux Kernel Development
Usually the DPRINTK macro is just a printk usually with KERN_DEBUG or
KERN_ERR, and will be invoked only when DEBUG is defined. This is used
instead of directly calling printk to easily turn ON or OFF the
debugging messages in your driver.

example:

#ifdef DEBUG
#define DPRINTK(format,args...) printk(KERN_DEBUG
format,##args)
#else
#define
DPRINTK(format,args...)
#endif
Reply all
Reply to author
Forward
0 new messages