Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp898630ybl; Wed, 4 Dec 2019 12:54:16 -0800 (PST) X-Google-Smtp-Source: APXvYqxxE0xU85Y0mODCSVHMcka5Ar78RaaU4nkDsFyQY8MtSkQd5FA7033NQU2QGUI+AvyAdAZT X-Received: by 2002:a9d:1b4b:: with SMTP id l69mr4014119otl.303.1575492856752; Wed, 04 Dec 2019 12:54:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575492856; cv=none; d=google.com; s=arc-20160816; b=kz9bH2kivx4JwQZ+/9Mmjc2k4Fa2akHtsnwZyWvsPmEyicMmtaKNEEeRZDXzRKvlUi 8aausFuccQMpK5UYjkQ2e+uS9NQdRnW0ZMHpGk1MHk+BPrFiBn0jOlzSRcRvkLoiGLta pFtmu7tzVPkqkSaYSY9N3Zw1MGqAG4GM0ey2WguWL6+fpFwCuN3UC92mY6m9jJbel1/j yorK0ERpx8Lq4pToRcnREIsZB8Cp38EADKZUhJECy++fsEMIzu1MWfXvfIPzTLp8CoaL gZGYP1WQFhdOWsToyzl0VWjirnMPQ9ETOyjgsTcWmy03i00w0e+QVoofoEN8+F1EiAff 1o7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=wmCpBK5gKfNHkehfVw0oOjmIqfu20jWLSFxK7s8CnWs=; b=yolZorMKlhy0XayHA8tvA07619UdAygl9H/QHT8mrjL2glPJOLLVVuoTg9Rv2hgIf8 o9CU9qmm7UjXO7lCziF6CUByP+cnjZU0RUOtl4VLghYZ0yFezCQREMd3Lwig7C45wtQM yMohr4UH3+ap2dD/cNtQV8gHB94AVIWEO3H84zCuscbhnRyzfhWpf6cLvPZGYk0XlD3r ypeIaXAR3aIyZlTaID6apMx1+4ZE2KgMfWMHhw/qosOjWjFST5cj9BIrOc+gOfksbrHZ pPCmk1ngSA/5LJoxkkXDikiXSXigCeJUsYcn11XXJovTSiU5W73hNYSM4GBuP2tSzXOh aY/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OoFLFYix; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id r1si3871577otn.150.2019.12.04.12.54.02; Wed, 04 Dec 2019 12:54:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OoFLFYix; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728294AbfLDUwz (ORCPT + 99 others); Wed, 4 Dec 2019 15:52:55 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40581 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727889AbfLDUwz (ORCPT ); Wed, 4 Dec 2019 15:52:55 -0500 Received: by mail-wr1-f66.google.com with SMTP id c14so856015wrn.7; Wed, 04 Dec 2019 12:52:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wmCpBK5gKfNHkehfVw0oOjmIqfu20jWLSFxK7s8CnWs=; b=OoFLFYixY2AfF+VyBlD1cF+DZ1WKmEOtVBMCB2bN1SGSSXcy4gPFGq6Y+PQ+Mf8gOx bBPhTyIoib4LVgdjUIj203iTZu8rZJu8Kti0CbxNyEDIhKnSX6juMges8H5Ky+3xYKYi Q67yiqmRoulqT3mCJhWFCvrOVIhm46nQTt1bfDnpDAfJNW+3sX1Hq75ygzLL0oOf10GM bpTCFSPNK4UylN9uAHkVg9kkOx91aDeUMpUpytHJPrRgdnVtwRWV7BGpSNSTzI6nQXnY d9bvLDFVRbUBnktZ8lBsft1obFtaQan4u2r7l5voT/7GwCmErM8XNMYWSRP1ZaWPoBM6 jXaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wmCpBK5gKfNHkehfVw0oOjmIqfu20jWLSFxK7s8CnWs=; b=PFp9+uu4KflPgvWdZ/iWXXKQWK6nxh3WmReaOChZQVrsSIjSaX0vo60WAOTOrVJaF+ 3vhWec41UNIZAK+4GLHa/jS8HPUWkrXjt1LJNI7nTE6rVq33ijXhpO5ZqCNu4mKEcQ2f lBsfseegnFCGlKsw7cyrVEl3Y70cGiZrQxVuinihFhaEtc+/LstQ5RKkSpcCZDk4Yjpc RRRMsqW5ps6qlKM70Vhqt6zjkzELIOaCp10lEfHzO8FJqGIbr3g/PNPSuFnv7NrarO7G KfnQ6wUIAVlpLpXNZZjiRVlzoHQvaIM4CPLaBNNay4Fn405CWPvFnJD4EYGUXXj3k+u6 8pZQ== X-Gm-Message-State: APjAAAUdEduq3uGeGIrjR4X7+lm6EiKwcGUK5INtQU+PhaL0XlnbCUYI JyzsI2yR3IQRz5MuYqHPLFdAFcoV X-Received: by 2002:a5d:6390:: with SMTP id p16mr6451840wru.170.1575492771741; Wed, 04 Dec 2019 12:52:51 -0800 (PST) Received: from [192.168.1.19] (cjl224.neoplus.adsl.tpnet.pl. [83.31.61.224]) by smtp.gmail.com with ESMTPSA id 188sm7707856wmz.13.2019.12.04.12.52.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Dec 2019 12:52:51 -0800 (PST) Subject: Re: "leds: gpio: Use generic support for composing LED names" breaks gpio debugfs To: Russell King - ARM Linux admin , Linus Walleij , Pavel Machek Cc: linux-arm-kernel@lists.infradead.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191204110219.GV25745@shell.armlinux.org.uk> From: Jacek Anaszewski Autocrypt: addr=jacek.anaszewski@gmail.com; prefer-encrypt=mutual; keydata= xsFNBFWjfaEBEADd66EQbd6yd8YjG0kbEDT2QIkx8C7BqMXR8AdmA1OMApbfSvEZFT1D/ECR eWFBS8XtApKQx1xAs1j5z70k3zebk2eeNs5ahxi6vM4Qh89vBM46biSKeeX5fLcv7asmGb/a FnHPAfQaKFyG/Bj9V+//ef67hpjJWR3s74C6LZCFLcbZM0z/wTH+baA5Jwcnqr4h/ygosvhP X3gkRzJLSFYekmEv+WHieeKXLrJdsUPUvPJTZtvi3ELUxHNOZwX2oRJStWpmL2QGMwPokRNQ 29GvnueQdQrIl2ylhul6TSrClMrKZqOajDFng7TLgvNfyVZE8WQwmrkTrdzBLfu3kScjE14Q Volq8OtQpTsw5570D4plVKh2ahlhrwXdneSot0STk9Dh1grEB/Jfw8dknvqkdjALUrrM45eF FM4FSMxIlNV8WxueHDss9vXRbCUxzGw37Ck9JWYo0EpcpcvwPf33yntYCbnt+RQRjv7vy3w5 osVwRR4hpbL/fWt1AnZ+RvbP4kYSptOCPQ+Pp1tCw16BOaPjtlqSTcrlD2fo2IbaB5D21SUa IsdZ/XkD+V2S9jCrN1yyK2iKgxtDoUkWiqlfRgH2Ep1tZtb4NLF/S0oCr7rNLO7WbqLZQh1q ShfZR16h7YW//1/NFwnyCVaG1CP/L/io719dPWgEd/sVSKT2TwARAQABzS1KYWNlayBBbmF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Uo12IJsKxohnNFVYtK8X/R6S0deKPjrZWvAkllgIPcHjMi2Va8yw KTj/JgcpUO5KN906Pf7ywZISe7Kbcc/qnE0YjPPSqFOvoeZvHe6EZCMW9+xZsaipvlqpByQV UHnVg09K9YFvjUBsBPdC8ef6YwgfR9o6AnPmxl0oMUIXkCCC5c99fzJY/k8= Message-ID: Date: Wed, 4 Dec 2019 21:52:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191204110219.GV25745@shell.armlinux.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Russel, On 12/4/19 12:02 PM, Russell King - ARM Linux admin wrote: > Hi, > > Patch d7235f5feaa0 ("leds: gpio: Use generic support for composing LED > names") changed the way labels are used. > > devm_fwnode_get_gpiod_from_child() is passed led.name, which used to be > set to the label or node name, resulting in /sys/kernel/debug/gpio > containing useful information. For example: > > gpio-487 ( |udpu:green:power ) out lo > gpio-488 ( |udpu:red:power ) out hi > gpio-489 ( |udpu:green:network ) out hi > gpio-490 ( |udpu:red:network ) out hi > gpio-491 ( |udpu:green:alarm ) out hi > gpio-492 ( |udpu:red:alarm ) out hi > > After this commit, it now contains a rather less useful: > > gpio-487 ( |? ) out hi ACTIVE LOW > gpio-488 ( |? ) out hi ACTIVE LOW > gpio-489 ( |? ) out hi ACTIVE LOW > gpio-490 ( |? ) out hi ACTIVE LOW > gpio-491 ( |? ) out hi ACTIVE LOW > gpio-492 ( |? ) out hi ACTIVE LOW > > This is because led.name is now NULL prior to the call to > devm_fwnode_get_gpiod_from_child(). Ugh, my bad. But it actually has been wrong since the patch a96aa64cb5723 ("leds/led-class: Handle LEDs with the same name"), which enabled LED core to amend the LED name just beforehand the registration of a LED class device. It seem that the only proper solution would be introducing a new pre_register_cdev(const char *name) op to the LED core, that would allow drivers to come up with their implementation thereof. In this particular case leds-gpio driver would need to put there gpiod initialization. The pre_register_device op would need to be called (when available) from the led_classdev_register_ext() after calling led_classdev_next_name() and before device_create_with_groups(). The op would have to be passed the final_name variable then. > While this is not an API, it is useful for debugging, and given the > dynamic allocation of GPIOs to physical GPIOs, having the labels > present is an advantage. > > Can this be fixed / old behaviour restored? If there are no objections I can come up with a fix, but no sooner than at the weekend. -- Best regards, Jacek Anaszewski