V4L/DVB (10544): v4l2-common: add comments warning that about the sort order
authorHans Verkuil <hverkuil@xs4all.nl>
Fri, 13 Feb 2009 13:57:48 +0000 (10:57 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:46 +0000 (12:42 -0300)
Control arrays as are used with v4l2_ctrl_next must be sorted from
low to high. Add a comment at the top of all such arrays to warn
about this.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx18/cx18-controls.c
drivers/media/video/cx2341x.c
drivers/media/video/cx23885/cx23885-video.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/ivtv/ivtv-controls.c
drivers/media/video/saa7134/saa7134-empress.c
drivers/media/video/v4l2-common.c
include/media/v4l2-common.h

index 6af4d5c190e1cad7ed0439d33b081a1835d6358f..10a4e07b7aca4e6aafb7a1ac824637b7c592f5c1 100644 (file)
@@ -30,6 +30,7 @@
 #include "cx18-mailbox.h"
 #include "cx18-controls.h"
 
+/* Must be sorted from low to high control ID! */
 static const u32 user_ctrls[] = {
        V4L2_CID_USER_CLASS,
        V4L2_CID_BRIGHTNESS,
index 4d09078c13b9d8797bd49591236bb9f8ffb4bd88..b36f522d2c5575a6c62ba11b529dcb61f857ca88 100644 (file)
@@ -38,6 +38,7 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Debug level (0-1)");
 
+/* Must be sorted from low to high control ID! */
 const u32 cx2341x_mpeg_ctrls[] = {
        V4L2_CID_MPEG_CLASS,
        V4L2_CID_MPEG_STREAM_TYPE,
index eaa11893bfe918f23e1ca7403179c7d2ec975680..c2ed2505b72558cc77f43d4c3f2fec4a616ee8ca 100644 (file)
@@ -244,6 +244,7 @@ static struct cx23885_ctrl cx23885_ctls[] = {
 };
 static const int CX23885_CTLS = ARRAY_SIZE(cx23885_ctls);
 
+/* Must be sorted from low to high control ID! */
 static const u32 cx23885_user_ctrls[] = {
        V4L2_CID_USER_CLASS,
        V4L2_CID_BRIGHTNESS,
index 791e69d804f97d89ae37f42520fc34536675072c..5ed1c5a52cddfa2b8e246203b0911d786074a6b8 100644 (file)
@@ -298,6 +298,7 @@ static struct cx88_ctrl cx8800_ctls[] = {
 };
 static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls);
 
+/* Must be sorted from low to high control ID! */
 const u32 cx88_user_ctrls[] = {
        V4L2_CID_USER_CLASS,
        V4L2_CID_BRIGHTNESS,
index 62aa06f5d168529d4b946418005222edfbfa74da..84995bcf4a75a6207ad6beb24191ed23b18809ec 100644 (file)
@@ -26,6 +26,7 @@
 #include "ivtv-mailbox.h"
 #include "ivtv-controls.h"
 
+/* Must be sorted from low to high control ID! */
 static const u32 user_ctrls[] = {
        V4L2_CID_USER_CLASS,
        V4L2_CID_BRIGHTNESS,
index d9d9607044a7c58379a279a52bf352a6882820a8..2e15bb7c3f0a9058d48907866e1e9f0a2b4dd9ca 100644 (file)
@@ -352,6 +352,7 @@ static int empress_s_ctrl(struct file *file, void *priv,
 static int empress_queryctrl(struct file *file, void *priv,
                                        struct v4l2_queryctrl *c)
 {
+       /* Must be sorted from low to high control ID! */
        static const u32 user_ctrls[] = {
                V4L2_CID_USER_CLASS,
                V4L2_CID_BRIGHTNESS,
@@ -364,6 +365,7 @@ static int empress_queryctrl(struct file *file, void *priv,
                0
        };
 
+       /* Must be sorted from low to high control ID! */
        static const u32 mpeg_ctrls[] = {
                V4L2_CID_MPEG_CLASS,
                V4L2_CID_MPEG_STREAM_TYPE,
index 26e162f13f7f58e209d76d5b563062d05deea303..7086f9f3c785a6b8ccf6cd870b96c9f206bbaa33 100644 (file)
@@ -749,7 +749,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_menu_valid_items);
 /* ctrl_classes points to an array of u32 pointers, the last element is
    a NULL pointer. Each u32 array is a 0-terminated array of control IDs.
    Each array must be sorted low to high and belong to the same control
-   class. The array of u32 pointer must also be sorted, from low class IDs
+   class. The array of u32 pointers must also be sorted, from low class IDs
    to high class IDs.
 
    This function returns the first ID that follows after the given ID.
index 1637cc302697cfaa908dc7f38ab2f764f3552f0e..de785da4564c3a5ca824a11211dd916397ad940b 100644 (file)
@@ -107,6 +107,11 @@ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
                struct v4l2_queryctrl *qctrl, const char **menu_items);
 #define V4L2_CTRL_MENU_IDS_END (0xffffffff)
 int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
+
+/* Note: ctrl_classes points to an array of u32 pointers. Each u32 array is a
+   0-terminated array of control IDs. Each array must be sorted low to high
+   and belong to the same control class. The array of u32 pointers must also
+   be sorted, from low class IDs to high class IDs. */
 u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
 
 /* ------------------------------------------------------------------------- */