scripts: build: check_init_priorities: remove obsolete code

Removes a snippet of dead code.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This commit is contained in:
Florian Grandel 2024-09-06 11:09:29 +02:00 committed by Alberto Escolar
parent cb99cd795d
commit 41533a2eea
2 changed files with 0 additions and 40 deletions

View File

@ -41,10 +41,6 @@ _DEVICE_ORD_PREFIX = "__device_dts_ord_"
_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 @@ class Validator():
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))

View File

@ -332,35 +332,6 @@ class testValidator(unittest.TestCase):
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 <i1> 20 > /1 <i3> 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)