[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190830051941.GA3598@jagdpanzerIV>
Date: Fri, 30 Aug 2019 14:19:48 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: shuah <shuah@...nel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Brendan Higgins <brendanhiggins@...gle.com>,
Joe Perches <joe@...ches.com>, kunit-dev@...glegroups.com,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
frowand.list@...il.com, sboyd@...nel.org, pmladek@...e.com,
sergey.senozhatsky@...il.com, rostedt@...dmis.org,
Randy Dunlap <rdunlap@...radead.org>,
Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH v2] kunit: fix failure to build without printk
On (08/29/19 11:01), shuah wrote:
[..]
> Hi Sergey,
>
> What are the guidelines for using printk(). I recall some discussion
> about not using printk(). I am seeing the following from checkpatch
> script:
Hello,
> WARNING: Prefer [subsystem eg: netdev]_level([subsystem]dev, ... then
> dev_level(dev, ... then pr_level(... to printk(KERN_LEVEL ...
> #105: FILE: include/kunit/test.h:343:
> + printk(KERN_LEVEL "\t# %s: " fmt, (test)->name, ##__VA_ARGS__)
>
Oh, right.
So we sort of want people to use pr_err()/pr_info()/pr_"level"()
because, otherwise, when people use plain printk(), they tend to
forget to add KERN_LEVEL.
In kunit case everything looks fine. KERN_LEVEL is there so I'm
fine with the patch.
You still can switch to pr_info()/pr_err()/pr_etc, just to make
checkpatch happier, but that's up to you.
> Is there supposed to be pr_level() - I can find dev_level()
No, not really. pr_level() stands for pr_"debug"()/pr_"info"()/etc.
E.g.
#define pr_emerg(fmt, ...) \
printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
#define pr_alert(fmt, ...) \
printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_crit(fmt, ...) \
printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_err(fmt, ...) \
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warning(fmt, ...) \
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warn pr_warning
#define pr_notice(fmt, ...) \
printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
#define pr_info(fmt, ...) \
printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
-ss
Powered by blists - more mailing lists