From 41533a2eea227ae2ae720a97ab166178a82934bc Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Fri, 6 Sep 2024 11:09:29 +0200 Subject: [PATCH] scripts: build: check_init_priorities: remove obsolete code Removes a snippet of dead code. Signed-off-by: Florian Grandel --- scripts/build/check_init_priorities.py | 11 -------- scripts/build/check_init_priorities_test.py | 29 --------------------- 2 files changed, 40 deletions(-) diff --git a/scripts/build/check_init_priorities.py b/scripts/build/check_init_priorities.py index 4e2c50ddf27aa8..dc028aa31de284 100755 --- a/scripts/build/check_init_priorities.py +++ b/scripts/build/check_init_priorities.py @@ -41,10 +41,6 @@ _DEVICE_INIT_LEVELS = ["EARLY", "PRE_KERNEL_1", "PRE_KERNEL_2", "POST_KERNEL", "APPLICATION", "SMP"] -# List of compatibles for node where the initialization priority should be the -# opposite of the device tree inferred dependency. -_INVERTED_PRIORITY_COMPATIBLES = frozenset() - # List of compatibles for nodes where we don't check the priority. _IGNORE_COMPATIBLES = frozenset([ # There is no direct dependency between the CDC ACM UART and the USB @@ -260,13 +256,6 @@ def _check_dep(self, dev_ord, dep_ord): self.log.info(f"Ignoring priority: {dev_node._binding.compatible}") return - if dev_node._binding and dep_node._binding: - dev_compat = dev_node._binding.compatible - dep_compat = dep_node._binding.compatible - if (dev_compat, dep_compat) in _INVERTED_PRIORITY_COMPATIBLES: - self.log.info(f"Swapped priority: {dev_compat}, {dep_compat}") - dev_ord, dep_ord = dep_ord, dev_ord - dev_prio, dev_init = self._obj.devices.get(dev_ord, (None, None)) dep_prio, dep_init = self._obj.devices.get(dep_ord, (None, None)) diff --git a/scripts/build/check_init_priorities_test.py b/scripts/build/check_init_priorities_test.py index c7b2aabb25f466..16cf9af7406507 100755 --- a/scripts/build/check_init_priorities_test.py +++ b/scripts/build/check_init_priorities_test.py @@ -332,35 +332,6 @@ def test_check_same_prio_assert(self, mock_vinit): with self.assertRaises(ValueError): validator._check_dep(1, 2) - @mock.patch("check_init_priorities.Validator.__init__", return_value=None) - def test_check_swapped(self, mock_vinit): - validator = check_init_priorities.Validator("", "", None) - validator.log = mock.Mock() - validator._obj = mock.Mock() - validator.errors = 0 - - save_inverted_priorities = check_init_priorities._INVERTED_PRIORITY_COMPATIBLES - - check_init_priorities._INVERTED_PRIORITY_COMPATIBLES = set([("compat-3", "compat-1")]) - - validator._ord2node = {1: mock.Mock(), 3: mock.Mock()} - validator._ord2node[1]._binding.compatible = "compat-1" - validator._ord2node[1].path = "/1" - validator._ord2node[3]._binding.compatible = "compat-3" - validator._ord2node[3].path = "/3" - - validator._obj.devices = {1: (20, "i1"), 3: (10, "i3")} - - validator._check_dep(3, 1) - - self.assertListEqual(validator.log.info.call_args_list, [ - mock.call("Swapped priority: compat-3, compat-1"), - mock.call("/3 20 > /1 10"), - ]) - self.assertEqual(validator.errors, 0) - - check_init_priorities._INVERTED_PRIORITY_COMPATIBLES = save_inverted_priorities - @mock.patch("check_init_priorities.Validator.__init__", return_value=None) def test_check_ignored(self, mock_vinit): validator = check_init_priorities.Validator("", "", None)