linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* scripts/checkpatch.pl
@ 2014-03-02  8:43 Yogesh Chaudhari
  2014-03-02 12:18 ` scripts/checkpatch.pl Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Yogesh Chaudhari @ 2014-03-02  8:43 UTC (permalink / raw)
  To: LKML

Hello,

I recently ran "scripts/checkpatch.pl" after adding the simplest form
of "hello world" module to the source tree. I used the old "printk"s
in this module and got this warning message:

WARNING: Prefer netdev_dbg(netdev, ... then dev_dbg(dev, ... then
pr_debug(...  to printk(KERN_DEBUG ...

It has come to my understanding that the dynamic debugging interface
offered by pr_debug and dev_dbg have obvious advantages to printk and
therefore they are preferred to printk.

Even amongst dev_dbg and pr_debug, we prefer dev_dbg if we have a
struct device to standardize device information output along with our
debug message. It offers escape from the "edit/rebuild/reboot cycle"
and also allows to maintain a neat log through dynamic_debug/control
interface.

I was not clear as to why netdev_dbg would be preferred to dev_dbg and
was given this asnwer on stackoverflow:

http://stackoverflow.com/questions/22077540/order-of-preference-printk-vs-dev-dbg-vs-netdev-dbg

Particularly, in regards to this part:
"netdev_dbg it is not the absolutly prefered print style. It is
prefered if you are working with a netdevice."

If this is the case, then I think the WARNING message should be
modified to mention that [subsystem]_dbg is preferred over dev_dbg. In
case this is correct and I am not missing something, I would like to
propose a patch to modify this script to give appropriate error
message. But in case I am wrong about this I would like
comments/suggestions/explanations before starting anything.

Thanks
Yogesh

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: scripts/checkpatch.pl
  2014-03-02  8:43 scripts/checkpatch.pl Yogesh Chaudhari
@ 2014-03-02 12:18 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2014-03-02 12:18 UTC (permalink / raw)
  To: Yogesh Chaudhari; +Cc: LKML

On Sun, 2014-03-02 at 14:13 +0530, Yogesh Chaudhari wrote:
> I think the [checkpatch] WARNING message should be
> modified to mention that [subsystem]_dbg is preferred over dev_dbg. In
> case this is correct and I am not missing something, I would like to
> propose a patch to modify this script to give appropriate error
> message. But in case I am wrong about this I would like
> comments/suggestions/explanations before starting anything.

Hi Yogesh.

Phrasing is hard.
Whatever, knock yourself out.
Propose a patch.

cc the checkpatch maintainers when you do.

cheers, Joe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-02 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-02  8:43 scripts/checkpatch.pl Yogesh Chaudhari
2014-03-02 12:18 ` scripts/checkpatch.pl Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).