Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3452669pxf; Mon, 15 Mar 2021 09:50:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCUUNrGenmcnVqB65yQjiL069+bcbukcawsCR9GYpGbm5Q4agD74GH2XQ5naCH8eguIoq/ X-Received: by 2002:a17:906:400b:: with SMTP id v11mr24567281ejj.194.1615827036972; Mon, 15 Mar 2021 09:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615827036; cv=none; d=google.com; s=arc-20160816; b=Cp2vFCeZ+xeABlZcZYKAiZwySgj+IQHH0TiJtx9DfLnmTaC4ScB6+qm1BQmzQkci1k hqbA5WPHPx3AWLaZ+PbSBvY4wAW6ibR7hjnLRLiUu3GmIMgO8yfTyBJ+LZX/PLql/PIw BCnvpZG6qdTsb3EM3NCLR26b1dkBwp7XF9Iq2NCvMiXCwK0D7Xxn+6TBn3FonkJa6OyX seKgTa73kk/9tjfg9OaDPKjk027JG/SSMffrMq0A7Ke7gv+BGS7D6AnJ7lS4HTM5T6My jdBgLzw2rmmC3xmRkkjArJZNFA2nEFOcjuOIH+AU39nBUj+8eumhD1KDLL8ShQG5Ztpp PUEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=R7MyrsFfIqiQG50IuRjCCrpFO9gLvQ3bFYxbpODTywo=; b=nuuXzw8YFxEEA8ecNJ1kDfXBWi7N824UGS8mOiWyb0kg95GXU2KAWXvRFqbiXShPoC eRwcaCfzJDdy0S3o3LbRUtR1zoDQlTNWdqtFRBLkZ8QqLrEoF1fjgR7ZX9ojW+fZ92WH /JjrbV/6vjSHSUT6KLwVT9+tY6o5+BNA8lkBXO0ivuwhN+HQ1IdH2eBAOAt8ksQsPFSj 6fCDpb7RlUHbufpUnu/lp8WmNrAEsuvPcMCmkAb3OCWrMLk4OVKoGnhA55VADPc7tqPA 0nkj4fIz9b1J9mvxUAyZKg1R+PGz9nUZ909fP/vWcLh5Wq8ozmCc7SY9C8cIevNU/pKv /M3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=e1yO9Wob; 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 d21si11308588ejw.331.2021.03.15.09.50.14; Mon, 15 Mar 2021 09:50:36 -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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=e1yO9Wob; 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 S229814AbhCOQse (ORCPT + 99 others); Mon, 15 Mar 2021 12:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbhCOQsQ (ORCPT ); Mon, 15 Mar 2021 12:48:16 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F3F8C06175F for ; Mon, 15 Mar 2021 09:48:05 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id dm8so18152028edb.2 for ; Mon, 15 Mar 2021 09:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=R7MyrsFfIqiQG50IuRjCCrpFO9gLvQ3bFYxbpODTywo=; b=e1yO9WobmXZ0dEf9C1lw4cJtss53NYsmCr+ldwukP+xJwC0X+017jAmRUoZXhoL+bW hXcs8jX/GFTZuw9OCJuPOXzi/Of0e5T26kbm4uJBLWNXcUOzMMmuhpKMqp6r3F/DpwL+ hER/AaghWunEnboCoIffiVPGg2gM2QkMxPufollZBoUxr1TRCyG+nkvOgNw/ZwX6nfNh nNEqQwk+IzqBWkMKKXCPt77UjxZEbhVtsQyxOHfuI+qxXnCv1fTWnFS6B12o4Sl+NpW0 Avh0HcbvqHNyW8Esb9IXD6d8nZUi0BdV9+LkiCiBhvcY6U8d6wluSEScf1lj5/whd+Kj 8Sfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=R7MyrsFfIqiQG50IuRjCCrpFO9gLvQ3bFYxbpODTywo=; b=aFVQjnZGrjnlDPDnyZWBdbSVYKHysuP9G9YIlsu82eYfqphIXkSrFvXBknIBFeu6hs pZybdPyABCQXj1nLNzbMOd9Ut9tRX1ZOR+qxGQK/XSxcT3e/Nctnr5RRM7rc4BNhptb0 CpdKJ9CHYjgVH4XAhbcS0ap8Ho/XCq77xiKOIOnZ8N1nFMHVGqJItpV2s1WitE5AJsKq WZmy5glJqF67SU46lm4CLRfnZXEgQh9xEAhVMRwOfrtDNP07bETxvvJNT52HcucGW0vg DsqWDwntVAA6jCz2MXOi4YUWzDAr7lG8nILVt+DevQ8n2+psD/3HoRZ3wabWcRdm1z5c yP8w== X-Gm-Message-State: AOAM531FDSAAmvPUvHZZaVG/ofabQVzdw4VdZ26Csg9fnfRu3t1vKMml mCmnK/QELtfq+7Vquei9zaf65g1Q7bRWpkI4LzfhxA== X-Received: by 2002:a05:6402:b31:: with SMTP id bo17mr30973965edb.113.1615826884243; Mon, 15 Mar 2021 09:48:04 -0700 (PDT) MIME-Version: 1.0 References: <20210305120240.42830-1-andriy.shevchenko@linux.intel.com> In-Reply-To: From: Bartosz Golaszewski Date: Mon, 15 Mar 2021 17:47:53 +0100 Message-ID: Subject: Re: [PATCH v1 1/1] gpiolib: Read "gpio-line-names" from a firmware node To: Andy Shevchenko Cc: Bartosz Golaszewski , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Linus Walleij , Marek Vasut , Roman Guskov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 15, 2021 at 3:34 PM Andy Shevchenko wrote: > > 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. > Ha! While the OF node of the parent device is indeed assigned to the gdev's dev, the same isn't done in the core code for fwnodes and simulated chips don't have an associated OF node, so this is the culprit I suppose. Bart > 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 > >