Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1972113pxb; Fri, 5 Mar 2021 04:28:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2NbECY9IKR6v+E2OA3piphIExe93KXjoxwEg0dgUppiqrvAE0cMS4nkTZvbfP3wfKEwtx X-Received: by 2002:a05:6402:510f:: with SMTP id m15mr9008307edd.78.1614947335051; Fri, 05 Mar 2021 04:28:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947335; cv=none; d=google.com; s=arc-20160816; b=l3YNxmZMRQtShBCPIHhyHV6mW4jMRcZfq/AZ2VDvt28MquTJr37fdKcVxPP8WTiHDW EDFCHI/p7XzBucOOgXJWImSfrsr6HZB5rZoxLPR8EPaJt3HpZnvsg44lFXwZM4eYdh7w RutRTJm46MdbkCa8HKbkQXcdv157J+nV5BlgLL6JaxXyxo7cL4TYEWJIaOo++FvZugae NtkkiRY236jFPX5HWAm8W2lLUeA7iA8gKvPILRWPBNAsOeZlRTL0popgdLmeHcjPrSQI 7HUbh5U7S5k2UokbIs3egbK3/J6yKKgHqZtyKw5WaNeHeASOLHP/em5Cvfufu910Eowg J83w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=CCeljuM+vB7U6nIqlKvQ6ps0bw3K9fcvnNsusYaOPSo=; b=D2PPaLf/4IvTH0xmvSlLd9wIeItTyGFjmKVzIJlNPjWMTsZfwFa8oGDbXAv/XPhZxN B6Vw0KaY+piUVGFpYOCKCVxYnS0qVv2J5u+Tff+itUaQxb274qmKIfCyNLuRBHIuQxr6 3DvmNs1Rq4PlpEm1eH0hfFpj3K94ctZqg+tr98wVoYaco7jATOjSsT6db5FXKKpx/ThV GjKjPwHQm6paUBVe1ozmdyv1gWq4bQ1fWyxELg7qQ65jcbkQWNao4l7r5f+bfldVejzD UntI6dMPr3h2IRArBa6O+zC9jyEUIlbcd2usFVWzKq0I140RNsoE1mnEQcdjaLGX55w2 LjMw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm15si1278309ejc.270.2021.03.05.04.28.31; Fri, 05 Mar 2021 04:28:55 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231269AbhCEMZc (ORCPT + 99 others); Fri, 5 Mar 2021 07:25:32 -0500 Received: from mga02.intel.com ([134.134.136.20]:39041 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbhCEMZD (ORCPT ); Fri, 5 Mar 2021 07:25:03 -0500 IronPort-SDR: nJSO2EIz82aZBhBvW+FQOGeDyug3rahERXqXni85n2baigdj6pOBbuViFzmKxpznZ7kCjnOB5/ p0O1ghV/y/7A== X-IronPort-AV: E=McAfee;i="6000,8403,9913"; a="174754639" X-IronPort-AV: E=Sophos;i="5.81,224,1610438400"; d="scan'208";a="174754639" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2021 04:25:02 -0800 IronPort-SDR: F9VsvIGTk9t5fdi8BGF3w5v2svrB0+16BCW3HgSXTwhLkEQReS98mrS5h9fB6HwhDuEeilVy2H xTBlkANB0RHw== X-IronPort-AV: E=Sophos;i="5.81,224,1610438400"; d="scan'208";a="507983703" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2021 04:24:59 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lI9Vp-00A7Rv-1J; Fri, 05 Mar 2021 14:24:57 +0200 Date: Fri, 5 Mar 2021 14:24:57 +0200 From: Andy Shevchenko To: Marek Vasut Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij , Bartosz Golaszewski , Roman Guskov Subject: Re: [PATCH v1 1/1] gpiolib: Read "gpio-line-names" from a firmware node Message-ID: References: <20210305120240.42830-1-andriy.shevchenko@linux.intel.com> <506c1e48-c648-69d4-8e4f-b42fe02156f7@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <506c1e48-c648-69d4-8e4f-b42fe02156f7@denx.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 05, 2021 at 01:11:39PM +0100, Marek Vasut wrote: > 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! > 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. They are dependent, can't be reordered. -- With Best Regards, Andy Shevchenko