Replace the obsolete field ctrl_class with "which". Make sure it not used in future modules by commenting out the field with ifndef __KERNEL_ . The field cannot be simply removed because that would be change on the kenel API to the userspace (and we don't like that).
Unified · Split
| @@ -61,7 +61,7 @@ must belong to the same control class.</para> · 60 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | <para>Applications must always fill in the |
| 63 | 63 | <structfield>count</structfield>, |
| 64 | −<structfield>ctrl_class</structfield>, | |
| 64 | +<structfield>which</structfield>, | |
| 65 | 65 | <structfield>controls</structfield> and |
| 66 | 66 | <structfield>reserved</structfield> fields of &v4l2-ext-controls;, and |
| 67 | 67 | initialize the &v4l2-ext-control; array pointed to by the |
| @@ -109,7 +109,7 @@ the driver whether wrong values are automatically adjusted to a valid · 41 unmodified lines | ||
| 109 | 109 | value or if an error is returned.</para> |
| 110 | 110 | |
| 111 | 111 | <para>When the <structfield>id</structfield> or |
| 112 | −<structfield>ctrl_class</structfield> is invalid drivers return an | |
| 112 | +<structfield>which</structfield> is invalid drivers return an | |
| 113 | 113 | &EINVAL;. When the value is out of bounds drivers can choose to take |
| 114 | 114 | the closest valid value or return an &ERANGE;, whatever seems more |
| 115 | 115 | appropriate. In the first case the new value is set in |
| @@ -390,7 +390,7 @@ These controls are described in <xref linkend="rf-tuner-controls" />.</entry> · 274 unmodified lines | ||
| 390 | 390 | <listitem> |
| 391 | 391 | <para>The &v4l2-ext-control; <structfield>id</structfield> |
| 392 | 392 | is invalid, the &v4l2-ext-controls; |
| 393 | −<structfield>ctrl_class</structfield> is invalid, or the &v4l2-ext-control; | |
| 393 | +<structfield>which</structfield> is invalid, or the &v4l2-ext-control; | |
| 394 | 394 | <structfield>value</structfield> was inappropriate (e.g. the given menu |
| 395 | 395 | index is not supported by the driver). This error code is |
| 396 | 396 | also returned by the <constant>VIDIOC_S_EXT_CTRLS</constant> and |
| @@ -1119,7 +1119,7 @@ const struct v4l2_ioctl_ops *get_dec_v4l2_ioctl_ops(void) · 1118 unmodified lines | ||
| 1119 | 1119 | return &s5p_mfc_dec_ioctl_ops; |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | −#define IS_MFC51_PRIV(x) ((V4L2_CTRL_ID2CLASS(x) == V4L2_CTRL_CLASS_MPEG) \ | |
| 1122 | +#define IS_MFC51_PRIV(x) ((V4L2_CTRL_ID2WHICH(x) == V4L2_CTRL_CLASS_MPEG) \ | |
| 1123 | 1123 | && V4L2_CTRL_DRIVER_PRIV(x)) |
| 1124 | 1124 | |
| 1125 | 1125 | int s5p_mfc_dec_ctrls_setup(struct s5p_mfc_ctx *ctx) |
| @@ -2067,7 +2067,7 @@ const struct v4l2_ioctl_ops *get_enc_v4l2_ioctl_ops(void) · 2066 unmodified lines | ||
| 2067 | 2067 | return &s5p_mfc_enc_ioctl_ops; |
| 2068 | 2068 | } |
| 2069 | 2069 | |
| 2070 | −#define IS_MFC51_PRIV(x) ((V4L2_CTRL_ID2CLASS(x) == V4L2_CTRL_CLASS_MPEG) \ | |
| 2070 | +#define IS_MFC51_PRIV(x) ((V4L2_CTRL_ID2WHICH(x) == V4L2_CTRL_CLASS_MPEG) \ | |
| 2071 | 2071 | && V4L2_CTRL_DRIVER_PRIV(x)) |
| 2072 | 2072 | |
| 2073 | 2073 | int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx) |
| @@ -630,7 +630,7 @@ static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input32 __ · 629 unmodified lines | ||
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | struct v4l2_ext_controls32 { |
| 633 | − __u32 ctrl_class; | |
| 633 | + __u32 which; | |
| 634 | 634 | __u32 count; |
| 635 | 635 | __u32 error_idx; |
| 636 | 636 | __u32 reserved[2]; |
| @@ -673,7 +673,7 @@ static int get_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext · 36 unmodified lines | ||
| 673 | 673 | compat_caddr_t p; |
| 674 | 674 | |
| 675 | 675 | if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_ext_controls32)) || |
| 676 | − get_user(kp->ctrl_class, &up->ctrl_class) || | |
| 676 | + get_user(kp->which, &up->which) || | |
| 677 | 677 | get_user(kp->count, &up->count) || |
| 678 | 678 | get_user(kp->error_idx, &up->error_idx) || |
| 679 | 679 | copy_from_user(kp->reserved, up->reserved, |
| @@ -723,7 +723,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext · 43 unmodified lines | ||
| 723 | 723 | compat_caddr_t p; |
| 724 | 724 | |
| 725 | 725 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_ext_controls32)) || |
| 726 | − put_user(kp->ctrl_class, &up->ctrl_class) || | |
| 726 | + put_user(kp->which, &up->which) || | |
| 727 | 727 | put_user(kp->count, &up->count) || |
| 728 | 728 | put_user(kp->error_idx, &up->error_idx) || |
| 729 | 729 | copy_to_user(up->reserved, kp->reserved, sizeof(up->reserved))) |
| @@ -1762,7 +1762,7 @@ static struct v4l2_ctrl_ref *find_private_ref( · 1761 unmodified lines | ||
| 1762 | 1762 | list_for_each_entry(ref, &hdl->ctrl_refs, node) { |
| 1763 | 1763 | /* Search for private user controls that are compatible with |
| 1764 | 1764 | VIDIOC_G/S_CTRL. */ |
| 1765 | − if (V4L2_CTRL_ID2CLASS(ref->ctrl->id) == V4L2_CTRL_CLASS_USER && | |
| 1765 | + if (V4L2_CTRL_ID2WHICH(ref->ctrl->id) == V4L2_CTRL_CLASS_USER && | |
| 1766 | 1766 | V4L2_CTRL_DRIVER_PRIV(ref->ctrl->id)) { |
| 1767 | 1767 | if (!ref->ctrl->is_int) |
| 1768 | 1768 | continue; |
| @@ -1831,7 +1831,7 @@ static int handler_new_ref(struct v4l2_ctrl_handler *hdl, · 62 unmodified lines | ||
| 1831 | 1831 | struct v4l2_ctrl_ref *ref; |
| 1832 | 1832 | struct v4l2_ctrl_ref *new_ref; |
| 1833 | 1833 | u32 id = ctrl->id; |
| 1834 | − u32 class_ctrl = V4L2_CTRL_ID2CLASS(id) | 1; | |
| 1834 | + u32 class_ctrl = V4L2_CTRL_ID2WHICH(id) | 1; | |
| 1835 | 1835 | int bucket = id % hdl->nr_of_buckets; /* which bucket to use */ |
| 1836 | 1836 | |
| 1837 | 1837 | /* |
| @@ -2253,9 +2253,9 @@ EXPORT_SYMBOL(v4l2_ctrl_add_handler); · 415 unmodified lines | ||
| 2253 | 2253 | |
| 2254 | 2254 | bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl) |
| 2255 | 2255 | { |
| 2256 | − if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_TX) | |
| 2256 | + if (V4L2_CTRL_ID2WHICH(ctrl->id) == V4L2_CTRL_CLASS_FM_TX) | |
| 2257 | 2257 | return true; |
| 2258 | − if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_RX) | |
| 2258 | + if (V4L2_CTRL_ID2WHICH(ctrl->id) == V4L2_CTRL_CLASS_FM_RX) | |
| 2259 | 2259 | return true; |
| 2260 | 2260 | switch (ctrl->id) { |
| 2261 | 2261 | case V4L2_CID_AUDIO_MUTE: |
| @@ -2710,7 +2710,7 @@ static int prepare_ext_ctrls(struct v4l2_ctrl_handler *hdl, · 448 unmodified lines | ||
| 2710 | 2710 | |
| 2711 | 2711 | cs->error_idx = i; |
| 2712 | 2712 | |
| 2713 | − if (cs->ctrl_class && V4L2_CTRL_ID2CLASS(id) != cs->ctrl_class) | |
| 2713 | + if (cs->which && V4L2_CTRL_ID2WHICH(id) != cs->which) | |
| 2714 | 2714 | return -EINVAL; |
| 2715 | 2715 | |
| 2716 | 2716 | /* Old-style private controls are not allowed for |
| @@ -2787,11 +2787,11 @@ static int prepare_ext_ctrls(struct v4l2_ctrl_handler *hdl, · 70 unmodified lines | ||
| 2787 | 2787 | /* Handles the corner case where cs->count == 0. It checks whether the |
| 2788 | 2788 | specified control class exists. If that class ID is 0, then it checks |
| 2789 | 2789 | whether there are any controls at all. */ |
| 2790 | −static int class_check(struct v4l2_ctrl_handler *hdl, u32 ctrl_class) | |
| 2790 | +static int class_check(struct v4l2_ctrl_handler *hdl, u32 which) | |
| 2791 | 2791 | { |
| 2792 | − if (ctrl_class == 0) | |
| 2792 | + if (!which) | |
| 2793 | 2793 | return list_empty(&hdl->ctrl_refs) ? -EINVAL : 0; |
| 2794 | − return find_ref_lock(hdl, ctrl_class | 1) ? 0 : -EINVAL; | |
| 2794 | + return find_ref_lock(hdl, which | 1) ? 0 : -EINVAL; | |
| 2795 | 2795 | } |
| 2796 | 2796 | |
| 2797 | 2797 | |
| @@ -2805,13 +2805,13 @@ int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *cs · 7 unmodified lines | ||
| 2805 | 2805 | int i, j; |
| 2806 | 2806 | |
| 2807 | 2807 | cs->error_idx = cs->count; |
| 2808 | − cs->ctrl_class = V4L2_CTRL_ID2CLASS(cs->ctrl_class); | |
| 2808 | + cs->which = V4L2_CTRL_ID2WHICH(cs->which); | |
| 2809 | 2809 | |
| 2810 | 2810 | if (hdl == NULL) |
| 2811 | 2811 | return -EINVAL; |
| 2812 | 2812 | |
| 2813 | 2813 | if (cs->count == 0) |
| 2814 | − return class_check(hdl, cs->ctrl_class); | |
| 2814 | + return class_check(hdl, cs->which); | |
| 2815 | 2815 | |
| 2816 | 2816 | if (cs->count > ARRAY_SIZE(helper)) { |
| 2817 | 2817 | helpers = kmalloc_array(cs->count, sizeof(helper[0]), |
| @@ -3064,13 +3064,13 @@ static int try_set_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl, · 246 unmodified lines | ||
| 3064 | 3064 | int ret; |
| 3065 | 3065 | |
| 3066 | 3066 | cs->error_idx = cs->count; |
| 3067 | − cs->ctrl_class = V4L2_CTRL_ID2CLASS(cs->ctrl_class); | |
| 3067 | + cs->which = V4L2_CTRL_ID2WHICH(cs->which); | |
| 3068 | 3068 | |
| 3069 | 3069 | if (hdl == NULL) |
| 3070 | 3070 | return -EINVAL; |
| 3071 | 3071 | |
| 3072 | 3072 | if (cs->count == 0) |
| 3073 | − return class_check(hdl, cs->ctrl_class); | |
| 3073 | + return class_check(hdl, cs->which); | |
| 3074 | 3074 | |
| 3075 | 3075 | if (cs->count > ARRAY_SIZE(helper)) { |
| 3076 | 3076 | helpers = kmalloc_array(cs->count, sizeof(helper[0]), |
| @@ -565,8 +565,8 @@ static void v4l_print_ext_controls(const void *arg, bool write_only) · 564 unmodified lines | ||
| 565 | 565 | const struct v4l2_ext_controls *p = arg; |
| 566 | 566 | int i; |
| 567 | 567 | |
| 568 | − pr_cont("class=0x%x, count=%d, error_idx=%d", | |
| 569 | − p->ctrl_class, p->count, p->error_idx); | |
| 568 | + pr_cont("which=0x%x, count=%d, error_idx=%d", | |
| 569 | + p->which, p->count, p->error_idx); | |
| 570 | 570 | for (i = 0; i < p->count; i++) { |
| 571 | 571 | if (!p->controls[i].size) |
| 572 | 572 | pr_cont(", id/val=0x%x/0x%x", |
| @@ -902,13 +902,13 @@ static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) · 329 unmodified lines | ||
| 902 | 902 | Only when passed in through VIDIOC_G_CTRL and VIDIOC_S_CTRL |
| 903 | 903 | is it allowed for backwards compatibility. |
| 904 | 904 | */ |
| 905 | − if (!allow_priv && c->ctrl_class == V4L2_CID_PRIVATE_BASE) | |
| 905 | + if (!allow_priv && c->which == V4L2_CID_PRIVATE_BASE) | |
| 906 | 906 | return 0; |
| 907 | − if (c->ctrl_class == 0) | |
| 907 | + if (!c->which) | |
| 908 | 908 | return 1; |
| 909 | 909 | /* Check that all controls are from the same control class. */ |
| 910 | 910 | for (i = 0; i < c->count; i++) { |
| 911 | − if (V4L2_CTRL_ID2CLASS(c->controls[i].id) != c->ctrl_class) { | |
| 911 | + if (V4L2_CTRL_ID2WHICH(c->controls[i].id) != c->which) { | |
| 912 | 912 | c->error_idx = i; |
| 913 | 913 | return 0; |
| 914 | 914 | } |
| @@ -1969,7 +1969,7 @@ static int v4l_g_ctrl(const struct v4l2_ioctl_ops *ops, · 1054 unmodified lines | ||
| 1969 | 1969 | if (ops->vidioc_g_ext_ctrls == NULL) |
| 1970 | 1970 | return -ENOTTY; |
| 1971 | 1971 | |
| 1972 | − ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id); | |
| 1972 | + ctrls.which = V4L2_CTRL_ID2WHICH(p->id); | |
| 1973 | 1973 | ctrls.count = 1; |
| 1974 | 1974 | ctrls.controls = &ctrl; |
| 1975 | 1975 | ctrl.id = p->id; |
| @@ -2003,7 +2003,7 @@ static int v4l_s_ctrl(const struct v4l2_ioctl_ops *ops, · 27 unmodified lines | ||
| 2003 | 2003 | if (ops->vidioc_s_ext_ctrls == NULL) |
| 2004 | 2004 | return -ENOTTY; |
| 2005 | 2005 | |
| 2006 | − ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id); | |
| 2006 | + ctrls.which = V4L2_CTRL_ID2WHICH(p->id); | |
| 2007 | 2007 | ctrls.count = 1; |
| 2008 | 2008 | ctrls.controls = &ctrl; |
| 2009 | 2009 | ctrl.id = p->id; |
| @@ -1477,7 +1477,9 @@ struct v4l2_ext_control { · 1476 unmodified lines | ||
| 1477 | 1477 | |
| 1478 | 1478 | struct v4l2_ext_controls { |
| 1479 | 1479 | union { |
| 1480 | +#ifndef __KERNEL__ | |
| 1480 | 1481 | __u32 ctrl_class; |
| 1482 | +#endif | |
| 1481 | 1483 | __u32 which; |
| 1482 | 1484 | }; |
| 1483 | 1485 | __u32 count; |
| @@ -1487,7 +1489,10 @@ struct v4l2_ext_controls { · 3 unmodified lines | ||
| 1487 | 1489 | }; |
| 1488 | 1490 | |
| 1489 | 1491 | #define V4L2_CTRL_ID_MASK (0x0fffffff) |
| 1492 | +#ifndef __KERNEL__ | |
| 1490 | 1493 | #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) |
| 1494 | +#endif | |
| 1495 | +#define V4L2_CTRL_ID2WHICH(id) ((id) & 0x0fff0000UL) | |
| 1491 | 1496 | #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) |
| 1492 | 1497 | #define V4L2_CTRL_MAX_DIMS (4) |
| 1493 | 1498 | #define V4L2_CTRL_WHICH_CUR_VAL 0 |