diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-02-13 08:57:48 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:46 -0400 |
commit | 2ba588942c45a03a29a7a097e62bf0beceddb0e8 (patch) | |
tree | 8bb6dbc96fcf2f6b68cd933626b9d7b60fe318f0 | |
parent | 1b6f1d9603a46a73ceed8daf7a3285559727fec3 (diff) |
V4L/DVB (10544): v4l2-common: add comments warning that about the sort order
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>
-rw-r--r-- | drivers/media/video/cx18/cx18-controls.c | 1 | ||||
-rw-r--r-- | drivers/media/video/cx2341x.c | 1 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-video.c | 1 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 1 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-controls.c | 1 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-empress.c | 2 | ||||
-rw-r--r-- | drivers/media/video/v4l2-common.c | 2 | ||||
-rw-r--r-- | include/media/v4l2-common.h | 5 |
8 files changed, 13 insertions, 1 deletions
diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c index 6af4d5c190e1..10a4e07b7aca 100644 --- a/drivers/media/video/cx18/cx18-controls.c +++ b/drivers/media/video/cx18/cx18-controls.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "cx18-mailbox.h" | 30 | #include "cx18-mailbox.h" |
31 | #include "cx18-controls.h" | 31 | #include "cx18-controls.h" |
32 | 32 | ||
33 | /* Must be sorted from low to high control ID! */ | ||
33 | static const u32 user_ctrls[] = { | 34 | static const u32 user_ctrls[] = { |
34 | V4L2_CID_USER_CLASS, | 35 | V4L2_CID_USER_CLASS, |
35 | V4L2_CID_BRIGHTNESS, | 36 | V4L2_CID_BRIGHTNESS, |
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c index 4d09078c13b9..b36f522d2c55 100644 --- a/drivers/media/video/cx2341x.c +++ b/drivers/media/video/cx2341x.c | |||
@@ -38,6 +38,7 @@ static int debug; | |||
38 | module_param(debug, int, 0644); | 38 | module_param(debug, int, 0644); |
39 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); | 39 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); |
40 | 40 | ||
41 | /* Must be sorted from low to high control ID! */ | ||
41 | const u32 cx2341x_mpeg_ctrls[] = { | 42 | const u32 cx2341x_mpeg_ctrls[] = { |
42 | V4L2_CID_MPEG_CLASS, | 43 | V4L2_CID_MPEG_CLASS, |
43 | V4L2_CID_MPEG_STREAM_TYPE, | 44 | V4L2_CID_MPEG_STREAM_TYPE, |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index eaa11893bfe9..c2ed2505b725 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -244,6 +244,7 @@ static struct cx23885_ctrl cx23885_ctls[] = { | |||
244 | }; | 244 | }; |
245 | static const int CX23885_CTLS = ARRAY_SIZE(cx23885_ctls); | 245 | static const int CX23885_CTLS = ARRAY_SIZE(cx23885_ctls); |
246 | 246 | ||
247 | /* Must be sorted from low to high control ID! */ | ||
247 | static const u32 cx23885_user_ctrls[] = { | 248 | static const u32 cx23885_user_ctrls[] = { |
248 | V4L2_CID_USER_CLASS, | 249 | V4L2_CID_USER_CLASS, |
249 | V4L2_CID_BRIGHTNESS, | 250 | V4L2_CID_BRIGHTNESS, |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 791e69d804f9..5ed1c5a52cdd 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -298,6 +298,7 @@ static struct cx88_ctrl cx8800_ctls[] = { | |||
298 | }; | 298 | }; |
299 | static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls); | 299 | static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls); |
300 | 300 | ||
301 | /* Must be sorted from low to high control ID! */ | ||
301 | const u32 cx88_user_ctrls[] = { | 302 | const u32 cx88_user_ctrls[] = { |
302 | V4L2_CID_USER_CLASS, | 303 | V4L2_CID_USER_CLASS, |
303 | V4L2_CID_BRIGHTNESS, | 304 | V4L2_CID_BRIGHTNESS, |
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c index 62aa06f5d168..84995bcf4a75 100644 --- a/drivers/media/video/ivtv/ivtv-controls.c +++ b/drivers/media/video/ivtv/ivtv-controls.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "ivtv-mailbox.h" | 26 | #include "ivtv-mailbox.h" |
27 | #include "ivtv-controls.h" | 27 | #include "ivtv-controls.h" |
28 | 28 | ||
29 | /* Must be sorted from low to high control ID! */ | ||
29 | static const u32 user_ctrls[] = { | 30 | static const u32 user_ctrls[] = { |
30 | V4L2_CID_USER_CLASS, | 31 | V4L2_CID_USER_CLASS, |
31 | V4L2_CID_BRIGHTNESS, | 32 | V4L2_CID_BRIGHTNESS, |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index d9d9607044a7..2e15bb7c3f0a 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -352,6 +352,7 @@ static int empress_s_ctrl(struct file *file, void *priv, | |||
352 | static int empress_queryctrl(struct file *file, void *priv, | 352 | static int empress_queryctrl(struct file *file, void *priv, |
353 | struct v4l2_queryctrl *c) | 353 | struct v4l2_queryctrl *c) |
354 | { | 354 | { |
355 | /* Must be sorted from low to high control ID! */ | ||
355 | static const u32 user_ctrls[] = { | 356 | static const u32 user_ctrls[] = { |
356 | V4L2_CID_USER_CLASS, | 357 | V4L2_CID_USER_CLASS, |
357 | V4L2_CID_BRIGHTNESS, | 358 | V4L2_CID_BRIGHTNESS, |
@@ -364,6 +365,7 @@ static int empress_queryctrl(struct file *file, void *priv, | |||
364 | 0 | 365 | 0 |
365 | }; | 366 | }; |
366 | 367 | ||
368 | /* Must be sorted from low to high control ID! */ | ||
367 | static const u32 mpeg_ctrls[] = { | 369 | static const u32 mpeg_ctrls[] = { |
368 | V4L2_CID_MPEG_CLASS, | 370 | V4L2_CID_MPEG_CLASS, |
369 | V4L2_CID_MPEG_STREAM_TYPE, | 371 | V4L2_CID_MPEG_STREAM_TYPE, |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 26e162f13f7f..7086f9f3c785 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -749,7 +749,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_menu_valid_items); | |||
749 | /* ctrl_classes points to an array of u32 pointers, the last element is | 749 | /* ctrl_classes points to an array of u32 pointers, the last element is |
750 | a NULL pointer. Each u32 array is a 0-terminated array of control IDs. | 750 | a NULL pointer. Each u32 array is a 0-terminated array of control IDs. |
751 | Each array must be sorted low to high and belong to the same control | 751 | Each array must be sorted low to high and belong to the same control |
752 | class. The array of u32 pointer must also be sorted, from low class IDs | 752 | class. The array of u32 pointers must also be sorted, from low class IDs |
753 | to high class IDs. | 753 | to high class IDs. |
754 | 754 | ||
755 | This function returns the first ID that follows after the given ID. | 755 | This function returns the first ID that follows after the given ID. |
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 1637cc302697..de785da4564c 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -107,6 +107,11 @@ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, | |||
107 | struct v4l2_queryctrl *qctrl, const char **menu_items); | 107 | struct v4l2_queryctrl *qctrl, const char **menu_items); |
108 | #define V4L2_CTRL_MENU_IDS_END (0xffffffff) | 108 | #define V4L2_CTRL_MENU_IDS_END (0xffffffff) |
109 | int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids); | 109 | int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids); |
110 | |||
111 | /* Note: ctrl_classes points to an array of u32 pointers. Each u32 array is a | ||
112 | 0-terminated array of control IDs. Each array must be sorted low to high | ||
113 | and belong to the same control class. The array of u32 pointers must also | ||
114 | be sorted, from low class IDs to high class IDs. */ | ||
110 | u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); | 115 | u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); |
111 | 116 | ||
112 | /* ------------------------------------------------------------------------- */ | 117 | /* ------------------------------------------------------------------------- */ |