From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98F1BC76194 for ; Thu, 25 Jul 2019 07:47:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6917221871 for ; Thu, 25 Jul 2019 07:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388489AbfGYHrr (ORCPT ); Thu, 25 Jul 2019 03:47:47 -0400 Received: from icp-osb-irony-out1.external.iinet.net.au ([203.59.1.210]:4099 "EHLO icp-osb-irony-out1.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388187AbfGYHrq (ORCPT ); Thu, 25 Jul 2019 03:47:46 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2C8BgA+XTld/1/rO8tcCoIZg3YSFxO?= =?us-ascii?q?NGYgXAYJDAYNZhVOJfoUggXsJAQEBAQEBAQEBGxwBAYQ6BIMBNgcOAQMBAQE?= =?us-ascii?q?EAQEBAQUBbYRlRYV4L3JwEoMigXcTrj4zhAYBhGyBSIE0hwmEboFAP4RhhBk?= =?us-ascii?q?PhX8ElBqBHZU1CYEld5QSGZgLLYszgViZVAcqgVhNHxmDJ4J5jVZENTCOSgE?= =?us-ascii?q?B?= X-IPAS-Result: =?us-ascii?q?A2C8BgA+XTld/1/rO8tcCoIZg3YSFxONGYgXAYJDAYNZh?= =?us-ascii?q?VOJfoUggXsJAQEBAQEBAQEBGxwBAYQ6BIMBNgcOAQMBAQEEAQEBAQUBbYRlR?= =?us-ascii?q?YV4L3JwEoMigXcTrj4zhAYBhGyBSIE0hwmEboFAP4RhhBkPhX8ElBqBHZU1C?= =?us-ascii?q?YEld5QSGZgLLYszgViZVAcqgVhNHxmDJ4J5jVZENTCOSgEB?= X-IronPort-AV: E=Sophos;i="5.64,306,1559491200"; d="scan'208";a="228541455" Received: from 203-59-235-95.perm.iinet.net.au (HELO rtcentos7.electromag.com.au) ([203.59.235.95]) by icp-osb-irony-out1.iinet.net.au with ESMTP; 25 Jul 2019 15:47:42 +0800 From: Richard Tresidder 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 Message-Id: <1564040858-24202-1-git-send-email-rtresidd@electromag.com.au> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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