Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3358397pxf; Mon, 15 Mar 2021 07:55:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl9nZK9iKKVKea0FLUeRxUb2ROaepinAlIp4bPIF+negOyKZa7mlH12ay3alGcqCgbt4l4 X-Received: by 2002:a05:6402:1c98:: with SMTP id cy24mr30408048edb.296.1615820140856; Mon, 15 Mar 2021 07:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615820140; cv=none; d=google.com; s=arc-20160816; b=cRonaRsA4/RQj/SbN8EqF6TQpbNf6U95XHpYKfh7t/w0WZbbb6a4GTPLtQ1FJEHDBn MCIBNKAMUKExHJXfuHA6bast6CJOuxRwc7EQRLKNSpvuFXOOQUwdVPIdsb66sJjo8u+/ vybpkG1BFZ0UnNDA04VzpysWPu5nAR2HgNscjAQge4cvDu6sMhFL9Yvo8nBMToiq2d6M 4L+KCYfTCfZt5zuQHfmagDvBmVjfqZs9IZHLdDQdsNUDF9s2BSoaNcStkonYxwjqo4hm iei63tsiIx59OAe4bn3quTbRG9Ny+yb1twQRpqp6CDkhWq/tIxyvRwE70+qUVACh+Fe0 YL6Q== 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=YNKfQ9w0YDWO9bzBjfeAOfKkMPsYorI7RSkjPTIYN14=; b=wUsugk0meq2ve+33/sSy8hkCcIaNqIuy+tHmmo/mdN/kpnFRHJT5nh2THPH5yn+M7V 4o9wBL55kUFx345rg5x+E77goeDvCFFlgw6Twq+0N6/5/TDJDXsZBLcp775lymaF5JQK e4QO6H+ze5Cgz7ge0st6a0y+NeXgezB8Hycete/5NDhVev+ALPiRdISSivoweQeXWcZi hrlHfkcjdoRTkoySyQxN4S5prMYcnPMXg0cSBx8XB1TfZ9RahJ8AqJsAzrDOxv8IV1+a WWzPY3CFWn0h8Z3pyhb1XiBsMZYmhc5D1tNWUgwv9xJpPovQ/VEDDmV8VN3GDnhv42jZ QAxQ== 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 b13si11979258ede.461.2021.03.15.07.55.18; Mon, 15 Mar 2021 07:55:40 -0700 (PDT) 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 S237953AbhCOOvA (ORCPT + 99 others); Mon, 15 Mar 2021 10:51:00 -0400 Received: from mga11.intel.com ([192.55.52.93]:43311 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236206AbhCOOev (ORCPT ); Mon, 15 Mar 2021 10:34:51 -0400 IronPort-SDR: g7IVeUrWhZIslGevpZRSnYlT5A+7xEPohitVdDp8StW7HKvMnIMthQ7vfm7/zkeZCxNh4mRcai 5xXs2DMejg3g== X-IronPort-AV: E=McAfee;i="6000,8403,9923"; a="185737379" X-IronPort-AV: E=Sophos;i="5.81,249,1610438400"; d="scan'208";a="185737379" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2021 07:34:49 -0700 IronPort-SDR: lhYcnUSY8vMDAX/iSTPuMCxtIWdiqW1SNi23o6Kk6P4T56JL+65+nAkyfj+NMAVbA6yOUvLmeG 7Lk/4M2nRHKg== X-IronPort-AV: E=Sophos;i="5.81,249,1610438400"; d="scan'208";a="449383288" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2021 07:34:47 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lLoIu-00Chac-SN; Mon, 15 Mar 2021 16:34:44 +0200 Date: Mon, 15 Mar 2021 16:34:44 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Linus Walleij , Bartosz Golaszewski , Marek Vasut , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 15, 2021 at 03:04:37PM +0100, Bartosz Golaszewski wrote: > On Mon, Mar 15, 2021 at 1:50 PM Andy Shevchenko > wrote: > > > > On Mon, Mar 15, 2021 at 12:16:26PM +0200, Andy Shevchenko wrote: > > > On Mon, Mar 15, 2021 at 10:01:47AM +0100, Bartosz Golaszewski wrote: > > > > On Fri, Mar 5, 2021 at 1:03 PM Andy Shevchenko > > > > wrote: > > > > > > > Unfortunately while this may fix the particular use-case on STM32, it > > > > breaks all other users as the 'gpio-line-names' property doesn't live > > > > on dev_fwnode(&gdev->dev) but on dev_fwnode(chip->parent). > > > > > > > > How about we first look for this property on the latter and only if > > > > it's not present descend down to the former fwnode? > > > > > > Oops, I have tested on x86 and it worked the same way. > > > > > > Lemme check this, but I think the issue rather in ordering when we apply fwnode > > > to the newly created device and when we actually retrieve gpio-line-names > > > property. > > > > Hmm... I can't see how it's possible can be. Can you provide a platform name > > and pointers to the DTS that has been broken by the change? > > > > I noticed it with gpio-mockup (libgpiod tests failed on v5.12-rc3) and > the WiP gpio-sim - but it's the same on most DT platforms. The node > that contains the `gpio-line-names` is the one associated with the > platform device passed to the GPIO driver. The gpiolib then creates > another struct device that becomes the child of that node but it > doesn't copy the parent's properties to it (nor should it). > > Every driver that reads device properties does it from the parent > device, not the one in gdev - whether it uses of_, fwnode_ or generic > device_ properties. What you are telling contradicts with the idea of copying parent's fwnode (or OF node) in the current code. Basically to access the properties we have to use either what specific driver supplied (by setting gpiochip->of_node or by leaving it NULL and in this case gpiochip_add_data_with_key() will copy it from the parent. That said, we shouldn't care about parent vs. GPIO device fwnode when reading properties. So, bug is somewhere else. In any case, I will test with the gpio-mockup, thanks! -- With Best Regards, Andy Shevchenko