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 3FEB01DA0E1; Mon, 23 Mar 2026 16:18:08 +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=1774282688; cv=none; b=SA+4Atu92q39oylfjo5i6kXcIBuktdEOG6SZXszzR6cGq2Z48HKpBFiWyMRdSpAvNTOm3KSWw3JAQ1ySDm8liN8S1HFpQL5chqJBe5aFyyA5B8cyGKOfqdNOSoJt9oiRvL28378WfQg6l0tvlfxx0FCOB+pYwo/5thNnuOSzddE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282688; c=relaxed/simple; bh=tugg+6fx+/9Tds9+oH9Ewluo6mCKZq5PG76/VqY6Miw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HO7eIWYKHeudnPRE9nEK5yW6aN5ZMs/tditrnJz3XkqDHKaJt8ukSUt/t4MwwfawwbZ0hz+p0x5DUQkcmJu9Xymq7EZH/fSWj3gxogYJx17LLhbnROrZJFWAYAxSsicN1LrapBtCj/yexC+IcbzKbGuVI9AcmVlIgJpiQdcvZ4c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VvVkzizr; 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="VvVkzizr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE6DDC2BC9E; Mon, 23 Mar 2026 16:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774282688; bh=tugg+6fx+/9Tds9+oH9Ewluo6mCKZq5PG76/VqY6Miw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VvVkzizrcS8XU6/p7OPVJLHs4NWALax9b3ktMkgYtYhKTDzu0Org+TlZ2/gQ/ySW3 IiWMzfDPBbiDvLl8LwYyho8UKAW8kZuMs6nYNL+0ciTMfOgZ0rpStKQP09H3z53HvO ueo/XnbhORPotm/q0SZksEllE5l0kLBlexqlLbho= 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.1 232/481] device property: Allow secondary lookup in fwnode_get_next_child_node() Date: Mon, 23 Mar 2026 14:43:34 +0100 Message-ID: <20260323134530.790566007@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134525.256603107@linuxfoundation.org> References: <20260323134525.256603107@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.1-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 @@ -749,7 +749,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); @@ -793,19 +804,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);