Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp46599pxb; Fri, 9 Apr 2021 17:47:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdanfTBhNLGVuEePr3PhZKE91dcjI8lvYRdYI/FkmGW8swxyidS3th/77MCD+6CgAwafiC X-Received: by 2002:a17:906:af09:: with SMTP id lx9mr18793709ejb.58.1618015642395; Fri, 09 Apr 2021 17:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618015642; cv=none; d=google.com; s=arc-20160816; b=sHMqyfx8GQGDT5s0SKHurb1EfFHqIlO/Xhd3ftD9ZwWy+ZarlJ0OmQLu2aZgfas8Dm XfWBH7zS1kYIRZevEzKi7m7QhtMkT8Tu4wMABVi0H1ErERE2633lJ1ZgOf98Z7yZ8nFp EuiGpDCKelESYdiq4LJHtXrKs2+t2faEgg4tFMwv2oPYSNG7p4laZSQufGE1FS/UpK2G /HYgycqQcFVc6QrUsXfbRloa/F8zYnZvM/veyX0tug3aUx9MDde4x7vBJp1TdHSeaGqY nGjg7Jdwvp7GFgHsZfU5xA7SFf4Ye22tkViSBwpdQApup5HFZJJIZ12AWT9LDaSFkKbJ Np7w== 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=MV5i7FuXZKBq6wNgbAlqaADMT+OW3UEGOf96N5IE2cQ=; b=R38Tu/mlM1cnPtepRBKEn78dbM2mwdWhM9aLRA6+Mr5YOHXfo2euXiOYAzzUAQEzSp iRFEDJs2GQuCjQ457qm67t7m8q8aY0i21hkZsFzeRA4Sk8Pruwn2VJ3HumMVdsrr1Sca 6eUS61otA32qfsLW0SXyJuo1zjb+IT+GcPpJUWRCjKupAsla6bLcExaFMktsSZeEbLtG 8a/xAGVYB+vLGgoS+2PdSd1dzjfedAKNPZVurKR88mkDLmW8nMVBC+hHjh+LV0PeKXVX xeCyxiB3/ni2Mxegn9FduMoZNf3jEPeqTUQ/2yE3JYamfVLq2DxqgIbzcIBxpu6+/jLn kGMg== 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 w15si3378594edc.302.2021.04.09.17.46.58; Fri, 09 Apr 2021 17:47:22 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235269AbhDJAqR (ORCPT + 99 others); Fri, 9 Apr 2021 20:46:17 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:57531 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235215AbhDJAqQ (ORCPT ); Fri, 9 Apr 2021 20:46:16 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4FHGWs3MPcz1qsZw; Sat, 10 Apr 2021 02:46:01 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4FHGWs2Sqvz1qv9m; Sat, 10 Apr 2021 02:46:01 +0200 (CEST) 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 ft4RUmY19NIy; Sat, 10 Apr 2021 02:45:59 +0200 (CEST) X-Auth-Info: 02cJJmK9oi9Ch2YwxC/UUroig4FOelDkpBm1NGpcWzY= 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; Sat, 10 Apr 2021 02:45:59 +0200 (CEST) Subject: Re: [PATCH v1 1/1] gpiolib: Read "gpio-line-names" from a firmware node To: Andy Shevchenko , Bartosz Golaszewski Cc: Andy Shevchenko , Bartosz Golaszewski , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Linus Walleij , Roman Guskov References: <20210305120240.42830-1-andriy.shevchenko@linux.intel.com> From: Marek Vasut Message-ID: <5bf6771d-5783-0a40-5a72-7ddbb9c694aa@denx.de> Date: Sat, 10 Apr 2021 02:45:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: 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/15/21 6:04 PM, Andy Shevchenko wrote: > 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. Was there ever any follow up on this ? I would like to point out that on STM32MP1 in Linux 5.10.y, the gpio-line-names are still broken, and a revert of "gpiolib: generalize devprop_gpiochip_set_names() for device properties" is still necessary.