Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp889685rwr; Thu, 4 May 2023 10:55:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7X8V23Iiwh8IZEncB+dR/ge9TVklmPeXeixH2ci6rch74UVBNSN09VGzJJWzwYxO35ibI6 X-Received: by 2002:a05:6a00:18a1:b0:63b:19e5:a9ec with SMTP id x33-20020a056a0018a100b0063b19e5a9ecmr3608883pfh.33.1683222951945; Thu, 04 May 2023 10:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683222951; cv=none; d=google.com; s=arc-20160816; b=E9MqT3FsIu//J7Yfo5796wyIkLstvGdaUQZj1JLmYGSqoDKIEA36EGgmEb78XYsLdU kKKEGhtyaTTUcGDID+BE8eFb5GpKaIMgqEahIsfvCqrhWNAOA2pthLvCghdVwS9o2PDS Fb7jVVzZ1fDleR/9LbDOOHZTAlVvQoBsUjv2yjT0NPeAjxTdF4ApzOhUQY7Ea5UKDSOm +5E7WOt57Z499JHd5nMTllCrew9NYn29NBi27ZxUDBSb4Yze2Dk1jN/7Enej88c+YeND kxjC4SBLWOwverFH94NIpxBVXg7M2ibwC134msPu+9ZxK9182b4w0677CgMBqGf4Wfd0 xVrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oNg7Ay8BaisgoI4pN5C7u/ZJLI/+jA+lB58raKMMJJg=; b=bSvFRcgOt9263oaUJ6Ou27ZPAnN1JHzfI+MhCw0kiaSA3/Pu+SpqnfawGZyLse/7Qf yS6yaEBJQudgRw40esz4RImOB1UWB+vEyR2UNwIcV/7lzQKztUXmgHuveBdzY6m9zbos wtktMTbTWBx0IqpWf2sjMwogfamt0nXA9uafwNLCsVk7eVItNeQMWJ6Zk6tOh3H2mbNa KN73C5TgzlLutyMBTVNyknXnCl3dquIUPjDRGib+s6lJF2dIq25/VdKwoQEmAO6FPNqk KxmCrCrjp4VK0jd3ZfpZ8NgIbFJC47shWVLbr5JShS9Q3lZ5I2GQH4LoQh3Q+e30+NJE HP0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="QloSqe/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h189-20020a6253c6000000b006414f28725bsi11796486pfb.195.2023.05.04.10.55.36; Thu, 04 May 2023 10:55:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="QloSqe/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbjEDRgy (ORCPT + 99 others); Thu, 4 May 2023 13:36:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230033AbjEDRgd (ORCPT ); Thu, 4 May 2023 13:36:33 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CA2F5589; Thu, 4 May 2023 10:36:28 -0700 (PDT) Received: from jupiter.universe (dyndsl-091-248-211-176.ewe-ip-backbone.de [91.248.211.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: sre) by madras.collabora.co.uk (Postfix) with ESMTPSA id 3F5BE660570C; Thu, 4 May 2023 18:36:25 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1683221785; bh=JRA4rbYQN2WDlDgM+lLQRDDOel1gAU5BBrsIXnna0m4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QloSqe/jj/e26mZoAG5vmD3/CbwN4VG+cv1oO/+SWmhPrM4xtg2iO3Qk+vpFx5yMy /qz90hRCC/zMMA8iRWgAJLKvp0iBt/+B9B+hzMYAAu5qXVRQ+lnR7N/KD82TZNqojt KxZXAX7YvwlknmuTGvyOZJCSrgzuUrHkzZlQ4tA+XfDiraD53RxyI/hajGpv3l/76t 9csVJNsfUy5ObTRhZTXWkpRKFV6NzNIEYytnd5Vo781J+tOqBfh7g61k5WVXH4EMYX IYM+LRMHE0Cek0I/swQY21Rs2LU+oDxlHZLHFJVesNoBNpVSklCMIK1PinNoWR7qBo m3H3nLQzdPmSQ== Received: by jupiter.universe (Postfix, from userid 1000) id E751A4807F7; Thu, 4 May 2023 19:36:20 +0200 (CEST) From: Sebastian Reichel To: Heiko Stuebner , Rob Herring , Krzysztof Kozlowski , Lee Jones Cc: Michael Turquette , Stephen Boyd , Linus Walleij , Mark Brown , Liam Girdwood , Alexandre Belloni , Alessandro Zummo , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel , kernel@collabora.com Subject: [PATCH v8 12/14] regulator: rk808: cleanup parent device usage Date: Thu, 4 May 2023 19:36:16 +0200 Message-Id: <20230504173618.142075-13-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230504173618.142075-1-sebastian.reichel@collabora.com> References: <20230504173618.142075-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org By overridering the device's of_node a bit earlier we can get the GPIOs and any other DT properties from our own device instead of relying on the parent device. Signed-off-by: Sebastian Reichel --- drivers/regulator/rk808-regulator.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c index 80ba782d8923..71a1ca8b917e 100644 --- a/drivers/regulator/rk808-regulator.c +++ b/drivers/regulator/rk808-regulator.c @@ -1245,20 +1245,19 @@ static const struct regulator_desc rk818_reg[] = { }; static int rk808_regulator_dt_parse_pdata(struct device *dev, - struct device *client_dev, struct regmap *map, struct rk808_regulator_data *pdata) { struct device_node *np; int tmp, ret = 0, i; - np = of_get_child_by_name(client_dev->of_node, "regulators"); + np = of_get_child_by_name(dev->of_node, "regulators"); if (!np) return -ENXIO; for (i = 0; i < ARRAY_SIZE(pdata->dvs_gpio); i++) { pdata->dvs_gpio[i] = - devm_gpiod_get_index_optional(client_dev, "dvs", i, + devm_gpiod_get_index_optional(dev, "dvs", i, GPIOD_OUT_LOW); if (IS_ERR(pdata->dvs_gpio[i])) { ret = PTR_ERR(pdata->dvs_gpio[i]); @@ -1292,6 +1291,9 @@ static int rk808_regulator_probe(struct platform_device *pdev) struct regmap *regmap; int ret, i, nregulators; + pdev->dev.of_node = pdev->dev.parent->of_node; + pdev->dev.of_node_reused = true; + regmap = dev_get_regmap(pdev->dev.parent, NULL); if (!regmap) return -ENODEV; @@ -1300,8 +1302,7 @@ static int rk808_regulator_probe(struct platform_device *pdev) if (!pdata) return -ENOMEM; - ret = rk808_regulator_dt_parse_pdata(&pdev->dev, pdev->dev.parent, - regmap, pdata); + ret = rk808_regulator_dt_parse_pdata(&pdev->dev, regmap, pdata); if (ret < 0) return ret; @@ -1335,8 +1336,6 @@ static int rk808_regulator_probe(struct platform_device *pdev) } config.dev = &pdev->dev; - config.dev->of_node = pdev->dev.parent->of_node; - config.dev->of_node_reused = true; config.driver_data = pdata; config.regmap = regmap; -- 2.39.2