From: Guenter Roeck <linux@roeck-us.net>
To: Joe Perches <joe@perches.com>,
Florian Fainelli <f.fainelli@gmail.com>,
linux-kernel@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr>
Cc: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Jean Delvare <jdelvare@suse.com>,
Jonathan Corbet <corbet@lwn.net>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
"open list:HARDWARE MONITORING" <linux-hwmon@vger.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>
Subject: Re: [PATCH 1/2] hwmon: (lm70) Utilize dev_warn instead of pr_warn
Date: Sun, 22 Jan 2017 23:01:26 -0800 [thread overview]
Message-ID: <637f229a-cfbb-938e-4700-89b180c8b2c0@roeck-us.net> (raw)
In-Reply-To: <1485153837.12563.23.camel@perches.com>
On 01/22/2017 10:43 PM, Joe Perches wrote:
> On Sat, 2017-01-21 at 11:20 -0800, Florian Fainelli wrote:
>> We have a device reference, utilize it instead of pr_warn().
>
> There is at least one more hwmon to convert in applesmc.c
>
> Perhaps a coccinelle script?
>
> Two questions for Julia Lawall:
>
> o is there a better way to do this than repeat the blocks
> one for each replacement
> o can struct device * dev be made an arbitrary identifier
Definitely yes here; otherwise you only catch the ones named 'dev'.
Did you try "identifier dev;" ?
The type of fn is irrelevant; you don't need to specify it.
There is also the case where 'struct device *dev' is a local variable
fn(...) {
...
struct device *dev = e;
<...
...>
}
or when it isn't but is still available
fn (..., struct \(platform_device\|i2c_device\|spi_device\) *pdev, ...) {
}
>
> $ cat dev_printk.cocci
> @@
> identifier fn;
> type T;
> @@
>
> T fn ( ..., struct device * dev, ... ) {
> <...
> - pr_emerg(
> + dev_emerg(dev,
> ...);
> ...>
> }
>
> @@
> identifier fn;
> type T;
> @@
>
> T fn ( ..., struct device * dev, ... ) {
> <...
> - pr_crit(
> + dev_crit(dev,
> ...);
> ...>
> }
>
> @@
> identifier fn;
> type T;
> @@
>
> T fn ( ..., struct device * dev, ... ) {
> <...
> - pr_alert(
> + dev_alert(dev,
> ...);
> ...>
> }
>
> @@
> identifier fn;
> type T;
> @@
>
> T fn ( ..., struct device * dev, ... ) {
> <...
> - pr_err(
> + dev_err(dev,
> ...);
> ...>
> }
>
> @@
> identifier fn;
> type T;
> @@
>
> T fn ( ..., struct device * dev, ... ) {
> <...
> - pr_notice(
> + dev_notice(dev,
> ...);
> ...>
> }
>
> @@
> identifier fn;
> type T;
> @@
>
> T fn ( ..., struct device * dev, ... ) {
> <...
> - pr_warn(
> + dev_warn(dev,
> ...);
> ...>
> }
>
> @@
> identifier fn;
> type T;
> @@
>
> T fn ( ..., struct device * dev, ... ) {
> <...
> - pr_info(
> + dev_info(dev,
> ...);
> ...>
> }
>
> @@
> identifier fn;
> type T;
> @@
>
> T fn ( ..., struct device * dev, ... ) {
> <...
> - pr_debug(
> + dev_dbg(dev,
> ...);
> ...>
> }
>
>
next prev parent reply other threads:[~2017-01-23 7:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-21 19:20 [PATCH 0/2] hwmon: (lm70) Couple patches Florian Fainelli
2017-01-21 19:20 ` [PATCH 1/2] hwmon: (lm70) Utilize dev_warn instead of pr_warn Florian Fainelli
2017-01-21 20:14 ` Guenter Roeck
2017-01-23 6:43 ` Joe Perches
2017-01-23 6:56 ` Joe Perches
2017-01-23 12:00 ` Julia Lawall
2017-01-23 7:01 ` Guenter Roeck [this message]
2017-01-23 7:18 ` Julia Lawall
2017-01-21 19:20 ` [PATCH 2/2] hwmon: (lm70) Add support for TI TMP122/124 Florian Fainelli
2017-01-21 20:25 ` Guenter Roeck
2017-01-21 23:11 ` Florian Fainelli
2017-01-22 0:01 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=637f229a-cfbb-938e-4700-89b180c8b2c0@roeck-us.net \
--to=linux@roeck-us.net \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=jdelvare@suse.com \
--cc=joe@perches.com \
--cc=julia.lawall@lip6.fr \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox