summaryrefslogtreecommitdiff
path: root/include/uapi/linux/videodev2.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-03-17 15:37:12 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-07-15 17:02:39 +0300
commit718d2153ad0de0c7c0b6891eaa7f9918d68b6d5e (patch)
tree8436bee17e3efa1dd634406701c1459576052106 /include/uapi/linux/videodev2.h
parentb0afed239a5baf72cacc3023e852c7a5125c2a8f (diff)
downloadlinux-718d2153ad0de0c7c0b6891eaa7f9918d68b6d5e.tar.xz
media: v4l2: Make colorspace validity checks more future-proof
The helper functions that test validity of colorspace-related fields use the last value of the corresponding enums. This isn't very future-proof, as there's a high chance someone adding a new value may forget to update the helpers. Add new "LAST" entries to the enumerations to improve this, and keep them private to the kernel. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'include/uapi/linux/videodev2.h')
-rw-r--r--include/uapi/linux/videodev2.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 0028ab74ca7c..e32b9e25258d 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -245,6 +245,14 @@ enum v4l2_colorspace {
/* DCI-P3 colorspace, used by cinema projectors */
V4L2_COLORSPACE_DCI_P3 = 12,
+
+#ifdef __KERNEL__
+ /*
+ * Largest supported colorspace value, assigned by the compiler, used
+ * by the framework to check for invalid values.
+ */
+ V4L2_COLORSPACE_LAST,
+#endif
};
/*
@@ -283,6 +291,13 @@ enum v4l2_xfer_func {
V4L2_XFER_FUNC_NONE = 5,
V4L2_XFER_FUNC_DCI_P3 = 6,
V4L2_XFER_FUNC_SMPTE2084 = 7,
+#ifdef __KERNEL__
+ /*
+ * Largest supported transfer function value, assigned by the compiler,
+ * used by the framework to check for invalid values.
+ */
+ V4L2_XFER_FUNC_LAST,
+#endif
};
/*
@@ -343,6 +358,13 @@ enum v4l2_ycbcr_encoding {
/* SMPTE 240M -- Obsolete HDTV */
V4L2_YCBCR_ENC_SMPTE240M = 8,
+#ifdef __KERNEL__
+ /*
+ * Largest supported encoding value, assigned by the compiler, used by
+ * the framework to check for invalid values.
+ */
+ V4L2_YCBCR_ENC_LAST,
+#endif
};
/*