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 557992459DC for ; Tue, 17 Mar 2026 17:20:01 +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=1773768001; cv=none; b=h/Wul2f1KadsQOcvlH3SotWWPWhK0ro67UqNEVafS9ny7mSLozn884cAuzOZgmBAWxk2qSR3fTxh9HDcghJO9ABN1OAEdwLx6Uy1LGV5VFg4MXZPLsXbfrcug3ER8LmbDuF/dEBubhAIyKDXOqJha4JZm1TCStC9TwyNxYKZ0ig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773768001; c=relaxed/simple; bh=97NKTOTMkE5tCa10SnfmV8i0p+jWWo50FPkccVmVQYg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uBEOGD+Ems3uqr3P+Mp8zq6JQI1eJjaWCvRDMeKJ+bDHR2revdvwwmFrC8vaKfM1zSfzDBDoWCtgt2v3OISdhBOgO94XHq/kDkM4JALfBN/jjg+ZWvbyWFHD+4YPCLsKMnFT2jVWQ4z3mlixgs00UA7w4jZq1FD2iqrapBNQsPY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dH01OBiw; 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="dH01OBiw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41BE1C4CEF7; Tue, 17 Mar 2026 17:20:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773768001; bh=97NKTOTMkE5tCa10SnfmV8i0p+jWWo50FPkccVmVQYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dH01OBiwZGpPYormdqdBGvoLsMeIIMOkD7roSVOZ8AbvKjKTuW/ooqLuzK7NlXuOB VJbRRCe3UMD3NzHmrH239uV/4waX2KztLMDfRi1BET3y0fywlm3pkFK1ME/k9fyIt5 QBi/SLU5iHhD5O48Jx/QsIiVeORAmKMXAGprlhic5v3BhLaNVVVzkNJZo41I2QDd5L QnBF3AMti5yJhqenjtjBHcAld4+dOTwr6EjFhalcjpe8AzvSy5lerT4Vd1EOmqbtWp WwplChCEyDcp6MKsrb03CHHe3jS5+pguVpMqKnuvZc+oPulr69FVPjeZwpxtVIa3+m AuxSAtX+4faJA== From: Sasha Levin To: stable@vger.kernel.org Cc: Daniel Scally , Andy Shevchenko , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.10.y 5/8] device property: Check fwnode->secondary in fwnode_graph_get_next_endpoint() Date: Tue, 17 Mar 2026 13:19:51 -0400 Message-ID: <20260317171954.238398-5-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317171954.238398-1-sashal@kernel.org> References: <2026031703-caravan-bladder-c63a@gregkh> <20260317171954.238398-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Daniel Scally [ Upstream commit b5b41ab6b0c1bb70fe37a0d193006c969e3b5909 ] Sensor drivers often check for an endpoint to make sure that they're connected to a consuming device like a CIO2 during .probe(). Some of those endpoints might be in the form of software_nodes assigned as a secondary to the device's fwnode_handle. Account for this possibility in fwnode_graph_get_next_endpoint() to avoid having to do it in the sensor drivers themselves. Reviewed-by: Andy Shevchenko Signed-off-by: Daniel Scally Signed-off-by: Rafael J. Wysocki Stable-dep-of: 2692c614f8f0 ("device property: Allow secondary lookup in fwnode_get_next_child_node()") Signed-off-by: Sasha Levin --- drivers/base/property.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index 40968fd9c8d14..bf9673fe59b3b 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1033,7 +1033,26 @@ struct fwnode_handle * fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, struct fwnode_handle *prev) { - return fwnode_call_ptr_op(fwnode, graph_get_next_endpoint, prev); + const struct fwnode_handle *parent; + struct fwnode_handle *ep; + + /* + * If this function is in a loop and the previous iteration returned + * an endpoint from fwnode->secondary, then we need to use the secondary + * as parent rather than @fwnode. + */ + if (prev) + parent = fwnode_graph_get_port_parent(prev); + else + parent = fwnode; + + ep = fwnode_call_ptr_op(parent, graph_get_next_endpoint, prev); + + if (IS_ERR_OR_NULL(ep) && + !IS_ERR_OR_NULL(parent) && !IS_ERR_OR_NULL(parent->secondary)) + ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL); + + return ep; } EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint); -- 2.51.0