On Thu, Mar 27, 2008 at 09:32:42AM -0700, bhanu nani wrote:
> I am writing simple module and testing them.
> I am trying to write a MACRO to define my own LOGLEVEL for the printk
> statement
> See it below:
>
> #define PDEBUG (Level, fmt, args...) do { if (Level == 0)
> printk("MYDRV:"fmt,
> ##args) else if (Level ==1)
> printk("MYDRV:<%s> "
> fmt, __FUNCTION__, ##args) } while0
>
> Can you suggest some more extra detailed log levels that I can add ti
> this MACRO?
What about these two much simpler ones that avoid messing with levels
and make your code easier to understand (i.e.: you don't have to figure
out what the level is supposed to mean, the function name will tell):
/* dprintk() for debug messages */
#define dprintk(fmt, args...) do { \
printk(KERN_DEBUG "MYDRV: " fmt , ## args ); } while(0)
/* fundprintk(): as dprintk() but also prints function name */
#define fundprintk(fmt, args...) do { \
printk(KERN_DEBUG "MYDRV: <%s>: " fmt , __FUNCTION__ , ## args ); }
while(0);
Erik
--
Erik Mouw -- [EMAIL PROTECTED]
signature.asc
Description: Digital signature
