From patchwork Mon Aug 12 03:12:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 13760115 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 DD8FE14C585; Mon, 12 Aug 2024 03:07:42 +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=1723432063; cv=none; b=ldvRzgRIpOUlKpLK2atdY5qyLf4/SnTr1CirNoTrBGqpO2oDTxqpwAHjOWaGtH1iR1IYmUwVmStug6yRghi9W5xufbM8+7sWcc+DPj4ozDvHp59sIrqV5QVwQ1Paa0Yjcs6ir3sIcYxtiYtOTJiuizBnUE4Yym4Aph+N8EqvFAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723432063; c=relaxed/simple; bh=L9wAJo10BnzE7JaXuip6gtOXdHXBOMBxLOJLtPy4Qiw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CD0SBswoZsJdEakU5w+3x3viz7vMCPKBqPWbINJjjffxLVrh/0X74OqLnY1lfXFwN9tov1gDzXECBO4EGNAexw1ACIT97BAH3Z6+n6SwUGprWz+itkjKm1q7wxZZFOoaHPRuKwTD1Yp2JmZElGQPEduL3WIAxsma8eaQlnNhCzA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UTLo7eeM; 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="UTLo7eeM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C322C4AF11; Mon, 12 Aug 2024 03:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723432062; bh=L9wAJo10BnzE7JaXuip6gtOXdHXBOMBxLOJLtPy4Qiw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UTLo7eeMaYzSQcy/ReSVuS7lAiREbZfvbBRURglPdz3ReapOb/3EU9ng5aCm77XcC fiGl5pSDgZQzVpagcFDUdian74ptg1BuwzjU+gsdLuPmcFTYCP08kxeUueU8NV0Qhl adGIbZEBajF/8YMnPLkCATEbZwUqxLc9zVhLBjW7vQ5lBimmiZL2Hs46p1GtOxe2P0 Y02Hxrtu1KnxWkHC/d2rl35pSH34VhQzD3NTkY9pR3YPAHJk6OdDoUjC0Gjj8/zeBT LUQ9ycoi/fZZ+Bbsi+GKOFfM/SAkY6UhIGDoPB1rlVc9qH7URAstvcIyiI9w9HjY9f BkhPZ0vo/ty0w== From: Bjorn Andersson Date: Sun, 11 Aug 2024 20:12:00 -0700 Subject: [PATCH v2 3/7] of: dynamic: Don't discard children upon node attach Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240811-dwc3-refactor-v2-3-91f370d61ad2@quicinc.com> References: <20240811-dwc3-refactor-v2-0-91f370d61ad2@quicinc.com> In-Reply-To: <20240811-dwc3-refactor-v2-0-91f370d61ad2@quicinc.com> To: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Felipe Balbi , Wesley Cheng , Saravana Kannan , Thinh Nguyen , Philipp Zabel , Bjorn Andersson , Konrad Dybcio Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Bjorn Andersson X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=974; i=quic_bjorande@quicinc.com; h=from:subject:message-id; bh=6OAjPy1kx5oZXZRHoFFA0Ve553WW6uXL5xF/FqO3D6o=; b=kA0DAAgBCx85Pw2ZrcUByyZiAGa5fYCgOS8gLSedkYVSDSaroB3MiWh76VVOI0GW9mDHxKkkA YkCSQQAAQgAMxYhBAXeA8xfNepPCWbVJQsfOT8Nma3FBQJmuX2AFRxhbmRlcnNzb25Aa2VybmVs Lm9yZwAKCRALHzk/DZmtxQbGEACN47/vv5BtkgEqMlBy+6acz8EAp1L0DMMf/+aMkTrMP4KNMbk MLypk6371Nq007cphhZkB5wz8cc0fuBKiOly4+u9m6YreVk84aqCbBgedbKU0nczOoWrPcpnPyV aZTo/a7D3/nytzs4iTsqDCttttL3/RFNa5agm5JE9hFcJZSFNYQyJChsrgwgbNCsDlF4Y61b+EF j0vCtpMzlITlJZB15T244pq0CsP/1KqLV9NoMYDnKvLJHLIV+tOY0Q+qTTnvaQIzpdsX8bXRtVj 1dC3yKZc41nqPp/XpKEdxWhTf8bXhSo4yY6xiGOY4UxHsKxSJMVavg/hrPbPJBNsw0tupGAS11w VM5XLSs/vkJn+hI9OdqRu9f0xUYbQ2BmD0GejWJDiXsNLvDjKoxVIdhvhZ71tk2lia/m4aRniT/ BHY8XDIWWn9STSUnvaUVO6LGcdoHWYslIch0n2M4Rlvpiz4APofJ+UOSU0QwCfnflXUhBJoKzI7 gZdWph7PkYpNyldG8y+E6slonNw4yZVA5bBtBATS9m4sKuD/1Aq89XW+yCydZSoqXJSH+A0MZYh rHJUeKuk0dOITGFXhYlNtL971LLeqB7KLnkIy3DDYul1ERsPfezMY5+79S18z2oRGJhGfLhivdS ooypCeFKdRIoUV5Nk5rx9rCZm9d5oyhC4iw== X-Developer-Key: i=quic_bjorande@quicinc.com; a=openpgp; fpr=05DE03CC5F35EA4F0966D5250B1F393F0D99ADC5 From: Bjorn Andersson When dynamically modifying DeviceTree it's useful to be able to reparent nodes, but of_attach_node() clear the child pointer and hence discards any child nodes. Retain the child pointer upon attach, so that the client code doesn't need to manually rebuild the tree. Current users of of_attach_node() either avoids attaching nodes with children or explicitly attaches nodes without children, so no impact is expected to current users. Signed-off-by: Bjorn Andersson --- drivers/of/dynamic.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 110104a936d9..32e1dffd9f96 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -221,7 +221,6 @@ static void __of_attach_node(struct device_node *np) np->phandle = 0; } - np->child = NULL; np->sibling = np->parent->child; np->parent->child = np; of_node_clear_flag(np, OF_DETACHED);