[firefly] [PATCH] staging: dgnc: Fix checkpatch warnings
Daniel Baluta
daniel.baluta at gmail.com
Sun Sep 14 17:18:24 EEST 2014
On Sun, Sep 14, 2014 at 4:14 PM, Roberta Dobrescu
<roberta.dobrescu at gmail.com> wrote:
> This fixes the following checkpatch.pl warnings:
> WARNING: printk() should include KERN_ facility level
Hi Roberta,
I don't think this even compiles :).
The warning says that you should specify the log level for printk [1].
That means you should write something like this:
> - printk("dgnc_tty_send_xchar start\n");
> + printk(KERN_DEBUG "dgnc_tty_send_xchar start\n");
Anyhow, if you make this change you'll get:
WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then
dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...
Perhaps, we could make checkpatch.pl smarter.
And now getting back to your patch:
The preferred way now is to use [2]
pr_debug(): always good
dev_dbg(): prefered when you have a struct device object
netdev_dbg(): prefered when you have a struct netdevice object
Now, you have tty->dev which is a struct device, so you should use dev_dbg.
Notice that dev_dbg wants the address of struct device.
Your patch should look like this:
- printk("dgnc_tty_send_xchar start\n");
+ dev_dbg(&tty->dev, "dgnc_tty_send_xchar start\n");
thanks,
Daniel
[1] http://elinux.org/Debugging_by_printing#Log_Levels
[2] http://stackoverflow.com/questions/22077540/order-of-preference-printk-vs-dev-dbg-vs-netdev-dbg
More information about the firefly
mailing list