[PATCH 2/9] utils: gen-debug-controls: Fix handling of controls that appear multiple times
Kieran Bingham
kieran.bingham at ideasonboard.com
Mon Mar 31 18:35:09 CEST 2025
Quoting Stefan Klug (2025-03-31 15:43:41)
> Allow usage of the same debug control in multiple places as long as all
> instances are of the same type and size.
>
> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
> utils/gen-debug-controls.py | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/utils/gen-debug-controls.py b/utils/gen-debug-controls.py
> index 53c8fa70d76d..ff22b986475e 100755
> --- a/utils/gen-debug-controls.py
> +++ b/utils/gen-debug-controls.py
> @@ -96,6 +96,7 @@ def main(argv):
> controls_map[k] = v
>
> obsolete_names = list(controls_map.keys())
> + found_by_name = {}
>
> for m in matches:
> if not m.type:
> @@ -111,6 +112,12 @@ def main(argv):
> if m.size is not None:
> desc['size'] = m.size
>
> + c = found_by_name.setdefault(m.name, m)
> + if c.type != m.type or c.size != m.size:
> + logger.error(
> + f"Found multiple entries for control '{m.name}' with differing type or size")
> + return 1
> +
> if m.name in controls_map:
> # Can't use == for modified check because of the special yaml dicts.
> update_needed = False
> @@ -127,7 +134,9 @@ def main(argv):
> controls_map[m.name].clear()
> controls_map[m.name].update(desc)
>
> - obsolete_names.remove(m.name)
> + # Don't try to remove more than once in case control was found in multiple files.
> + if m.name in obsolete_names:
> + obsolete_names.remove(m.name)
> else:
> logger.info(f"Add control '{m.name}'")
> insert_before = len(controls)
> --
> 2.43.0
>
More information about the libcamera-devel
mailing list