diff options
| -rw-r--r-- | drivers/media/video/v4l2-common.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 13ee550d3215..d2915d3530ea 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
| @@ -939,16 +939,25 @@ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qc | |||
| 939 | When no more controls are available 0 is returned. */ | 939 | When no more controls are available 0 is returned. */ |
| 940 | u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id) | 940 | u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id) |
| 941 | { | 941 | { |
| 942 | u32 ctrl_class; | 942 | u32 ctrl_class = V4L2_CTRL_ID2CLASS(id); |
| 943 | const u32 *pctrl; | 943 | const u32 *pctrl; |
| 944 | 944 | ||
| 945 | /* if no query is desired, then just return the control ID */ | ||
| 946 | if ((id & V4L2_CTRL_FLAG_NEXT_CTRL) == 0) | ||
| 947 | return id; | ||
| 948 | if (ctrl_classes == NULL) | 945 | if (ctrl_classes == NULL) |
| 949 | return 0; | 946 | return 0; |
| 947 | |||
| 948 | /* if no query is desired, then check if the ID is part of ctrl_classes */ | ||
| 949 | if ((id & V4L2_CTRL_FLAG_NEXT_CTRL) == 0) { | ||
| 950 | /* find class */ | ||
| 951 | while (*ctrl_classes && V4L2_CTRL_ID2CLASS(**ctrl_classes) != ctrl_class) | ||
| 952 | ctrl_classes++; | ||
| 953 | if (*ctrl_classes == NULL) | ||
| 954 | return 0; | ||
| 955 | pctrl = *ctrl_classes; | ||
| 956 | /* find control ID */ | ||
| 957 | while (*pctrl && *pctrl != id) pctrl++; | ||
| 958 | return *pctrl ? id : 0; | ||
| 959 | } | ||
| 950 | id &= V4L2_CTRL_ID_MASK; | 960 | id &= V4L2_CTRL_ID_MASK; |
| 951 | ctrl_class = V4L2_CTRL_ID2CLASS(id); | ||
| 952 | id++; /* select next control */ | 961 | id++; /* select next control */ |
| 953 | /* find first class that matches (or is greater than) the class of | 962 | /* find first class that matches (or is greater than) the class of |
| 954 | the ID */ | 963 | the ID */ |
