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 6AF072C181; Mon, 23 Mar 2026 14:20:56 +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=1774275656; cv=none; b=aL5nFHNpf1rPg6Nbni4DyeztjbNazpVMj/rfXDejac4tgTSWbvEep8Pe2r0Cwv6cyKQQ72HVrWJhyl0zfdXj2jjGzXze1AWNDihhYoFVlUVCrQsETaLr266PvDQeaamWqgkW7x5Ko/iIEB8T3bOMUiMwpD1pzApjKNDDsnXTHqU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275656; c=relaxed/simple; bh=7Wjg2eD2uMw4RFtATd3A2JzFj93f7kcpQ8jpK8wpvLk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ksq44Ru9wTq0s5t5K7Jo+8E8/qZWYkvYoDGWp1lVc651cjxSxgjPTKWsYZcMK+Ubhyt8ecz1gj1bZinZGZqq9lzaEOYstVHNQBefxNtyrJ5fUku2q/MdPR6FdjN2Unac6cdpfv+hggWfnFfUr2IIfRR1MiKdHdGSprOUiItdU4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SuT6b0vl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SuT6b0vl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6A28C4CEF7; Mon, 23 Mar 2026 14:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774275656; bh=7Wjg2eD2uMw4RFtATd3A2JzFj93f7kcpQ8jpK8wpvLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SuT6b0vl8mWcSt10FJps+WXK97UYU5HQUyHAg6l+iqmVY5Rf7n8bcbc7p7FYVupK5 4oayvBOH+cfnZllxPnVkq6MngnDgbqqast+he3jndpl0GuzliDnmKT18MEM4gq4rdO JZkWrAzePwthDVj2laJr/FojZl2p1B3H7RGLrCwk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andy Shevchenko , "Rafael J. Wysocki (Intel)" , Sakari Ailus , Danilo Krummrich Subject: [PATCH 6.12 147/460] device property: Allow secondary lookup in fwnode_get_next_child_node() Date: Mon, 23 Mar 2026 14:42:23 +0100 Message-ID: <20260323134530.193807910@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134526.647552166@linuxfoundation.org> References: <20260323134526.647552166@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andy Shevchenko commit 2692c614f8f05929d692b3dbfd3faef1f00fbaf0 upstream. When device_get_child_node_count() got split to the fwnode and device respective APIs, the fwnode didn't inherit the ability to traverse over the secondary fwnode. Hence any user, that switches from device to fwnode API misses this feature. In particular, this was revealed by the commit 1490cbb9dbfd ("device property: Split fwnode_get_child_node_count()") that effectively broke the GPIO enumeration on Intel Galileo boards. Fix this by moving the secondary lookup from device to fwnode API. Note, in general no device_*() API should go into the depth of the fwnode implementation. Fixes: 114dbb4fa7c4 ("drivers property: When no children in primary, try secondary") Cc: stable@vger.kernel.org Signed-off-by: Andy Shevchenko Reviewed-by: Rafael J. Wysocki (Intel) Reviewed-by: Sakari Ailus Link: https://patch.msgid.link/20260210135822.47335-1-andriy.shevchenko@linux.intel.com Signed-off-by: Danilo Krummrich Signed-off-by: Greg Kroah-Hartman --- drivers/base/property.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -759,7 +759,18 @@ struct fwnode_handle * fwnode_get_next_child_node(const struct fwnode_handle *fwnode, struct fwnode_handle *child) { - return fwnode_call_ptr_op(fwnode, get_next_child_node, child); + struct fwnode_handle *next; + + if (IS_ERR_OR_NULL(fwnode)) + return NULL; + + /* Try to find a child in primary fwnode */ + next = fwnode_call_ptr_op(fwnode, get_next_child_node, child); + if (next) + return next; + + /* When no more children in primary, continue with secondary */ + return fwnode_call_ptr_op(fwnode->secondary, get_next_child_node, child); } EXPORT_SYMBOL_GPL(fwnode_get_next_child_node); @@ -803,19 +814,7 @@ EXPORT_SYMBOL_GPL(fwnode_get_next_availa struct fwnode_handle *device_get_next_child_node(const struct device *dev, struct fwnode_handle *child) { - const struct fwnode_handle *fwnode = dev_fwnode(dev); - struct fwnode_handle *next; - - if (IS_ERR_OR_NULL(fwnode)) - return NULL; - - /* Try to find a child in primary fwnode */ - next = fwnode_get_next_child_node(fwnode, child); - if (next) - return next; - - /* When no more children in primary, continue with secondary */ - return fwnode_get_next_child_node(fwnode->secondary, child); + return fwnode_get_next_child_node(dev_fwnode(dev), child); } EXPORT_SYMBOL_GPL(device_get_next_child_node);