From nobody Mon Sep 29 20:16:03 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EFBCC25B08 for ; Mon, 15 Aug 2022 23:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355084AbiHOX5u (ORCPT ); Mon, 15 Aug 2022 19:57:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355379AbiHOXwB (ORCPT ); Mon, 15 Aug 2022 19:52:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D3C892F57; Mon, 15 Aug 2022 13:16:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D2C17B81135; Mon, 15 Aug 2022 20:16:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27C7FC433C1; Mon, 15 Aug 2022 20:16:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594602; bh=lO8GNSYkrWDx3wny2tetua6wdMrcGQqvkHvBgkQeodM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dsLJPU48c7cTTec7xi5DKqo9T29xDzlhFZi34nwKMgOKURxoDn4sWfRYfBursfFSK 9k3NfYU07kgzDswU5/AnyZdJKfZPPeVMzAp6PoWBCSbSPOmB3UDRdYuIO53qf++yQt puqrqEreKVg5ezG6LGINZFQ4W4fJxlO5wPfSLRRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sakari Ailus , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 0500/1157] media: v4l: async: Also match secondary fwnode endpoints Date: Mon, 15 Aug 2022 19:57:36 +0200 Message-Id: <20220815180459.694288420@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sakari Ailus [ Upstream commit 46347e3ec61660562d4a4a933713e2c2b74598e2 ] For camera sensor devices the firmware information of which comes from non-DT (or some ACPI variants), the kernel makes the information visible to the drivers in a form similar to DT. This takes place through device's secondary fwnodes, in which case also the secondary fwnode needs to be heterogenously (endpoint vs. device) matched. Fixes: 1f391df44607 ("media: v4l2-async: Use endpoints in __v4l2_async_nf_a= dd_fwnode_remote()") Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/v4l2-core/v4l2-async.c | 35 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core= /v4l2-async.c index c6995718237a..b16f3ce8e5ef 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -66,8 +66,10 @@ static bool match_i2c(struct v4l2_async_notifier *notifi= er, #endif } =20 -static bool match_fwnode(struct v4l2_async_notifier *notifier, - struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) +static bool +match_fwnode_one(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, struct fwnode_handle *sd_fwnode, + struct v4l2_async_subdev *asd) { struct fwnode_handle *other_fwnode; struct fwnode_handle *dev_fwnode; @@ -80,15 +82,7 @@ static bool match_fwnode(struct v4l2_async_notifier *not= ifier, * fwnode or a device fwnode. Start with the simple case of direct * fwnode matching. */ - if (sd->fwnode =3D=3D asd->match.fwnode) - return true; - - /* - * Check the same situation for any possible secondary assigned to the - * subdev's fwnode - */ - if (!IS_ERR_OR_NULL(sd->fwnode->secondary) && - sd->fwnode->secondary =3D=3D asd->match.fwnode) + if (sd_fwnode =3D=3D asd->match.fwnode) return true; =20 /* @@ -99,7 +93,7 @@ static bool match_fwnode(struct v4l2_async_notifier *noti= fier, * ACPI. This won't make a difference, as drivers should not try to * match unconnected endpoints. */ - sd_fwnode_is_ep =3D fwnode_graph_is_endpoint(sd->fwnode); + sd_fwnode_is_ep =3D fwnode_graph_is_endpoint(sd_fwnode); asd_fwnode_is_ep =3D fwnode_graph_is_endpoint(asd->match.fwnode); =20 if (sd_fwnode_is_ep =3D=3D asd_fwnode_is_ep) @@ -110,11 +104,11 @@ static bool match_fwnode(struct v4l2_async_notifier *= notifier, * parent of the endpoint fwnode, and compare it with the other fwnode. */ if (sd_fwnode_is_ep) { - dev_fwnode =3D fwnode_graph_get_port_parent(sd->fwnode); + dev_fwnode =3D fwnode_graph_get_port_parent(sd_fwnode); other_fwnode =3D asd->match.fwnode; } else { dev_fwnode =3D fwnode_graph_get_port_parent(asd->match.fwnode); - other_fwnode =3D sd->fwnode; + other_fwnode =3D sd_fwnode; } =20 fwnode_handle_put(dev_fwnode); @@ -143,6 +137,19 @@ static bool match_fwnode(struct v4l2_async_notifier *n= otifier, return true; } =20 +static bool match_fwnode(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) +{ + if (match_fwnode_one(notifier, sd, sd->fwnode, asd)) + return true; + + /* Also check the secondary fwnode. */ + if (IS_ERR_OR_NULL(sd->fwnode->secondary)) + return false; + + return match_fwnode_one(notifier, sd, sd->fwnode->secondary, asd); +} + static LIST_HEAD(subdev_list); static LIST_HEAD(notifier_list); static DEFINE_MUTEX(list_lock); --=20 2.35.1