From patchwork Fri Apr 11 12:36:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 23159 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id BE86CC327D for ; Fri, 11 Apr 2025 12:36:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7249468A9D; Fri, 11 Apr 2025 14:36:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="V2yDVZSm"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E23468A90 for ; Fri, 11 Apr 2025 14:36:52 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:5b21:2ad5:1023:7179]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DBCAF735; Fri, 11 Apr 2025 14:34:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1744374893; bh=PfG1v9RSZ8jfa4zZ4EAddT/V3talYJ18VZsMaO34lEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2yDVZSmSHgj3SyD77/R0fizQxFqMlP2PeY8Jm46sDVnCNeVTv7JQh8hQS0lDA6jh clOzCVXZyEWogwXHOUvhYo1BdQ3+0qOBgiqWZtqB5sMgn6ZjReYKTBDGtd+dgWia9r nEDd67OGtPJwplsQFvpO1jdLUA2kKPvod1nOEe28= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Kieran Bingham Subject: [PATCH v2 2/9] utils: gen-debug-controls: Fix handling of controls that appear multiple times Date: Fri, 11 Apr 2025 14:36:30 +0200 Message-ID: <20250411123641.2144530-3-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250411123641.2144530-1-stefan.klug@ideasonboard.com> References: <20250411123641.2144530-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Acked-by: Kieran Bingham --- Changes in v2: - Collected tag --- 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 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)