Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3464864pxf; Mon, 15 Mar 2021 10:06:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhZ28mYXzT+QngZ7QfalU+8Wet1owYrN3u5zttfU99btqGpi2ZEMiWLdoWo5AmzthGhl/2 X-Received: by 2002:a50:eb97:: with SMTP id y23mr31316352edr.170.1615828017432; Mon, 15 Mar 2021 10:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615828017; cv=none; d=google.com; s=arc-20160816; b=d3QcHThoAqnoXg/k3si+KoPxm9ug04eY+O9EYKtd/oD0aoeq6vf98nYqWh5Yhv4gl0 gKLMAGgeFLIeND3LlSjVj5OV4Nf9lNm4fy7lDhW3L84lnRE+WJ7nnRQm+5drPaz9Krjz MmwZKyR8/Yh4WqFLtZq89nb9NJ7Z6O4HQ7cp/dQVLT3yf2SVn9dkUgEwmo9F69IKjtm2 zgEOK2uO4F8uW/H09uDgk85jhI19vVwoCu8RSrGTCR39xommaOB2Oe9EhxFQLu5sB2g+ GuGs2UBqqayRcRwUe0XD+BAhC4McLmlxm6Kysb+MzLts2SgkN/e4eppQb1cuk+QL26OA liAQ== 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=ZYQCRNn81lFAL6SPD/yp7d53z2RJAlRcSF3q2qdHaNk=; b=T+rTQ2fauSXmhB1814/AMOeGcCG6LwbCV/6NaB1TwhR9bZw+Cn5nJzY2V4MtZ83eLU 4pmIkwPxtC1xzTielA+Geex6aC7IRwLhGGUvodpi5c8bBQHPckewTYy3qdxg1NjizIgo FSKSFwL7JVl5W8vW2Pg49kjH/WwdheVLDfXhD5/sF++XSGlMjKgZNRjwwBaYbSNSMtAi dlTpzPg+lGrY+p2Wfy7CiBfJxdPf4r7UDxh9mT9KyrHujtnk2oo1VE9FqJ+dSuBX7Ryo LIhQRmqRZCYu5DpNVj5tHMGHEiYdWa6WD/vgkD1lBL/kq73RNcQCRMglNZCVXhy+mcW4 Ph7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eWTIKTZp; 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 dn6si11989984ejc.637.2021.03.15.10.06.34; Mon, 15 Mar 2021 10:06:57 -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=@gmail.com header.s=20161025 header.b=eWTIKTZp; 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 S234682AbhCORFJ (ORCPT + 99 others); Mon, 15 Mar 2021 13:05:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231442AbhCOREz (ORCPT ); Mon, 15 Mar 2021 13:04:55 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 758D1C06174A; Mon, 15 Mar 2021 10:04:55 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id c16so15636912ply.0; Mon, 15 Mar 2021 10:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZYQCRNn81lFAL6SPD/yp7d53z2RJAlRcSF3q2qdHaNk=; b=eWTIKTZp7gDs6a8TnEbG07ZEl2WN2lv0hPqFgo/ZJdxhvdR31r3wLBLfkU0A/mTFur uFWyt+YpvyBeU46GIh3XZe8Vf6tvAmyEJV2kTGIbEgXniDN6zxF0DtFZvEQmncgNmS51 u9gfGxjCtNRu5LoBDrgDc+z1pK20nKGIiXdGtOOMokU1I76lp1bd4vuXmMj5dMw0n6kE lVC4eCv0x0+g8j4gvEY4PEs9Z2k8LMmYNkhNfzQT36NP3tw9vCPod5kvhCc5rH+0ajSb HinEx3KimILX/68tn+ExWlOUG1YFwIy/mPZft0cAH92tLdm9YFUKl3Pm38QENvEBjYnG hO4Q== 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=ZYQCRNn81lFAL6SPD/yp7d53z2RJAlRcSF3q2qdHaNk=; b=qhYlWHSDghZvpsjTXaW2BaMABt9wHXtSwzBlvEFLj3oCDMgOL6ZPkF2X11zr4jBTnw BlrQ9IeyFe4Ry/NkdTlxuslAm2YTSa42QrUg/L+OnjgnOjenkmkPa6nl6Q+h0FjZyhGj 6snqjw/JjxN0uD8w36fznS9k9F4e9XBFh7xpXtUCIhRpKs55xAER3ekxSVFja2Us5hYE WGaYVQ+XfYwpt8qRX+b2RL8KgE1vLr12QLqbvka+r44aKWNCi6utrFBqcj7Rdz7iMY1o n+AelczpVD8kPvpAFPqRlcwTcdWiXztLPbyic4ENupPHoczqxXCS5rBX07XK9Q6pS/g+ NQ+w== X-Gm-Message-State: AOAM532gg1Bi18750fPkNn2JYnRdFGZagtNw1smJag080AMHt1ONIOam q3AI7zpZjOSIwXmstZAUXWec9wc9pqWh2JNLQ5E= X-Received: by 2002:a17:90a:db49:: with SMTP id u9mr10160pjx.181.1615827894922; Mon, 15 Mar 2021 10:04:54 -0700 (PDT) MIME-Version: 1.0 References: <20210305120240.42830-1-andriy.shevchenko@linux.intel.com> In-Reply-To: From: Andy Shevchenko Date: Mon, 15 Mar 2021 19:04:38 +0200 Message-ID: Subject: Re: [PATCH v1 1/1] gpiolib: Read "gpio-line-names" from a firmware node To: Bartosz Golaszewski Cc: Andy Shevchenko , 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 6:49 PM Bartosz Golaszewski wrote: > > 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. Close, but not fully correct. First of all it depends on the OF / ACPI / platform enumeration. Second, we are talking about secondary fwnode in the case where it happens. I'm in the middle of debugging this, I'll come up with something soon I believe. > > 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