<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 23, 2014 at 8:34 PM, Kristofer Hallin <span dir="ltr"><<a href="mailto:kristofer.hallin@gmail.com" target="_blank">kristofer.hallin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">1. No. Depending on what subsystem your are printing logs from you<br>
should use different functions for logging. In the networking<br>
subsystem netdev_dbg is suitable and so on. Otherwise pr_debug will<br>
always work and is always preferred over printk.<br></blockquote><div><br></div><div>By default, pr_debug is an empty macro unless you add -DDEBUG to CFLAGS. So in addition to what Kristofer said, be sure you compile your module/kernel with that flag enabled.<br>
<br>Cheers.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
2. Use pr_debug.<br>
<div class=""><div class="h5"><br>
On Wed, Jul 23, 2014 at 8:16 PM, Raphael Silva<br>
<<a href="mailto:raphaelcampos.rp@gmail.com">raphaelcampos.rp@gmail.com</a>> wrote:<br>
> Hello guys,<br>
><br>
> 1)<br>
> If I use printk(KERN_<LEVEL>...) the checkpatch warns me:<br>
> WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then<br>
> dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...<br>
><br>
> So, pr_devel() is the correct way to print a debug level msg?<br>
><br>
> 2)<br>
> if pr_<level> is the correct way, what about KERN_DEFAULT ?<br>
><br>
> If I don't put the kern_level (printk("Hello");)<br>
> WARNING: printk() should include KERN_ facility level<br>
><br>
> if I put KERN_DEFAULT:<br>
> WARNING: Prefer [subsystem eg: netdev]_default([subsystem]dev, ... then<br>
> dev_default(dev, ... then pr_default(... to printk(KERN_DEFAULT ...<br>
><br>
> But for KERN_DEFAULT, there isn't a macro pr_<level> like pr_devel().<br>
><br>
> Can anyone show me the correct way?<br>
><br>
> tks<br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div><br></div></div>