Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp538313pxf; Wed, 10 Mar 2021 11:16:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxl2qEtzzr4prIGPttKur92Owo3HGGapLfUrb+Tgv8q+Foo2D4OtO9d/1e10U6vyfEpo53J X-Received: by 2002:a50:f113:: with SMTP id w19mr4931134edl.226.1615403769938; Wed, 10 Mar 2021 11:16:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615403769; cv=none; d=google.com; s=arc-20160816; b=m6V8iqLl7t+Juhq2X8mIssZOsbNyu1+++YS6sogPcxqjWiwaguG3Svhw+wQp4rY/c4 9PE37exkrjmV45s3rLItOYAwvegkY3ayUEGY1Kb/jujcYnGV5p9u642dtTRB5fyra81Y 3ntuTbPVqx76AGl0S+RzmDyXCTbg1w48caXiAR/ZcMzhvPnK+KnOR2s1ksAqcL3BoNLV kx1Cl0n4cd/MoajJ1HexCmd5Clhiyq7p/BLqG5lbLO8B/KVu5+uQ2UHnpp6+R2OAxs3S rsByX6DiZ0lsZnXfzBalhFnmE4iUGabjl5cl9yFJJqND8Kisa3PT1kTDX4CsofRgajBa thow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=INYKDm2dkWL3HE2MRCJAw093pEqyLHWbGAiMdHovjhk=; b=KmPINVb+vJdvq8tP6tPCuIMGueAAIOEWBNMQJnI1PDtBaj5teNxQi0TkhDI2VUA4eY CMa9QhkIZohJid90SqeQHNInSBFuTgoIEq6CB0TcjwRF3da+PRMXEInHr1j27c3WEY0X NWWaImI+4Y0+jUgMOUjFR8X308lWquOj6ZzkjXBxTAQcvrIS/zLbyNgFb9frUYqD0GNL oKXmFUtFEB7dW4AcpKNPSVqM23ip4PT4HglWdjvpaYb/gQZclYCC88NVYQef/Z9WMXy6 LxXcXDSLmmwjfPwRe65I9Owc04/c+TaXlgsrm63nJJkqp5uZkJXvmpKqvzNixQHyfHyg j47Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mAmxOdjf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si170939ejd.252.2021.03.10.11.15.47; Wed, 10 Mar 2021 11:16:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mAmxOdjf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233446AbhCJTMt (ORCPT + 99 others); Wed, 10 Mar 2021 14:12:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233182AbhCJTMb (ORCPT ); Wed, 10 Mar 2021 14:12:31 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 882C3C061760; Wed, 10 Mar 2021 11:12:30 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id u14so24574167wri.3; Wed, 10 Mar 2021 11:12:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=INYKDm2dkWL3HE2MRCJAw093pEqyLHWbGAiMdHovjhk=; b=mAmxOdjfbEfZnSsdD1Ad2PsBOumA9wyfB8ymlbOx8psLBmdUdXGj4WMYr5pGdhp7Pn GY1C80JK55Q5Cxf0XQom9oJw55P5RRNsN3/rgjSPNFHQpuLu4M+q9Kdd4uwsI+G/2++8 c+ZvlreERo8wdkgmWUulChN1+wuLi2IKQ+sxUUnDCOZIqJyFrR0rI5NpQcQtpDYWF4e0 8t1611ZFg/SS/kD3K7XL0T65gA9nNbg94RY5r07mmt8TmuOOgVK3fXwRotr48nh/rNDY LDaNiAV5ogHWjY99yqGUGZQel3RngNE9A0rQe+5e/LhBfhAtix5cHBQM3rutBv98Pug3 DmZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=INYKDm2dkWL3HE2MRCJAw093pEqyLHWbGAiMdHovjhk=; b=eJ52QtZ5pe8B/fkvcZ0F/xCG86UdDpPUrfZPJmPXuN2njbe0/PU/x4VLDc6foRpqkI yy0giwwsWLjZrVbVBrbmjiKHabjkDjUsK2Kz/5z4EF6h5piHE3b2sVebaOrkVxEmPUnE Tmrv9tUOgu5q0A33VnpBFlzXxqwSmqbQhNOftQx/vqTzY0ORUtKAOw6ndc8AYJ+LF1qR UKvuYZKV0rNX3UAzaAXz2tJQpeewf++hYFT5nJfa8ncRhLojI94u2m66Jj/KljpLYihL ZCvytYBn1TH1SH0UZgLZXuUsFjNPySCvXk/TtKw2d0MvbdhFH7+0tZLvoUw5CDhGl1xY NX4A== X-Gm-Message-State: AOAM530fGTxwm0pUvsRx1cWz/LWmzKHC9Qy4qgYltSx+6KMtQIToWYi1 abQ04OLwoKuhTgACdY4h7wY= X-Received: by 2002:adf:d1ce:: with SMTP id b14mr4996560wrd.126.1615403549157; Wed, 10 Mar 2021 11:12:29 -0800 (PST) Received: from macbook-pro-alvaro.lan ([80.31.204.166]) by smtp.gmail.com with ESMTPSA id h25sm452790wml.32.2021.03.10.11.12.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Mar 2021 11:12:28 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: [PATCH v6 02/15] gpio: regmap: set gpio_chip of_node From: =?utf-8?Q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= In-Reply-To: <7e35bfd395f3ae40029b0f3cb2bc8f70@walle.cc> Date: Wed, 10 Mar 2021 20:12:27 +0100 Cc: Linus Walleij , Rob Herring , Bartosz Golaszewski , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Jonas Gorski , Necip Fazil Yildiran , Andy Shevchenko , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20210310125504.31886-1-noltari@gmail.com> <20210310125504.31886-3-noltari@gmail.com> <7e35bfd395f3ae40029b0f3cb2bc8f70@walle.cc> To: Michael Walle X-Mailer: Apple Mail (2.3654.60.0.2.21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michael, > El 10 mar 2021, a las 19:27, Michael Walle = escribi=C3=B3: >=20 > Am 2021-03-10 13:54, schrieb =C3=81lvaro Fern=C3=A1ndez Rojas: >> This is needed for properly registering GPIO regmap as a child of a = regmap >> pin controller. >> Signed-off-by: =C3=81lvaro Fern=C3=A1ndez Rojas >> Reviewed-by: Michael Walle >> --- >> v6: add comment and simplify of_node assignment >=20 > Ah, I see you add the comment for the documentation. Nice. But I'd > like to see it in the code, too. See below. Ah, sorry for that, I thought you wanted it on the header. Excuse me for that... >=20 >> v5: switch to fwnode >> v4: fix documentation >> v3: introduce patch needed for properly parsing gpio-range >> drivers/gpio/gpio-regmap.c | 1 + >> include/linux/gpio/regmap.h | 4 ++++ >> 2 files changed, 5 insertions(+) >> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c >> index 5412cb3b0b2a..d4fc656e70b0 100644 >> --- a/drivers/gpio/gpio-regmap.c >> +++ b/drivers/gpio/gpio-regmap.c >> @@ -249,6 +249,7 @@ struct gpio_regmap *gpio_regmap_register(const >> struct gpio_regmap_config *config >> chip =3D &gpio->gpio_chip; >> chip->parent =3D config->parent; >=20 > If there will be a new version, please add the following comment: Right now I don=E2=80=99t know that either, because I=E2=80=99m honestly = getting tired of this=E2=80=A6 >=20 > /* gpiolib will use of_node of the parent if chip->of_node is NULL */ >=20 >>> + chip->of_node =3D to_of_node(config->fwnode); >=20 > Otherwise, it is not obvious that config->fwnode is optional. Yes, you=E2=80=99re right. >=20 > -michael >=20 >> + chip->of_node =3D to_of_node(config->fwnode); >> chip->base =3D -1; >> chip->ngpio =3D config->ngpio; >> chip->names =3D config->names; >> diff --git a/include/linux/gpio/regmap.h = b/include/linux/gpio/regmap.h >> index ad76f3d0a6ba..334dd928042b 100644 >> --- a/include/linux/gpio/regmap.h >> +++ b/include/linux/gpio/regmap.h >> @@ -4,6 +4,7 @@ >> #define _LINUX_GPIO_REGMAP_H >> struct device; >> +struct fwnode_handle; >> struct gpio_regmap; >> struct irq_domain; >> struct regmap; >> @@ -16,6 +17,8 @@ struct regmap; >> * @parent: The parent device >> * @regmap: The regmap used to access the registers >> * given, the name of the device is used >> + * @fwnode: (Optional) The firmware node. >> + * If not given, the fwnode of the parent is used. >> * @label: (Optional) Descriptive name for GPIO controller. >> * If not given, the name of the device is used. >> * @ngpio: Number of GPIOs >> @@ -57,6 +60,7 @@ struct regmap; >> struct gpio_regmap_config { >> struct device *parent; >> struct regmap *regmap; >> + struct fwnode_handle *fwnode; >> const char *label; >> int ngpio;