Skip to content
Commit 15488be6 authored by Grzegorz Swiderski's avatar Grzegorz Swiderski Committed by Benjamin Cabé
Browse files

scripts: dts: Refactor gen_driver_kconfig_dts

The motivation for this patch was to improve the script's performance,
but some stylistic changes and cleanups are included as well.

The main optimization concerns the use of PyYAML, as it offers multiple
functions for interpreting YAML. The commonly used `load`/`safe_load`
converts a YAML stream to a dictionary. There are also `scan`, `parse`,
and `compose`, which return intermediate representations, the last one
being a graph. [1]

Since `gen_driver_kconfig_dts` scans DT bindings for compatible strings,
it only needs to look through top level keys in YAML. The intermediate
PyYAML graph is sufficient for this, and using it reduces the script's
execution time by about 30%, without making the code too complicated.

[1] - https://pyyaml.org/wiki/PyYAMLDocumentation



Signed-off-by: default avatarGrzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
parent d46546e2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment