From patchwork Mon Jul 7 08:55:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 23751 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 DE191C3237 for ; Mon, 7 Jul 2025 08:55:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7327B68E8C; Mon, 7 Jul 2025 10:55:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DydhLHMc"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4F47968E7F for ; Mon, 7 Jul 2025 10:55:40 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:c79f:85df:e7f5:4c31]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id A7A80190D; Mon, 7 Jul 2025 10:55:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1751878513; bh=mpWY2PdpGfqPwI38J+x1H4tmUL82j0GDHtT12cc7mXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DydhLHMctrE6MueYevdYSyr+aLVrGcMUCYUvtan9h/djh7FB7z33QAgKCJpVeQKLc Ayg/84rXR1x/jyNKSfnCT1IrwgUOGSz4Pat+B2JcYXs7CHJThAT72RULJ0YO+iu420 QYHXKFYbyTkpQ01vRNqLHcwjrJNZxK3qAHacT6fM= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Kieran Bingham , Paul Elder , Isaac Scott Subject: [PATCH v3 2/9] utils: gen-debug-controls: Fix handling of controls that appear multiple times Date: Mon, 7 Jul 2025 10:55:05 +0200 Message-ID: <20250707085520.39777-3-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250707085520.39777-1-stefan.klug@ideasonboard.com> References: <20250707085520.39777-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 Reviewed-by: Paul Elder Reviewed-by: Isaac Scott --- Changes in v3: - Collected tags 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)