From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5213036605D; Mon, 23 Feb 2026 20:00:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771876835; cv=none; b=OVmCU3wSBxvT/xaDTUpOxSdo8VaNt598an17QMZwPbcl1sN4RfCUmUExi7Q0sugbUgGvSwNcQHWB/uX8fAUBlDX+xmlCWWF+BkDdoQXFkV3CiZnb+MjGHqayPd2OpNFYdI8K/Ejh6u2jqtRFAhE2t9cBlePyh/JxVyi81COSglY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771876835; c=relaxed/simple; bh=5I+GUkEiWucwoPTreVClRorAtsCzEOPlEM1kwCm2jLw=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=QxvRr4YLgwxZSbZHwigXbFc0Y1gkvjVlOzNcpknDLTcrfw/d/C0XZ9GylRSUj709ASGL/uB/iv0dAMPf5bm0jo7UyXlydMxGf25/Kuvhq1t0murbjqAGpFkPf6OXwL2vNVeHuipgTe5W4WuhAba/NKdLBfiqWveZug0YFHTBeBY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uH/sdQKe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uH/sdQKe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F598C116C6; Mon, 23 Feb 2026 20:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771876834; bh=5I+GUkEiWucwoPTreVClRorAtsCzEOPlEM1kwCm2jLw=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=uH/sdQKe4Ol6tA8XmSVURWXAoPeJ5zmZPoZJL5tWUbjqTqOQJZ//4Rm3h8SIYP4TY A+x6YDmT8/ex2pq1J0YVyTPF/hlRpozhaVirjRJ5lPEr1zM6+VABa8nK3NILqiZ9Hg nr79AlusDDcIcWsDekrEjTEPtIRSGRGtCGiyF8Uf/rrNAZ9VBNvld/Mzg+9VUjhb7u jSAyt0LrjbhLcHXr19Y2GYVscjO+fUJgSeBqXS9bZFgWKhgZvzhdZEZPn0Vqtz1XEs C5J1KMGI6qEVoECvVLkGeyA8ddRxqg9yL6H6kbhSUjlONjR/EayI629sT4T+0fpikX poSrrVUiB5g5Q== Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 23 Feb 2026 21:00:30 +0100 Message-Id: Subject: Re: [PATCH v2 2/2] gpiolib: match secondary fwnode too in gpio_device_find_by_fwnode() Cc: "Bartosz Golaszewski" , "Greg Kroah-Hartman" , "Linus Walleij" , "Bartosz Golaszewski" , "Dmitry Torokhov" , "Andy Shevchenko" , "Daniel Scally" , "Heikki Krogerus" , "Sakari Ailus" , "Len Brown" , , , , To: "Rafael J. Wysocki" From: "Danilo Krummrich" References: <20260223-device-match-secondary-fwnode-v2-0-966c00c9eeeb@oss.qualcomm.com> <20260223-device-match-secondary-fwnode-v2-2-966c00c9eeeb@oss.qualcomm.com> In-Reply-To: On Mon Feb 23, 2026 at 8:55 PM CET, Rafael J. Wysocki wrote: > On Mon, Feb 23, 2026 at 8:45=E2=80=AFPM Danilo Krummrich wrote: >> >> On Mon Feb 23, 2026 at 4:40 PM CET, Bartosz Golaszewski wrote: >> > static int gpio_chip_match_by_fwnode(struct gpio_chip *gc, const void= *fwnode) >> > { >> > - return device_match_fwnode(&gc->gpiodev->dev, fwnode); >> > + struct device *dev =3D &gc->gpiodev->dev; >> > + struct fwnode_handle *node =3D dev_fwnode(dev); >> > + >> > + if (IS_ERR(fwnode)) >> > + return 0; >> > + >> > + if (device_match_fwnode(dev, fwnode)) >> > + return 1; >> > + >> > + return fwnode_is_primary(node) && node->secondary =3D=3D fwnode; >> > } >> >> Rafael, I understand [1] as you agree with my point, but object to intro= duce >> device_match_fwnode_ext() (or whatever name we would pick eventually :) >> regardless because only the GPIO code would need it as by now. > > This is a preference, not a strong objection, but yes. > >> IIUC, I wonder if exposing fwnode_is_primary() instead is a good trade. > > Well, there is the secondary pointer in struct fwnode_handle, so it is > kind of exported anyway and it could be documented as "a secondary > fwnode_handle supplying additional properties or an error pointer", so > exposing this static inline doesn't change much IMV. > > What's your specific concern about exposing it? No concern with either approach from my side, I was just curious. :) Maybe it makes sense to add a comment to gpio_chip_match_by_fwnode() hintin= g to move this into common code once there's another occurance of this pattern. But either way, this is Reviewed-by: Danilo Krummrich >> [1] https://lore.kernel.org/driver-core/CAJZ5v0jUCtKTW-g-C0pKu0DQqOkyfSz= =3DupXwbtYeV_=3DrMBUMyg@mail.gmail.com/