Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1963641pxb; Fri, 5 Mar 2021 04:15:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJylwy0mZexYiPJPohZENMrWY+LEh2kkXTGYRCB1kHFFOsWKaGkSckxJ1TD7HGm4vuP13yF0 X-Received: by 2002:aa7:d8da:: with SMTP id k26mr8909978eds.364.1614946523373; Fri, 05 Mar 2021 04:15:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614946523; cv=none; d=google.com; s=arc-20160816; b=UvCayxQ6qnPC2aVrtnUYjrDFN12le7vMPgxA23syFHsk6F5MUWdc9HJ7jDn6/7Q2Tc 2QvVtBRSmjIjvaDZZDPQqAjlTQhHKv6YBdYgVSJkHmdPpq6xUW18kN3g/sxBon1q4n3O Tt/xAfqmurMYgtEcmzDsUvuGcwNrKwPLSYaNtIieEN90k2p9PZ98Ol+JBWTH/scx52/n ldSxQVkN5gx/q6JvbvFlgIoK5v8YMcPu4pOSo2ypFlrMc7xqzYjHFov3G8swYH8bAOoa zNpGkCmbQuNH9bRyxUBzX/8FnmEw3mboK0xqQcb/5d1uubbAZ+lT7ANHKyqmzDyKQP6o RvVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=2NjuYTM9l7jbKL6YFnbo8wVJwy6agKcA9gTwW2IGa9w=; b=zFlvRqmOmFfjZ2ffcBapr8gzHqn5e7TnTQoZ5/3H0nzzj/OoDEgnWDCRUXjTlH2uh1 kG6oinnd1I6pY3CzL25Jy8weDHOL4PS+spG26rPXKl/8ZbPrQKNc2j3yo2Bqi16yt65g eUYychIEf06oteZE01G7Dq6/qJFLf5E2rgshkZeRtEEEPsnUNVMQpBw9/IFlQiTD0dU7 lHch3LTHh367HrAQUylkz+TOl92cPIezMvQpcAmex4T5/XHgOpxgNSnsW/2TtoK9PhMg OfisJdUfkL11gNN67a+TbtKE9cINh+Jyo1j6i76SbvrtqqTP3oBlyEbmryJ2uFuIlWz8 4nuw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zd21si1226379ejb.634.2021.03.05.04.15.00; Fri, 05 Mar 2021 04:15:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbhCEMLs (ORCPT + 99 others); Fri, 5 Mar 2021 07:11:48 -0500 Received: from mail-out.m-online.net ([212.18.0.10]:51067 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbhCEMLm (ORCPT ); Fri, 5 Mar 2021 07:11:42 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4DsRRd3SXnz1rwvQ; Fri, 5 Mar 2021 13:11:41 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4DsRRd2cq4z1t6p7; Fri, 5 Mar 2021 13:11:41 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id hsGGW03H61Os; Fri, 5 Mar 2021 13:11:40 +0100 (CET) X-Auth-Info: 2XhycVN/LrOWsQxHHY+VGHxDI8i0UnrgNytFXzBWN/A= Received: from [IPv6:::1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 5 Mar 2021 13:11:39 +0100 (CET) Subject: Re: [PATCH v1 1/1] gpiolib: Read "gpio-line-names" from a firmware node To: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Bartosz Golaszewski , Roman Guskov References: <20210305120240.42830-1-andriy.shevchenko@linux.intel.com> From: Marek Vasut Message-ID: <506c1e48-c648-69d4-8e4f-b42fe02156f7@denx.de> Date: Fri, 5 Mar 2021 13:11:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210305120240.42830-1-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/5/21 1:02 PM, Andy Shevchenko wrote: > On STM32MP1, the GPIO banks are subnodes of pin-controller@50002000, > see arch/arm/boot/dts/stm32mp151.dtsi. The driver for > pin-controller@50002000 is in drivers/pinctrl/stm32/pinctrl-stm32.c > and iterates over all of its DT subnodes when registering each GPIO > bank gpiochip. Each gpiochip has: > > - gpio_chip.parent = dev, > where dev is the device node of the pin controller > - gpio_chip.of_node = np, > which is the OF node of the GPIO bank > > Therefore, dev_fwnode(chip->parent) != of_fwnode_handle(chip.of_node), > i.e. pin-controller@50002000 != pin-controller@50002000/gpio@5000*000. > > The original code behaved correctly, as it extracted the "gpio-line-names" > from of_fwnode_handle(chip.of_node) = pin-controller@50002000/gpio@5000*000. > > To achieve the same behaviour, read property from the firmware node. > > Fixes: 7cba1a4d5e162 ("gpiolib: generalize devprop_gpiochip_set_names() for device properties") > Reported-by: Marek Vasut > Reported-by: Roman Guskov > Signed-off-by: Andy Shevchenko Tested-by: Marek Vasut Reviewed-by: Marek Vasut Thanks > static int devprop_gpiochip_set_names(struct gpio_chip *chip) > { > struct gpio_device *gdev = chip->gpiodev; > - struct device *dev = chip->parent; > + struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev); You could make the order here a reverse xmas tree, but that's a nitpick. [...]