From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-b3-smtp.messagingengine.com (fhigh-b3-smtp.messagingengine.com [202.12.124.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50A8E4611C9; Tue, 5 May 2026 14:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777990881; cv=none; b=U/H6JdPglnDQou5JCYR1IDrr6mbqfOrreUYppx4cRC9qJup6pFqXY+sXLvMT23iAESgSsPf+uHBgqSV7AfbwuzGjfWjym5MnjzEzylY65w0uOadwKBCgMGTp7h+QL2uWSWLvNvh8agW7T/HcTZjEhBxuh1r1kXHDTXvsBHpqHT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777990881; c=relaxed/simple; bh=UHABoaJaVAWd4iASQin7/N6ZwFW6w62RIrEygv6fM24=; h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type; b=Djw5psbjH9JKuxDMq10cfIEzjELE6dGe3u8vvsGGRvLdpXUsHAQRDuCtX/t5Dngf3yxVkpwv3FIEOYmBwoHe3bfl7yatA78OJ8tjvlxH6H5qP/UK+4UTbAjQKplK0KyDg8ZJpfLG7MjFpYPP0ma4VxoZgE6zCj9L71YWP8cbBLk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=sDI00jQ1; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Rc0SZmpq; arc=none smtp.client-ip=202.12.124.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="sDI00jQ1"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Rc0SZmpq" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 115D47A00AF; Tue, 5 May 2026 10:21:17 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Tue, 05 May 2026 10:21:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1777990877; x=1778077277; bh=spFn28IaAcyoH75JuQR6dT/DLGGLgNP5S3NEjUd/CRQ=; b= sDI00jQ1mC4Pg6tf3qeKQAxXsJ3xtCjh6xetpPiOP1xKXXK0FAH4NJ9/5XZYkrfJ 3PLo7byYiRJKfoBfw9B6hhgfzyWnCQL5ghwKTr9bMrEFLDqMpGs2CuPjRdTZLDWK yCi8GOsjbtCxlDbaoSxNXEVWUQDkaIWya7Pyf4aMFdONDxg9Gg/iRq/Qv1RI30AR ufE254QXO4ICKodpzg2ZaRg/nBLYJfRZOtFvyJaVZZVFcWAAw7+9eslBYhVAp5AJ C2fmu+K/P+2GxUuaV/n1MIz5PTT6VCzztbDa1Ayyfw6otORsPLB1JGrGlDkcSp5i 5R6YuiBTiq6Ap5eZBjvzBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1777990877; x= 1778077277; bh=spFn28IaAcyoH75JuQR6dT/DLGGLgNP5S3NEjUd/CRQ=; b=R c0SZmpqeFb4SraOePaaYXwRhDyeFDmKj51TEsazDbnMXeamuhBm9fIqXr7HRhSeQ oIZIqfGFawiEGrW+TPwZNKze7byhvAm9dCcBL5II80mCt//mefSQ97ho3ZRC1cDu +OCzbgdyIXtZSl+0NJRQvelSBmB76furUoj/16IRKY1OpD5l+bwi4PX/jq3UgArd cblnzKUjw78oGAj35ltb/Gv09oR+UcWyY7I63RfYUJJxeQCYqzA0ml1zMf34viC5 wSXeHFar+y2vEpUGoE9o3sa3DodD1xzXHBT1zzswyOtdB3i4BBi8mK8MQHLf4Hmw SVJaL5tQxxGU4ZgNtMADA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddutdduleefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgfgsehtjeertdertddtnecuhfhrohhmpedftehrnhgu uceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrthhtvg hrnhephfdthfdvtdefhedukeetgefggffhjeeggeetfefggfevudegudevledvkefhvdei necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghrnh gusegrrhhnuggsrdguvgdpnhgspghrtghpthhtohepuddtpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegumhhithhrhidrthhorhhokhhhohhvsehgmhgrihhlrdgtohhmpd hrtghpthhtoheprghrnhgusehkvghrnhgvlhdrohhrghdprhgtphhtthhopegsrhhglhes khgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhgvvgeskhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhushifsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehprghvvghl sehkvghrnhgvlhdrohhrghdprhgtphhtthhopegrnhgurhhihidrshhhvghvtghhvghnkh hosehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqghhpihho sehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvg hlsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 47C3D70006A; Tue, 5 May 2026 10:21:17 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ThreadId: ARrtNTmGjyOc Date: Tue, 05 May 2026 16:19:47 +0200 From: "Arnd Bergmann" To: "Andy Shevchenko" Cc: "Arnd Bergmann" , "Lee Jones" , "Pavel Machek" , "Linus Walleij" , "Bartosz Golaszewski" , "Dmitry Torokhov" , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, "open list:GPIO SUBSYSTEM" Message-Id: In-Reply-To: References: <20260430091202.2724109-1-arnd@kernel.org> Subject: Re: [PATCH] [v2] leds: gpio: make legacy gpiolib interface optional Content-Type: text/plain Content-Transfer-Encoding: 7bit On Tue, May 5, 2026, at 15:25, Andy Shevchenko wrote: > On Tue, May 05, 2026 at 04:19:36PM +0300, Andy Shevchenko wrote: >> On Tue, May 05, 2026 at 03:10:28PM +0200, Arnd Bergmann wrote: >> > On Mon, May 4, 2026, at 09:31, Andy Shevchenko wrote: >> > struct gpio_desc *gpiod; >> > >> > gpiod = devm_gpiod_get_index_optional(dev, NULL, idx, GPIOD_OUT_LOW); >> >> > if (gpiod && !IS_ERR(gpiod)); >> >> And this is not needed. The below is NULL-aware. > > To be clear > > struct gpio_desc *gpiod; > > gpiod = devm_gpiod_get_index_optional(dev, NULL, idx, GPIOD_OUT_LOW); > if (!IS_ERR(gpiod)) > gpiod_set_consumer_name(gpiod, template->name); > > return gpiod; > > But looking at the original code, I would leave another return, so Right, I actually had this at first, but decided to keep the NULL check because that was used in the driver already. I've dropped it again now. >> > gpiod = devm_gpiod_get_index_optional(dev, template->name, i, GPIOD_OUT_LOW); >> > >> > Did I get that right? If so, I'll fold that in as another > > Nope, the con_id != consumer name. Can't be done this way. I see. I had tried to find an existing interface that sets the consumer name and saw that gpiod_get_index() internally uses con_id as the label if set, but I missed that this would break the actual lookup in gpio_desc_table_match() because the 13 lookup tables are of course all defined by index rather than by name. Arnd