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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D0CF2EB64DC for ; Fri, 21 Jul 2023 16:07:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C7750867D3; Fri, 21 Jul 2023 18:07:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YBSFp9JT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D6AA867C5; Fri, 21 Jul 2023 18:07:29 +0200 (CEST) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8DF06862E9 for ; Fri, 21 Jul 2023 18:07:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-783546553ddso91926839f.0 for ; Fri, 21 Jul 2023 09:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689955645; x=1690560445; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2Z03z0mL9cPNxRo6EPYu78QB9oAPZJtdQyWAS4pTt38=; b=YBSFp9JTHVq8i6Wbulo/jchTQFUoYPo2Z220IBzjHi0FHe40XMTCfm7FakqKQmQWZg LwfLKTwvoIDreym2//zMOsGHpJIZ+ixVsi7DW+IFL8/cfaSyK3dUOmSjBdunQ8um+dmo GWyU+LTVTsdBV9gqwG2x8Osu1OGUWy3emyh0I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689955645; x=1690560445; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Z03z0mL9cPNxRo6EPYu78QB9oAPZJtdQyWAS4pTt38=; b=fHDFFqAx1kOZz4lFor0CTILmbsbyrfRdPdUjUQLdamxfQg/yVnhMOQ/jN/yEi+hZSU IW6+HriLlFkBbQ+qMzcWXgb8NOyYFY/8KIOpC1KNi1kNxIq7hQPcg6JnnlDe+VTvlvem poSiL3OWCTSqx0Vrir6tnkNEfPDPfeKZUICPoerJ+85gwX2wZ7ABWq52obN0hyfSnfZG gp5O/D3O67SumYRUFaEf1vYGbOHtLmg3aKq5bpfc3ZMP6CMOAf7Ww++/soe3XZm5hZt/ 3PeP57pZCO9LCWNDaz+cjfe3/ZoUBc2FybuKHoIa0bYDj9weMouKtPNz4Ec5WAbsBgY7 o8WQ== X-Gm-Message-State: ABy/qLa3y4wo3KFeUmT59ndHO+nLfh9WNa/hZOJU03e/WaisiFJZpwva tu2Bo3XzDGq6PbRGS/4gfqZXuNKO5ddBUvbJNmU= X-Google-Smtp-Source: APBJJlE44RUPUP3Bb3OzAgwrFU2twutzv5RYinhy/mDdLzIYU9MZBBtcMF9xx8bUm5Worf8bj1d48g== X-Received: by 2002:a6b:7b49:0:b0:783:6544:cc9e with SMTP id m9-20020a6b7b49000000b007836544cc9emr370020iop.8.1689955645099; Fri, 21 Jul 2023 09:07:25 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r17-20020a6bd911000000b0078680780694sm1158685ioc.34.2023.07.21.09.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 09:07:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Simon Glass , Heinrich Schuchardt Subject: [PATCH 2/6] dtoc: Make properties dirty when purging them Date: Fri, 21 Jul 2023 10:07:02 -0600 Message-ID: <20230721160710.968748-3-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230721160710.968748-1-sjg@chromium.org> References: <20230721160710.968748-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Without the 'dirty' flag properties are not written back to the devicetree when synced. This means that new properties copied over to a node are not always written out. Fix this and add a test. Signed-off-by: Simon Glass --- tools/dtoc/fdt.py | 1 + tools/dtoc/test/dtoc_test_copy.dts | 6 ++++-- tools/dtoc/test_fdt.py | 16 +++++++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index fd0f3e94f5c0..2589be990ae9 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -272,6 +272,7 @@ class Prop: the FDT is synced """ self._offset = None + self.dirty = True class Node: """A device tree node diff --git a/tools/dtoc/test/dtoc_test_copy.dts b/tools/dtoc/test/dtoc_test_copy.dts index 36faa9b72b56..8e50c7565928 100644 --- a/tools/dtoc/test/dtoc_test_copy.dts +++ b/tools/dtoc/test/dtoc_test_copy.dts @@ -37,11 +37,12 @@ new-prop; }; - second1 { + second1: second1 { new-prop; }; second4 { + use_second1 = <&second1>; }; }; }; @@ -65,12 +66,13 @@ }; second: second { - second1 { + second_1_bad: second1 { some-prop; }; second2 { some-prop; + use_second1_bad = <&second_1_bad>; }; }; }; diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 3e54694eec9f..84dcd8b5caa5 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -308,7 +308,7 @@ class TestNode(unittest.TestCase): def test_copy_node(self): """Test copy_node() function""" - def do_copy_checks(dtb, dst, expect_none): + def do_copy_checks(dtb, dst, second1_ph_val, expect_none): self.assertEqual( ['/dest/base', '/dest/first@0', '/dest/existing'], [n.path for n in dst.subnodes]) @@ -365,12 +365,22 @@ class TestNode(unittest.TestCase): ['second1', 'second2', 'second3', 'second4'], [n.name for n in second.subnodes]) + # Check the 'second_1_bad' phandle is not copied over + second1 = second.FindNode('second1') + self.assertTrue(second1) + sph = second1.props.get('phandle') + self.assertTrue(sph) + self.assertEqual(second1_ph_val, sph.bytes) + + dtb = fdt.FdtScan(find_dtb_file('dtoc_test_copy.dts')) tmpl = dtb.GetNode('/base') dst = dtb.GetNode('/dest') + second1_ph_val = (dtb.GetNode('/dest/base/second/second1'). + props['phandle'].bytes) dst.copy_node(tmpl) - do_copy_checks(dtb, dst, expect_none=True) + do_copy_checks(dtb, dst, second1_ph_val, expect_none=True) dtb.Sync(auto_resize=True) @@ -378,7 +388,7 @@ class TestNode(unittest.TestCase): new_dtb = fdt.Fdt.FromData(dtb.GetContents()) new_dtb.Scan() dst = new_dtb.GetNode('/dest') - do_copy_checks(new_dtb, dst, expect_none=False) + do_copy_checks(new_dtb, dst, second1_ph_val, expect_none=False) def test_copy_subnodes_from_phandles(self): """Test copy_node() function""" -- 2.41.0.487.g6d72f3e995-goog