[{"id":34185,"web_url":"https://patchwork.libcamera.org/comment/34185/","msgid":"<174699005361.1551504.902107912784512836@pyrite.rasen.tech>","date":"2025-05-11T19:00:53","subject":"Re: [PATCH v2 2/9] utils: gen-debug-controls: Fix handling of\n\tcontrols that appear multiple times","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-04-11 14:36:30)\n> Allow usage of the same debug control in multiple places as long as all\n> instances are of the same type and size.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> ---\n> \n> Changes in v2:\n> - Collected tag\n> ---\n>  utils/gen-debug-controls.py | 11 ++++++++++-\n>  1 file changed, 10 insertions(+), 1 deletion(-)\n> \n> diff --git a/utils/gen-debug-controls.py b/utils/gen-debug-controls.py\n> index 53c8fa70d76d..ff22b986475e 100755\n> --- a/utils/gen-debug-controls.py\n> +++ b/utils/gen-debug-controls.py\n> @@ -96,6 +96,7 @@ def main(argv):\n>              controls_map[k] = v\n>  \n>      obsolete_names = list(controls_map.keys())\n> +    found_by_name = {}\n>  \n>      for m in matches:\n>          if not m.type:\n> @@ -111,6 +112,12 @@ def main(argv):\n>          if m.size is not None:\n>              desc['size'] = m.size\n>  \n> +        c = found_by_name.setdefault(m.name, m)\n> +        if c.type != m.type or c.size != m.size:\n> +            logger.error(\n> +                f\"Found multiple entries for control '{m.name}' with differing type or size\")\n> +            return 1\n> +\n>          if m.name in controls_map:\n>              # Can't use == for modified check because of the special yaml dicts.\n>              update_needed = False\n> @@ -127,7 +134,9 @@ def main(argv):\n>                  controls_map[m.name].clear()\n>                  controls_map[m.name].update(desc)\n>  \n> -            obsolete_names.remove(m.name)\n> +            # Don't try to remove more than once in case control was found multiple files.\n> +            if m.name in obsolete_names:\n> +                obsolete_names.remove(m.name)\n>          else:\n>              logger.info(f\"Add control '{m.name}'\")\n>              insert_before = len(controls)\n> -- \n> 2.43.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5770FC3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 11 May 2025 19:01:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A378F68B51;\n\tSun, 11 May 2025 21:00:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 54CD968B51\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 11 May 2025 21:00:58 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2001:861:3a80:3300:4f2f:8c2c:b3ef:17d4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BC7C9D80;\n\tSun, 11 May 2025 21:00:43 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"eGn8k2cL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1746990043;\n\tbh=fJUKNWp3P2Zz7BXqPrvhE8bohCobO3NjoR5bvtQx5i0=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=eGn8k2cL94y5ENpv33SYqFG+OxpPpZinv+Ck6IspPqtbowYtfXZn/FqQ/4T6+uuOG\n\tqwX0Sq2/J4ZtBv3VMlRUeqUF7SMr4k7ft3Cte9wsi5xeX6IQjVkML4AzgINXZJdxRZ\n\tZFaaVdivh7lNZmzV9hYvoKdMM5BOKNnxf6GbsOiQ=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250411123641.2144530-3-stefan.klug@ideasonboard.com>","References":"<20250411123641.2144530-1-stefan.klug@ideasonboard.com>\n\t<20250411123641.2144530-3-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v2 2/9] utils: gen-debug-controls: Fix handling of\n\tcontrols that appear multiple times","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Sun, 11 May 2025 21:00:53 +0200","Message-ID":"<174699005361.1551504.902107912784512836@pyrite.rasen.tech>","User-Agent":"alot/0.0.0","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34245,"web_url":"https://patchwork.libcamera.org/comment/34245/","msgid":"<174731462627.752293.558414486397716722@isaac-ThinkPad-T16-Gen-2>","date":"2025-05-15T13:10:26","subject":"Re: [PATCH v2 2/9] utils: gen-debug-controls: Fix handling of\n\tcontrols that appear multiple times","submitter":{"id":215,"url":"https://patchwork.libcamera.org/api/people/215/","name":"Isaac Scott","email":"isaac.scott@ideasonboard.com"},"content":"Hi Stefan,\n\nQuoting Stefan Klug (2025-04-11 13:36:30)\n> Allow usage of the same debug control in multiple places as long as all\n> instances are of the same type and size.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n\nReviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n\n> ---\n> \n> Changes in v2:\n> - Collected tag\n> ---\n>  utils/gen-debug-controls.py | 11 ++++++++++-\n>  1 file changed, 10 insertions(+), 1 deletion(-)\n> \n> diff --git a/utils/gen-debug-controls.py b/utils/gen-debug-controls.py\n> index 53c8fa70d76d..ff22b986475e 100755\n> --- a/utils/gen-debug-controls.py\n> +++ b/utils/gen-debug-controls.py\n> @@ -96,6 +96,7 @@ def main(argv):\n>              controls_map[k] = v\n>  \n>      obsolete_names = list(controls_map.keys())\n> +    found_by_name = {}\n>  \n>      for m in matches:\n>          if not m.type:\n> @@ -111,6 +112,12 @@ def main(argv):\n>          if m.size is not None:\n>              desc['size'] = m.size\n>  \n> +        c = found_by_name.setdefault(m.name, m)\n> +        if c.type != m.type or c.size != m.size:\n> +            logger.error(\n> +                f\"Found multiple entries for control '{m.name}' with differing type or size\")\n> +            return 1\n> +\n>          if m.name in controls_map:\n>              # Can't use == for modified check because of the special yaml dicts.\n>              update_needed = False\n> @@ -127,7 +134,9 @@ def main(argv):\n>                  controls_map[m.name].clear()\n>                  controls_map[m.name].update(desc)\n>  \n> -            obsolete_names.remove(m.name)\n> +            # Don't try to remove more than once in case control was found multiple files.\n> +            if m.name in obsolete_names:\n> +                obsolete_names.remove(m.name)\n>          else:\n>              logger.info(f\"Add control '{m.name}'\")\n>              insert_before = len(controls)\n> -- \n> 2.43.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 90B18C3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 May 2025 13:10:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0C38D68B70;\n\tThu, 15 May 2025 15:10:36 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B05B568B4F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 May 2025 15:10:33 +0200 (CEST)","from thinkpad.ideasonboard.com (unknown\n\t[IPv6:2a01:cb16:204c:4644:3f69:4c6e:7066:a222])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5AEBE886;\n\tThu, 15 May 2025 15:10:16 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"KbunD5Ek\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747314616;\n\tbh=yoSFn5Pk8pZIXTSqX+rh+Ed23eRiIrijJnLf2OVVw8k=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=KbunD5Ek/c0F9xg+9/ctWx44m/DT/3HOEg2Bma1Hy/WJI1x6Cjt2yoqyKIPCBTdS7\n\tbY5VByFqNdVyNcABUucXhIw0Fj+gw5MSeUKhJba025OlhQ78XILR0lU9W52yhNrtlV\n\tX77phG0qg4fx7glTCYRqYeVEVdiGR0bqb6mycInA=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250411123641.2144530-3-stefan.klug@ideasonboard.com>","References":"<20250411123641.2144530-1-stefan.klug@ideasonboard.com>\n\t<20250411123641.2144530-3-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v2 2/9] utils: gen-debug-controls: Fix handling of\n\tcontrols that appear multiple times","From":"Isaac Scott <isaac.scott@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 15 May 2025 14:10:26 +0100","Message-ID":"<174731462627.752293.558414486397716722@isaac-ThinkPad-T16-Gen-2>","User-Agent":"alot/0.10","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]