Message ID | 20230915-power-of-v2-1-ca54c441867e@axis.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1084513vqi; Fri, 15 Sep 2023 07:23:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFR65u/l6+Ggr713WIrQvrk19AcZDGUkpB5I/n2OQjy7NFibY2j85ESIcee+HjG2wj4ErcY X-Received: by 2002:a05:6a00:178e:b0:68a:69ba:6791 with SMTP id s14-20020a056a00178e00b0068a69ba6791mr2110406pfg.8.1694787790171; Fri, 15 Sep 2023 07:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694787790; cv=none; d=google.com; s=arc-20160816; b=S9U6Kl8+enLG+gxTYQLOy8/9QusAmqulEFOSMOXy80dqpfegKqs4S/GQIqTRQxg+82 vsY6Mzf3SRrVhthEGNHHeu6FIkc/0IHeVdukp5uxrt9x948JPeSpEZ8ORLuK1JLjJmUj ZyhMYPOkm7Z0wZ+MceyOyhEqTigw66NQYzDwdp/95POz4bvatu5Lga8jeDYO191jgOzH Dn1gxggFTn9LcRgndNFMYpUuj7hzrhc49zcEeYezJEO223UJC56siup1Rwfq5NvlY0bi QK4Ug24m0Dd+TC2hFu+vSsCsgadj+CbLXTD01ZFJDWa2GZZWt6/PX5XTAGuShdcmN+R3 WTVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=0sW0iqIhT6PSVFY4FBnRMJl8mvoqoSyQoxUjCR+YF+k=; fh=6r09+AOPUe5yVXsNeqqJiNkgrhZ92LHV04NE4W4vhd0=; b=kNBkPgnrHp0qdMDvyMWUuszzFs7ShsxWI/dMudDyxuRg4tmcD8DEh5p52zC/8Gdy9Q x2ixFIT0lI5SyTAMPaKzu85gayUVaXrkVIerqX//SIrdBX5QuavWkJIql0lrV+kJTZp0 3+OR9y/7X3rbyRdT4zy5mhTtYYzex7UId/nCCXQ/zx8wxgdL5YUUEddTKFqwGH5+VjPG kr3QBEJNGX7p5CcqyBIO48SFL2fShNtYIT8iUM70G+JM/IMQsHqTAPnf1X9XuDvJONLA kV2VZ8fRk83Nj3YmnREtb4KF/GVkglqy0Fk3rvq5VyptEF+mj3Uh+h21UdSGoV4My/WO 1kQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=KunYl9td; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id q188-20020a632ac5000000b005533647f7c5si3351547pgq.420.2023.09.15.07.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:23:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=KunYl9td; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B7CF983DCEF8; Fri, 15 Sep 2023 00:02:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbjIOHCc (ORCPT <rfc822;pwkd43@gmail.com> + 33 others); Fri, 15 Sep 2023 03:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232242AbjIOHCa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 15 Sep 2023 03:02:30 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43CEBA1; Fri, 15 Sep 2023 00:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1694761345; x=1726297345; h=from:date:subject:mime-version:content-transfer-encoding: message-id:to:cc; bh=0sW0iqIhT6PSVFY4FBnRMJl8mvoqoSyQoxUjCR+YF+k=; b=KunYl9tdPHrI3nHqyzLvWb9MKFwOyidQpWBP0KUj3K/CAoodOxjtWBn5 MLUjMo/nK21n0Cgy4gSwPj/DXGtabU/q8n/zzEN8hcNZcafl0bVl7GwvK gb3KrwK/DuKG9B8grYV9eMwyc7BjXM7AYJP3sc4KYy7WdxqPRVYNNcqbe bfrJGvNVTSsw9gvtwYmwaMZokvNd7/7hXfbslnkLetreDjU9Fk4FgYV0M JUNT0AyQAEBhBMp67r3G/aLV5qyVsbdz7rpdkonNw6EacFdWEa6b326oo cJvvReNgM2H51RlT4itA9gOaGb5CkbWxi+JxahTQZJThNrofOeQOCWs4X Q==; From: Vincent Whitchurch <vincent.whitchurch@axis.com> Date: Fri, 15 Sep 2023 09:02:14 +0200 Subject: [PATCH v2] power: supply: Propagate of_node to child device MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20230915-power-of-v2-1-ca54c441867e@axis.com> X-B4-Tracking: v=1; b=H4sIAHUBBGUC/22Nyw6CMBBFf4XM2jGlViWu/A/Doo9BZiFDWlMxp P9uYe3ynNzHCokiU4Jbs0KkzIllqqAPDfjRTk9CDpVBK31SV2Vwlg9FlAENaeuUc2S6ADXubCJ 00U5+3AqDiNn0HGngZX949JVHTm+J3/0wt5v9s51bbNH7TgdNwV7O7m4XTkcvL+hLKT+mzNmtt gAAAA== To: Sebastian Reichel <sre@kernel.org> CC: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <kernel@axis.com>, Vincent Whitchurch <vincent.whitchurch@axis.com> X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 15 Sep 2023 00:02:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777113801631074949 X-GMAIL-MSGID: 1777113801631074949 |
Series |
[v2] power: supply: Propagate of_node to child device
|
|
Commit Message
Vincent Whitchurch
Sept. 15, 2023, 7:02 a.m. UTC
Ensure that the dynamically created power supply device sets its
->of_node if the driver supplies one. This brings it in line with
several other subsystems (see git grep 'of_node =.*parent.*of_node') and
allows easier identification of the device from udev rules and similar.
Before this patch:
/sys/class/power_supply# ls -l bq256xx-battery/of_node
ls: cannot access 'bq256xx-battery/of_node': No such file or directory
# ls -l bq256xx-battery/hwmon1/of_node
ls: cannot access 'bq256xx-battery/hwmon1/of_node': No such file or directory
After:
/sys/class/power_supply# ls -l bq256xx-battery/of_node
lrwxrwxrwx 1 root root 0 May 17 09:14 bq256xx-battery/of_node ->
../../../../../../../../firmware/devicetree/base/virtio@1/i2c/bq25619@09
# ls -l bq256xx-battery/hwmon1/of_node
lrwxrwxrwx 1 root root 0 May 17 09:14 bq256xx-battery/hwmon1/of_node ->
../../../../../../../../../firmware/devicetree/base/virtio@1/i2c/bq25619@09
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
Changes in v2:
- Use psy->of_node instead of parent node.
- Link to v1: https://lore.kernel.org/r/20230704-power-of-v1-1-cc82d2eda65b@axis.com
---
drivers/power/supply/power_supply_core.c | 1 +
1 file changed, 1 insertion(+)
---
base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
change-id: 20230704-power-of-4e2ab0bbe48d
Best regards,
Comments
On Fri, 15 Sep 2023 09:02:14 +0200, Vincent Whitchurch wrote: > Ensure that the dynamically created power supply device sets its > ->of_node if the driver supplies one. This brings it in line with > several other subsystems (see git grep 'of_node =.*parent.*of_node') and > allows easier identification of the device from udev rules and similar. > > Before this patch: > > [...] Applied, thanks! [1/1] power: supply: Propagate of_node to child device commit: 58e4aacb746321d8692996f40a1dcfb9e8b34c23 Best regards,
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 0b69fb7bafd8..ab20bc660f00 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -1380,6 +1380,7 @@ __power_supply_register(struct device *parent, psy->drv_data = cfg->drv_data; psy->of_node = cfg->fwnode ? to_of_node(cfg->fwnode) : cfg->of_node; + dev->of_node = psy->of_node; psy->supplied_to = cfg->supplied_to; psy->num_supplicants = cfg->num_supplicants; }