[PATCH] staging: emxx_udc: Fix style warnings relating to printk(KERN_DEBUG

Daniel Baluta daniel.baluta at gmail.com
Mon Sep 29 23:16:34 EEST 2014


On Mon, Sep 29, 2014 at 11:11 PM, Vlad Dogaru <ddvlad at herebedragons.ro> wrote:
> On 9/29/2014 9:32 PM, Georgiana Chelu wrote:
>> This fixes the following checkpatch.pl warnings:
>> WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ...
>> then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
>>
>> Signed-off-by: Georgiana Chelu <georgiana.chelu93 at gmail.com>
>> ---
>>  drivers/staging/emxx_udc/emxx_udc.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
>> index 6212efb..57a9bf2 100644
>> --- a/drivers/staging/emxx_udc/emxx_udc.c
>> +++ b/drivers/staging/emxx_udc/emxx_udc.c
>> @@ -121,23 +121,23 @@ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc)
>>
>>       spin_unlock(&udc->lock);
>>
>> -     printk(KERN_DEBUG "\n-USB REG-\n");
>> +     pr_debug(KERN_DEBUG "\n-USB REG-\n");
>
> Looks bad.  The point of pr_debug (among others) is that KERN_DEBUG can
> be omitted from the format string.

One more thing. If you have struct device in the context of using
printk, you should
use dev_dbg instead of pr_debug.

In you particular case, look at struct nbu2ss_udc which has a dev of
type struct device*
as a member.

Read the first answer from this:

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

Daniel.


More information about the firefly mailing list