linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Tresidder <rtresidd@electromag.com.au>
To: sre@kernel.org, enric.balletbo@collabora.com,
	ncrews@chromium.org, andrew.smirnov@gmail.com,
	groeck@chromium.org, david@lechnology.com,
	rtresidd@electromag.com.au, tglx@linutronix.de,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] power/supply/powersupply_sysfs: Add of_node name to uevent message if available
Date: Thu, 25 Jul 2019 15:47:38 +0800	[thread overview]
Message-ID: <1564040858-24202-1-git-send-email-rtresidd@electromag.com.au> (raw)

If the of_node name of the supply is available from the devicetree binding
then include it under the var POWER_SUPPLY_OF_NODE_NAME.
This helps where a consistent name is known via the device tree binding
but it is hard to identify based on the usual enumeration process.

Signed-off-by: Richard Tresidder <rtresidd@electromag.com.au>
---

Notes:
    power/supply/powersupply_sysfs: Add of_node name to uevent message if available
    
    If the of_node name of the supply is available from the devicetree binding
    then include it under the var POWER_SUPPLY_OF_NODE_NAME.
    This helps where a consistent name is known via the device tree binding
    but it is hard to identify based on the usual enumeration process.

 drivers/power/supply/power_supply_sysfs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index f37ad4e..ce6671c 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -395,6 +395,13 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
 	if (ret)
 		return ret;
 
+	if (psy->of_node) {
+		ret = add_uevent_var(env, "POWER_SUPPLY_OF_NODE_NAME=%s",
+				     psy->of_node->name);
+		if (ret)
+			return ret;
+	}
+
 	prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
 	if (!prop_buf)
 		return -ENOMEM;
-- 
1.8.3.1


             reply	other threads:[~2019-07-25  7:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25  7:47 Richard Tresidder [this message]
2019-07-25 14:08 ` [PATCH 1/1] power/supply/powersupply_sysfs: Add of_node name to uevent message if available David Lechner
2019-07-26  2:40   ` Richard Tresidder
2019-07-26  4:51     ` Richard Tresidder
2019-07-26  9:43       ` Richard Tresidder
2019-07-26 20:45 ` kbuild test robot
2019-07-29  8:32 ` kbuild test robot

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=1564040858-24202-1-git-send-email-rtresidd@electromag.com.au \
    --to=rtresidd@electromag.com.au \
    --cc=andrew.smirnov@gmail.com \
    --cc=david@lechnology.com \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=ncrews@chromium.org \
    --cc=sre@kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).