[{"id":36127,"web_url":"https://patchwork.libcamera.org/comment/36127/","msgid":"<20251006013332.GF13055@pendragon.ideasonboard.com>","date":"2025-10-06T01:33:32","subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote:\n> The v4l2-isp.h header exported from version\n> https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/\n> \n> includes the __counted_by() macro, which is not availale in Linux\n> uAPI headers older than version v6.5.\n> \n> Provide the macro here, to support older kernel versions.\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> ---\n>  include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++\n>  1 file changed, 18 insertions(+)\n> \n> diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h\n> index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644\n> --- a/include/linux/media/v4l2-isp.h\n> +++ b/include/linux/media/v4l2-isp.h\n> @@ -12,6 +12,24 @@\n>  #include <linux/stddef.h>\n>  #include <linux/types.h>\n>  \n> +/*\n> + * Provide __counted_by() if not available in linux/stddef.h\n> + *\n> + * The Linux macro __counted_by() has been introduced in kernel v6.5 and\n> + * is not available in older kernel version.\n> + *\n> + * See commit dd06e72e68bc (\"Compiler Attributes: Add __counted_by macro\")\n> + *\n> + * Provide it here if not available.\n> + */\n> +#if not defined(__counted_by)\n> +#if __has_attribute(__counted_by__)\n> +# define __counted_by(member)\t\t__attribute__((__counted_by__(member)))\n> +#else\n> +# define __counted_by(member)\n> +#endif\n> +#endif\n> +\n\nThis will break when we'll import a newer version of v4l2-isp.h from\nmainline using the helper script. Import stddef.h instead.\n\n>  #define V4L2_PARAMS_FL_BLOCK_DISABLE\t(1U << 0)\n>  #define V4L2_PARAMS_FL_BLOCK_ENABLE\t(1U << 1)\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 B11F0C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Oct 2025 01:33:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C131B6B5F3;\n\tMon,  6 Oct 2025 03:33:41 +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 E2571613AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Oct 2025 03:33:40 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 6AE381741; \n\tMon,  6 Oct 2025 03:32:07 +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=\"CgOOhrAN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759714327;\n\tbh=Rx6rkWc3P3BNH5nRQVxQ9/7cB0IseEUCgoxpgbE3rR0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=CgOOhrAN0MiGWi5fQRFJXxbJadz17UB+/PHK/mSH5HfkELjzxmo0Coxc3utGGLSpS\n\tLnYtGohQer1wUehGS8tyz/0poRVb+j6N41LjIeDFijIM1ZtBY4xOD0w2fP11Sgvpdv\n\tPBYRnc0tXkKm5+FP9ejN2P5jIQTXn8SakguRHIEk=","Date":"Mon, 6 Oct 2025 04:33:32 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","Message-ID":"<20251006013332.GF13055@pendragon.ideasonboard.com>","References":"<20251001-v4l2-params-v4-0-8f2b4779205e@ideasonboard.com>\n\t<20251001-v4l2-params-v4-2-8f2b4779205e@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251001-v4l2-params-v4-2-8f2b4779205e@ideasonboard.com>","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":36137,"web_url":"https://patchwork.libcamera.org/comment/36137/","msgid":"<4wotdmda6hjb3psiboc7aqlyjqo5ak7ca4w6xs3m2jote2ff2v@jrioaddfsj76>","date":"2025-10-06T09:45:32","subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Laurent\n\nOn Mon, Oct 06, 2025 at 04:33:32AM +0300, Laurent Pinchart wrote:\n> On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote:\n> > The v4l2-isp.h header exported from version\n> > https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/\n> >\n> > includes the __counted_by() macro, which is not availale in Linux\n> > uAPI headers older than version v6.5.\n> >\n> > Provide the macro here, to support older kernel versions.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > ---\n> >  include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++\n> >  1 file changed, 18 insertions(+)\n> >\n> > diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h\n> > index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644\n> > --- a/include/linux/media/v4l2-isp.h\n> > +++ b/include/linux/media/v4l2-isp.h\n> > @@ -12,6 +12,24 @@\n> >  #include <linux/stddef.h>\n> >  #include <linux/types.h>\n> >\n> > +/*\n> > + * Provide __counted_by() if not available in linux/stddef.h\n> > + *\n> > + * The Linux macro __counted_by() has been introduced in kernel v6.5 and\n> > + * is not available in older kernel version.\n> > + *\n> > + * See commit dd06e72e68bc (\"Compiler Attributes: Add __counted_by macro\")\n> > + *\n> > + * Provide it here if not available.\n> > + */\n> > +#if not defined(__counted_by)\n> > +#if __has_attribute(__counted_by__)\n> > +# define __counted_by(member)\t\t__attribute__((__counted_by__(member)))\n> > +#else\n> > +# define __counted_by(member)\n> > +#endif\n> > +#endif\n> > +\n>\n> This will break when we'll import a newer version of v4l2-isp.h from\n> mainline using the helper script. Import stddef.h instead.\n\nI read in the file\n\n#include <linux/stddef.h>\n\nDo you mean something different ?\n\n>\n> >  #define V4L2_PARAMS_FL_BLOCK_DISABLE\t(1U << 0)\n> >  #define V4L2_PARAMS_FL_BLOCK_ENABLE\t(1U << 1)\n> >\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 D37D3C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Oct 2025 09:45:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6BAC96B5F3;\n\tMon,  6 Oct 2025 11:45:38 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5EE4562C35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Oct 2025 11:45:36 +0200 (CEST)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D02D91BD0;\n\tMon,  6 Oct 2025 11:44:02 +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=\"czWMuCjN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759743842;\n\tbh=Je1GG5hRWqbmR4lSLZQ1ix4vbd8iOT0HRPxnfRw4u9w=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=czWMuCjNIoIUzsojxMwLHzA+2PrMZBGdfnA2ugpcioQ9XtIkEaive615rvIDTsxe/\n\t6QvhBwlinC9RsEZpsOPatCX8/l0iXg3qXRAKUwjmwXi1cQKmoBvlbHv6koCUoA4XJX\n\t2Ro3oRoP7WxrX/qXd2pTKctvV/1xSX6H/XKFy+2Y=","Date":"Mon, 6 Oct 2025 11:45:32 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","Message-ID":"<4wotdmda6hjb3psiboc7aqlyjqo5ak7ca4w6xs3m2jote2ff2v@jrioaddfsj76>","References":"<20251001-v4l2-params-v4-0-8f2b4779205e@ideasonboard.com>\n\t<20251001-v4l2-params-v4-2-8f2b4779205e@ideasonboard.com>\n\t<20251006013332.GF13055@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251006013332.GF13055@pendragon.ideasonboard.com>","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":36138,"web_url":"https://patchwork.libcamera.org/comment/36138/","msgid":"<20251006095400.GB5944@pendragon.ideasonboard.com>","date":"2025-10-06T09:54:00","subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Oct 06, 2025 at 11:45:32AM +0200, Jacopo Mondi wrote:\n> On Mon, Oct 06, 2025 at 04:33:32AM +0300, Laurent Pinchart wrote:\n> > On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote:\n> > > The v4l2-isp.h header exported from version\n> > > https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/\n> > >\n> > > includes the __counted_by() macro, which is not availale in Linux\n> > > uAPI headers older than version v6.5.\n> > >\n> > > Provide the macro here, to support older kernel versions.\n> > >\n> > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > > ---\n> > >  include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++\n> > >  1 file changed, 18 insertions(+)\n> > >\n> > > diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h\n> > > index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644\n> > > --- a/include/linux/media/v4l2-isp.h\n> > > +++ b/include/linux/media/v4l2-isp.h\n> > > @@ -12,6 +12,24 @@\n> > >  #include <linux/stddef.h>\n> > >  #include <linux/types.h>\n> > >\n> > > +/*\n> > > + * Provide __counted_by() if not available in linux/stddef.h\n> > > + *\n> > > + * The Linux macro __counted_by() has been introduced in kernel v6.5 and\n> > > + * is not available in older kernel version.\n> > > + *\n> > > + * See commit dd06e72e68bc (\"Compiler Attributes: Add __counted_by macro\")\n> > > + *\n> > > + * Provide it here if not available.\n> > > + */\n> > > +#if not defined(__counted_by)\n> > > +#if __has_attribute(__counted_by__)\n> > > +# define __counted_by(member)\t\t__attribute__((__counted_by__(member)))\n> > > +#else\n> > > +# define __counted_by(member)\n> > > +#endif\n> > > +#endif\n> > > +\n> >\n> > This will break when we'll import a newer version of v4l2-isp.h from\n> > mainline using the helper script. Import stddef.h instead.\n> \n> I read in the file\n> \n> #include <linux/stddef.h>\n> \n> Do you mean something different ?\n\nI mean importing include/uapi/linux/stddef.h from the kernel sources\ninto libcamera. That will give you __counted_by().\n\n> > >  #define V4L2_PARAMS_FL_BLOCK_DISABLE\t(1U << 0)\n> > >  #define V4L2_PARAMS_FL_BLOCK_ENABLE\t(1U << 1)\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 4F536BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Oct 2025 09:54:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 008A862C35;\n\tMon,  6 Oct 2025 11:54:09 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5FC2B62C35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Oct 2025 11:54:08 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 6E77F1741; \n\tMon,  6 Oct 2025 11:52:35 +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=\"JOeO5/0H\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759744355;\n\tbh=PJy0BB0nFZRkKCi62PzqAQ8oocDDMDJuSuU3zJKjFso=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=JOeO5/0H+v5SiFqqcOu7PXIsvqb6U25+/d7VLqfI5KSaV2U8dN2lMNW/c8AhxMPXF\n\taKWI5NiJ/zL02QkIj+DlpUUMR8ns6GJalOWSKnn7yDHA1I9xsZoUDd/qKadOQfeek4\n\tcJwN8ioqBR+FLKXLj5Pxtz+dPqYAWGwW3c6o4BfY=","Date":"Mon, 6 Oct 2025 12:54:00 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","Message-ID":"<20251006095400.GB5944@pendragon.ideasonboard.com>","References":"<20251001-v4l2-params-v4-0-8f2b4779205e@ideasonboard.com>\n\t<20251001-v4l2-params-v4-2-8f2b4779205e@ideasonboard.com>\n\t<20251006013332.GF13055@pendragon.ideasonboard.com>\n\t<4wotdmda6hjb3psiboc7aqlyjqo5ak7ca4w6xs3m2jote2ff2v@jrioaddfsj76>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<4wotdmda6hjb3psiboc7aqlyjqo5ak7ca4w6xs3m2jote2ff2v@jrioaddfsj76>","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":36140,"web_url":"https://patchwork.libcamera.org/comment/36140/","msgid":"<xdygclnpnklkcgox4v2pgegek2f5bbufeaivlf2woud2imhs3y@l5qywbbp5gpt>","date":"2025-10-06T10:20:57","subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Laurent\n\nOn Mon, Oct 06, 2025 at 12:54:00PM +0300, Laurent Pinchart wrote:\n> On Mon, Oct 06, 2025 at 11:45:32AM +0200, Jacopo Mondi wrote:\n> > On Mon, Oct 06, 2025 at 04:33:32AM +0300, Laurent Pinchart wrote:\n> > > On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote:\n> > > > The v4l2-isp.h header exported from version\n> > > > https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/\n> > > >\n> > > > includes the __counted_by() macro, which is not availale in Linux\n> > > > uAPI headers older than version v6.5.\n> > > >\n> > > > Provide the macro here, to support older kernel versions.\n> > > >\n> > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > > > ---\n> > > >  include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++\n> > > >  1 file changed, 18 insertions(+)\n> > > >\n> > > > diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h\n> > > > index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644\n> > > > --- a/include/linux/media/v4l2-isp.h\n> > > > +++ b/include/linux/media/v4l2-isp.h\n> > > > @@ -12,6 +12,24 @@\n> > > >  #include <linux/stddef.h>\n> > > >  #include <linux/types.h>\n> > > >\n> > > > +/*\n> > > > + * Provide __counted_by() if not available in linux/stddef.h\n> > > > + *\n> > > > + * The Linux macro __counted_by() has been introduced in kernel v6.5 and\n> > > > + * is not available in older kernel version.\n> > > > + *\n> > > > + * See commit dd06e72e68bc (\"Compiler Attributes: Add __counted_by macro\")\n> > > > + *\n> > > > + * Provide it here if not available.\n> > > > + */\n> > > > +#if not defined(__counted_by)\n> > > > +#if __has_attribute(__counted_by__)\n> > > > +# define __counted_by(member)\t\t__attribute__((__counted_by__(member)))\n> > > > +#else\n> > > > +# define __counted_by(member)\n> > > > +#endif\n> > > > +#endif\n> > > > +\n> > >\n> > > This will break when we'll import a newer version of v4l2-isp.h from\n> > > mainline using the helper script. Import stddef.h instead.\n> >\n> > I read in the file\n> >\n> > #include <linux/stddef.h>\n> >\n> > Do you mean something different ?\n>\n> I mean importing include/uapi/linux/stddef.h from the kernel sources\n> into libcamera. That will give you __counted_by().\n>\n\nI thought it was risky, as we will include a stddef newer than the\nsystem provided one. Although as uapi should be backward compatible,\nthis might be fine\n\n> > > >  #define V4L2_PARAMS_FL_BLOCK_DISABLE\t(1U << 0)\n> > > >  #define V4L2_PARAMS_FL_BLOCK_ENABLE\t(1U << 1)\n> > > >\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 8F2A1C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Oct 2025 10:21:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0B0786B5F3;\n\tMon,  6 Oct 2025 12:21:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 676D86936E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Oct 2025 12:21:01 +0200 (CEST)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9F50BBD2;\n\tMon,  6 Oct 2025 12:19:28 +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=\"ldaTzOd4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759745968;\n\tbh=D+14qSf/+vF8pJLI4F4ITxF+DbWz7k2ZENWTNwqBomY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ldaTzOd4KhuyuL/tuC9N8WSFZzlKCNqOaZm/AELj86nkWJ27ikTCqXEZR65mQM09y\n\tpdQTmxX8t6u8VI/CMTWC24MuMomTSOkmthcz6k23EvN7r4/D0jHeWhTnXCkXH9mcTf\n\tPV+UEbxO2fd7zn+yfWfWcMCeZU1iU3h2huJfpFKw=","Date":"Mon, 6 Oct 2025 12:20:57 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","Message-ID":"<xdygclnpnklkcgox4v2pgegek2f5bbufeaivlf2woud2imhs3y@l5qywbbp5gpt>","References":"<20251001-v4l2-params-v4-0-8f2b4779205e@ideasonboard.com>\n\t<20251001-v4l2-params-v4-2-8f2b4779205e@ideasonboard.com>\n\t<20251006013332.GF13055@pendragon.ideasonboard.com>\n\t<4wotdmda6hjb3psiboc7aqlyjqo5ak7ca4w6xs3m2jote2ff2v@jrioaddfsj76>\n\t<20251006095400.GB5944@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251006095400.GB5944@pendragon.ideasonboard.com>","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":36150,"web_url":"https://patchwork.libcamera.org/comment/36150/","msgid":"<20251006144518.GE5944@pendragon.ideasonboard.com>","date":"2025-10-06T14:45:18","subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Oct 06, 2025 at 12:20:57PM +0200, Jacopo Mondi wrote:\n> On Mon, Oct 06, 2025 at 12:54:00PM +0300, Laurent Pinchart wrote:\n> > On Mon, Oct 06, 2025 at 11:45:32AM +0200, Jacopo Mondi wrote:\n> > > On Mon, Oct 06, 2025 at 04:33:32AM +0300, Laurent Pinchart wrote:\n> > > > On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote:\n> > > > > The v4l2-isp.h header exported from version\n> > > > > https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/\n> > > > >\n> > > > > includes the __counted_by() macro, which is not availale in Linux\n> > > > > uAPI headers older than version v6.5.\n> > > > >\n> > > > > Provide the macro here, to support older kernel versions.\n> > > > >\n> > > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > > > > ---\n> > > > >  include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++\n> > > > >  1 file changed, 18 insertions(+)\n> > > > >\n> > > > > diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h\n> > > > > index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644\n> > > > > --- a/include/linux/media/v4l2-isp.h\n> > > > > +++ b/include/linux/media/v4l2-isp.h\n> > > > > @@ -12,6 +12,24 @@\n> > > > >  #include <linux/stddef.h>\n> > > > >  #include <linux/types.h>\n> > > > >\n> > > > > +/*\n> > > > > + * Provide __counted_by() if not available in linux/stddef.h\n> > > > > + *\n> > > > > + * The Linux macro __counted_by() has been introduced in kernel v6.5 and\n> > > > > + * is not available in older kernel version.\n> > > > > + *\n> > > > > + * See commit dd06e72e68bc (\"Compiler Attributes: Add __counted_by macro\")\n> > > > > + *\n> > > > > + * Provide it here if not available.\n> > > > > + */\n> > > > > +#if not defined(__counted_by)\n> > > > > +#if __has_attribute(__counted_by__)\n> > > > > +# define __counted_by(member)\t\t__attribute__((__counted_by__(member)))\n> > > > > +#else\n> > > > > +# define __counted_by(member)\n> > > > > +#endif\n> > > > > +#endif\n> > > > > +\n> > > >\n> > > > This will break when we'll import a newer version of v4l2-isp.h from\n> > > > mainline using the helper script. Import stddef.h instead.\n> > >\n> > > I read in the file\n> > >\n> > > #include <linux/stddef.h>\n> > >\n> > > Do you mean something different ?\n> >\n> > I mean importing include/uapi/linux/stddef.h from the kernel sources\n> > into libcamera. That will give you __counted_by().\n> \n> I thought it was risky, as we will include a stddef newer than the\n> system provided one. Although as uapi should be backward compatible,\n> this might be fine\n\nNote it's linux/stddef.h, not stddef.h from the C language (provided by\nthe compiler), so I think it should be fine.\n\n> > > > >  #define V4L2_PARAMS_FL_BLOCK_DISABLE\t(1U << 0)\n> > > > >  #define V4L2_PARAMS_FL_BLOCK_ENABLE\t(1U << 1)\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 8580DC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Oct 2025 14:45:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 22B4F6B5F3;\n\tMon,  6 Oct 2025 16:45:28 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 94BF96936E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Oct 2025 16:45:26 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 7A3E5929;\n\tMon,  6 Oct 2025 16:43:53 +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=\"MPTq21R6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759761833;\n\tbh=x370Hat8alPUIrojyk65gXbggtwi9RnX7iwcztIJNtQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=MPTq21R6LhEb6YS4LrH+UKFsgAOAfmDBWl2cQ7PIk1AbZ5jycsFntSbF2oIocFkRe\n\tS/kta4eErjkwxphKvEO2jqEhbWCay/OJPjp1hiYFmmu2v+m7VjmdbCh4Q81h7EbgEL\n\tsLLoL5Gg31s7u/4jvPKd68EnK2+hWanZwCS4HQFg=","Date":"Mon, 6 Oct 2025 17:45:18 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 2/5] include: linux: v4l2-isp: Provide __counted_by()","Message-ID":"<20251006144518.GE5944@pendragon.ideasonboard.com>","References":"<20251001-v4l2-params-v4-0-8f2b4779205e@ideasonboard.com>\n\t<20251001-v4l2-params-v4-2-8f2b4779205e@ideasonboard.com>\n\t<20251006013332.GF13055@pendragon.ideasonboard.com>\n\t<4wotdmda6hjb3psiboc7aqlyjqo5ak7ca4w6xs3m2jote2ff2v@jrioaddfsj76>\n\t<20251006095400.GB5944@pendragon.ideasonboard.com>\n\t<xdygclnpnklkcgox4v2pgegek2f5bbufeaivlf2woud2imhs3y@l5qywbbp5gpt>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<xdygclnpnklkcgox4v2pgegek2f5bbufeaivlf2woud2imhs3y@l5qywbbp5gpt>","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>"}}]