| Message ID | 20251001-v4l2-params-v4-2-8f2b4779205e@ideasonboard.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote: > The v4l2-isp.h header exported from version > https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/ > > includes the __counted_by() macro, which is not availale in Linux > uAPI headers older than version v6.5. > > Provide the macro here, to support older kernel versions. > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > --- > include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h > index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644 > --- a/include/linux/media/v4l2-isp.h > +++ b/include/linux/media/v4l2-isp.h > @@ -12,6 +12,24 @@ > #include <linux/stddef.h> > #include <linux/types.h> > > +/* > + * Provide __counted_by() if not available in linux/stddef.h > + * > + * The Linux macro __counted_by() has been introduced in kernel v6.5 and > + * is not available in older kernel version. > + * > + * See commit dd06e72e68bc ("Compiler Attributes: Add __counted_by macro") > + * > + * Provide it here if not available. > + */ > +#if not defined(__counted_by) > +#if __has_attribute(__counted_by__) > +# define __counted_by(member) __attribute__((__counted_by__(member))) > +#else > +# define __counted_by(member) > +#endif > +#endif > + This will break when we'll import a newer version of v4l2-isp.h from mainline using the helper script. Import stddef.h instead. > #define V4L2_PARAMS_FL_BLOCK_DISABLE (1U << 0) > #define V4L2_PARAMS_FL_BLOCK_ENABLE (1U << 1) >
Hi Laurent On Mon, Oct 06, 2025 at 04:33:32AM +0300, Laurent Pinchart wrote: > On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote: > > The v4l2-isp.h header exported from version > > https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/ > > > > includes the __counted_by() macro, which is not availale in Linux > > uAPI headers older than version v6.5. > > > > Provide the macro here, to support older kernel versions. > > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > --- > > include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++ > > 1 file changed, 18 insertions(+) > > > > diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h > > index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644 > > --- a/include/linux/media/v4l2-isp.h > > +++ b/include/linux/media/v4l2-isp.h > > @@ -12,6 +12,24 @@ > > #include <linux/stddef.h> > > #include <linux/types.h> > > > > +/* > > + * Provide __counted_by() if not available in linux/stddef.h > > + * > > + * The Linux macro __counted_by() has been introduced in kernel v6.5 and > > + * is not available in older kernel version. > > + * > > + * See commit dd06e72e68bc ("Compiler Attributes: Add __counted_by macro") > > + * > > + * Provide it here if not available. > > + */ > > +#if not defined(__counted_by) > > +#if __has_attribute(__counted_by__) > > +# define __counted_by(member) __attribute__((__counted_by__(member))) > > +#else > > +# define __counted_by(member) > > +#endif > > +#endif > > + > > This will break when we'll import a newer version of v4l2-isp.h from > mainline using the helper script. Import stddef.h instead. I read in the file #include <linux/stddef.h> Do you mean something different ? > > > #define V4L2_PARAMS_FL_BLOCK_DISABLE (1U << 0) > > #define V4L2_PARAMS_FL_BLOCK_ENABLE (1U << 1) > > > > -- > Regards, > > Laurent Pinchart
On Mon, Oct 06, 2025 at 11:45:32AM +0200, Jacopo Mondi wrote: > On Mon, Oct 06, 2025 at 04:33:32AM +0300, Laurent Pinchart wrote: > > On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote: > > > The v4l2-isp.h header exported from version > > > https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/ > > > > > > includes the __counted_by() macro, which is not availale in Linux > > > uAPI headers older than version v6.5. > > > > > > Provide the macro here, to support older kernel versions. > > > > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > > --- > > > include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++ > > > 1 file changed, 18 insertions(+) > > > > > > diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h > > > index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644 > > > --- a/include/linux/media/v4l2-isp.h > > > +++ b/include/linux/media/v4l2-isp.h > > > @@ -12,6 +12,24 @@ > > > #include <linux/stddef.h> > > > #include <linux/types.h> > > > > > > +/* > > > + * Provide __counted_by() if not available in linux/stddef.h > > > + * > > > + * The Linux macro __counted_by() has been introduced in kernel v6.5 and > > > + * is not available in older kernel version. > > > + * > > > + * See commit dd06e72e68bc ("Compiler Attributes: Add __counted_by macro") > > > + * > > > + * Provide it here if not available. > > > + */ > > > +#if not defined(__counted_by) > > > +#if __has_attribute(__counted_by__) > > > +# define __counted_by(member) __attribute__((__counted_by__(member))) > > > +#else > > > +# define __counted_by(member) > > > +#endif > > > +#endif > > > + > > > > This will break when we'll import a newer version of v4l2-isp.h from > > mainline using the helper script. Import stddef.h instead. > > I read in the file > > #include <linux/stddef.h> > > Do you mean something different ? I mean importing include/uapi/linux/stddef.h from the kernel sources into libcamera. That will give you __counted_by(). > > > #define V4L2_PARAMS_FL_BLOCK_DISABLE (1U << 0) > > > #define V4L2_PARAMS_FL_BLOCK_ENABLE (1U << 1) > > >
Hi Laurent On Mon, Oct 06, 2025 at 12:54:00PM +0300, Laurent Pinchart wrote: > On Mon, Oct 06, 2025 at 11:45:32AM +0200, Jacopo Mondi wrote: > > On Mon, Oct 06, 2025 at 04:33:32AM +0300, Laurent Pinchart wrote: > > > On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote: > > > > The v4l2-isp.h header exported from version > > > > https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/ > > > > > > > > includes the __counted_by() macro, which is not availale in Linux > > > > uAPI headers older than version v6.5. > > > > > > > > Provide the macro here, to support older kernel versions. > > > > > > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > > > --- > > > > include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++ > > > > 1 file changed, 18 insertions(+) > > > > > > > > diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h > > > > index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644 > > > > --- a/include/linux/media/v4l2-isp.h > > > > +++ b/include/linux/media/v4l2-isp.h > > > > @@ -12,6 +12,24 @@ > > > > #include <linux/stddef.h> > > > > #include <linux/types.h> > > > > > > > > +/* > > > > + * Provide __counted_by() if not available in linux/stddef.h > > > > + * > > > > + * The Linux macro __counted_by() has been introduced in kernel v6.5 and > > > > + * is not available in older kernel version. > > > > + * > > > > + * See commit dd06e72e68bc ("Compiler Attributes: Add __counted_by macro") > > > > + * > > > > + * Provide it here if not available. > > > > + */ > > > > +#if not defined(__counted_by) > > > > +#if __has_attribute(__counted_by__) > > > > +# define __counted_by(member) __attribute__((__counted_by__(member))) > > > > +#else > > > > +# define __counted_by(member) > > > > +#endif > > > > +#endif > > > > + > > > > > > This will break when we'll import a newer version of v4l2-isp.h from > > > mainline using the helper script. Import stddef.h instead. > > > > I read in the file > > > > #include <linux/stddef.h> > > > > Do you mean something different ? > > I mean importing include/uapi/linux/stddef.h from the kernel sources > into libcamera. That will give you __counted_by(). > I thought it was risky, as we will include a stddef newer than the system provided one. Although as uapi should be backward compatible, this might be fine > > > > #define V4L2_PARAMS_FL_BLOCK_DISABLE (1U << 0) > > > > #define V4L2_PARAMS_FL_BLOCK_ENABLE (1U << 1) > > > > > > -- > Regards, > > Laurent Pinchart
On Mon, Oct 06, 2025 at 12:20:57PM +0200, Jacopo Mondi wrote: > On Mon, Oct 06, 2025 at 12:54:00PM +0300, Laurent Pinchart wrote: > > On Mon, Oct 06, 2025 at 11:45:32AM +0200, Jacopo Mondi wrote: > > > On Mon, Oct 06, 2025 at 04:33:32AM +0300, Laurent Pinchart wrote: > > > > On Wed, Oct 01, 2025 at 05:42:31PM +0200, Jacopo Mondi wrote: > > > > > The v4l2-isp.h header exported from version > > > > > https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/ > > > > > > > > > > includes the __counted_by() macro, which is not availale in Linux > > > > > uAPI headers older than version v6.5. > > > > > > > > > > Provide the macro here, to support older kernel versions. > > > > > > > > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > > > > --- > > > > > include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++ > > > > > 1 file changed, 18 insertions(+) > > > > > > > > > > diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h > > > > > index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644 > > > > > --- a/include/linux/media/v4l2-isp.h > > > > > +++ b/include/linux/media/v4l2-isp.h > > > > > @@ -12,6 +12,24 @@ > > > > > #include <linux/stddef.h> > > > > > #include <linux/types.h> > > > > > > > > > > +/* > > > > > + * Provide __counted_by() if not available in linux/stddef.h > > > > > + * > > > > > + * The Linux macro __counted_by() has been introduced in kernel v6.5 and > > > > > + * is not available in older kernel version. > > > > > + * > > > > > + * See commit dd06e72e68bc ("Compiler Attributes: Add __counted_by macro") > > > > > + * > > > > > + * Provide it here if not available. > > > > > + */ > > > > > +#if not defined(__counted_by) > > > > > +#if __has_attribute(__counted_by__) > > > > > +# define __counted_by(member) __attribute__((__counted_by__(member))) > > > > > +#else > > > > > +# define __counted_by(member) > > > > > +#endif > > > > > +#endif > > > > > + > > > > > > > > This will break when we'll import a newer version of v4l2-isp.h from > > > > mainline using the helper script. Import stddef.h instead. > > > > > > I read in the file > > > > > > #include <linux/stddef.h> > > > > > > Do you mean something different ? > > > > I mean importing include/uapi/linux/stddef.h from the kernel sources > > into libcamera. That will give you __counted_by(). > > I thought it was risky, as we will include a stddef newer than the > system provided one. Although as uapi should be backward compatible, > this might be fine Note it's linux/stddef.h, not stddef.h from the C language (provided by the compiler), so I think it should be fine. > > > > > #define V4L2_PARAMS_FL_BLOCK_DISABLE (1U << 0) > > > > > #define V4L2_PARAMS_FL_BLOCK_ENABLE (1U << 1) > > > > >
diff --git a/include/linux/media/v4l2-isp.h b/include/linux/media/v4l2-isp.h index fed89b5678585a3565d33cf873d0313dc089524f..ea23dfdeeab9e69959cd8fa3c4853e931f36198a 100644 --- a/include/linux/media/v4l2-isp.h +++ b/include/linux/media/v4l2-isp.h @@ -12,6 +12,24 @@ #include <linux/stddef.h> #include <linux/types.h> +/* + * Provide __counted_by() if not available in linux/stddef.h + * + * The Linux macro __counted_by() has been introduced in kernel v6.5 and + * is not available in older kernel version. + * + * See commit dd06e72e68bc ("Compiler Attributes: Add __counted_by macro") + * + * Provide it here if not available. + */ +#if not defined(__counted_by) +#if __has_attribute(__counted_by__) +# define __counted_by(member) __attribute__((__counted_by__(member))) +#else +# define __counted_by(member) +#endif +#endif + #define V4L2_PARAMS_FL_BLOCK_DISABLE (1U << 0) #define V4L2_PARAMS_FL_BLOCK_ENABLE (1U << 1)
The v4l2-isp.h header exported from version https://lore.kernel.org/all/20250915-extensible-parameters-validation-v5-0-e6db94468af3@ideasonboard.com/ includes the __counted_by() macro, which is not availale in Linux uAPI headers older than version v6.5. Provide the macro here, to support older kernel versions. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> --- include/linux/media/v4l2-isp.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)