Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4391696rdb; Fri, 15 Sep 2023 00:04:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoCtJVoQigTeLCvVMESiMD50Z7vLigePw9pjhVKrhCUe9Zhi+YrKkfqxWx8R+M32MwhEGQ X-Received: by 2002:a17:90b:386:b0:268:1be1:745a with SMTP id ga6-20020a17090b038600b002681be1745amr566446pjb.29.1694761477021; Fri, 15 Sep 2023 00:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694761477; cv=none; d=google.com; s=arc-20160816; b=MGyNwxbnnmUS62yB4L0vh8Q+/HQkbJ9nPZBeex79PZdjv080YcBtrdDskJ02TQCAMf s5KKG67qHi8caa/Q87cB6K89M/YA3ErmAs7UZwgJ4hkVKKs9VHNJFtOfDA1n1r0r6fCX cZGDbNKvetnJdPwFoiGoQA64fvr6vNzehpQWSLgC39ZlSEibmrfYyfqMOApa4x8yXn1z ZQ20hFQSXfB9dvUPMyxts48As1vjjbDV08q+EVyrfATm7sByBcd0P4n/MKHCRj8LWwaL fXc7obb7Kz5JCy5Xhvo/YnGIKI7QwShV5iyBTXvgvLNX+NMeVYGqQTLP9NTTAyyEoK6k PGBg== 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 Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b00564bdf6958fsi2735317pgb.649.2023.09.15.00.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 00:04:36 -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 C72FC83D6DE4; Fri, 15 Sep 2023 00:02:40 -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 S232524AbjIOHCb (ORCPT + 99 others); Fri, 15 Sep 2023 03:02:31 -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 ); 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 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 CC: , , , Vincent Whitchurch 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: 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:41 -0700 (PDT) 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 --- 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(+) 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; } --- base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d change-id: 20230704-power-of-4e2ab0bbe48d Best regards, -- Vincent Whitchurch