Linux Power Management development
 help / color / mirror / Atom feed
From: Aishwarya Pant <aishpant@gmail.com>
To: Sebastian Reichel <sre@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: outreachy-kernel@googlegroups.com
Subject: [PATCH] power: supply: replace pr_* with dev_*
Date: Tue, 10 Oct 2017 02:39:54 +0530	[thread overview]
Message-ID: <20171009210954.5fdeimcmt35jbcoa@aishwarya> (raw)

Use kernel preferred dev_* family of functions in place of pr_*,
wherever a device object is present.

Done with the help of coccinelle.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
---
The following cocci script was used to make the patch:
@r exists@
identifier f, s, x;
position p;
@@
 f(..., struct s *x,...) {
<+... when != x == NULL
 \(pr_err@p\|pr_debug@p\|pr_info@p\|pr_warn@p\)(...); ...+>
 }

@struc@
identifier dev, r.s;
@@
struct s {
        ...
        struct device *dev;
        ...
};

@@
identifier r.x, struc.dev;
position r.p;
@@
(
- pr_err@p
+ dev_err
|
- pr_warn@p
+ dev_warn
|
- pr_info@p
+ dev_info
|
- pr_debug@p
+ dev_dbg
)
 (
+ x->dev,
...)

@rr exists@
local idexpression struct device *dev;
@@

<+... dev ...+>
(
- pr_err
+ dev_err
|
- pr_info
+ dev_info
|
- pr_warn
+ dev_warn
|
- pr_debug
+ dev_dbg
)
 (
+ dev,
...)
---
 drivers/power/supply/power_supply_core.c | 2 +-
 drivers/power/supply/twl4030_charger.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 02c6340ae36f..4b57fa9779ae 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -669,7 +669,7 @@ EXPORT_SYMBOL_GPL(power_supply_powers);
 static void power_supply_dev_release(struct device *dev)
 {
 	struct power_supply *psy = container_of(dev, struct power_supply, dev);
-	pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
+	dev_dbg(dev, "device: '%s': %s\n", dev_name(dev), __func__);
 	kfree(psy);
 }
 
diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c
index a5915f498eea..7ed2bc3039c4 100644
--- a/drivers/power/supply/twl4030_charger.c
+++ b/drivers/power/supply/twl4030_charger.c
@@ -743,7 +743,7 @@ static int twl4030bci_state(struct twl4030_bci *bci)
 
 	ret = twl4030_bci_read(TWL4030_BCIMSTATEC, &state);
 	if (ret) {
-		pr_err("twl4030_bci: error reading BCIMSTATEC\n");
+		dev_err(bci->dev, "twl4030_bci: error reading BCIMSTATEC\n");
 		return ret;
 	}
 
-- 
2.11.0

                 reply	other threads:[~2017-10-09 21:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20171009210954.5fdeimcmt35jbcoa@aishwarya \
    --to=aishpant@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=sre@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