These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / media / v4l2-core / v4l2-ctrls.c
index e3a3468..4a1d9fd 100644 (file)
@@ -888,6 +888,7 @@ const char *v4l2_ctrl_get_name(u32 id)
        case V4L2_CID_TUNE_DEEMPHASIS:          return "De-Emphasis";
        case V4L2_CID_RDS_RECEPTION:            return "RDS Reception";
        case V4L2_CID_RF_TUNER_CLASS:           return "RF Tuner Controls";
+       case V4L2_CID_RF_TUNER_RF_GAIN:         return "RF Gain";
        case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO:   return "LNA Gain, Auto";
        case V4L2_CID_RF_TUNER_LNA_GAIN:        return "LNA Gain";
        case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO: return "Mixer Gain, Auto";
@@ -1161,6 +1162,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
        case V4L2_CID_PILOT_TONE_FREQUENCY:
        case V4L2_CID_TUNE_POWER_LEVEL:
        case V4L2_CID_TUNE_ANTENNA_CAPACITOR:
+       case V4L2_CID_RF_TUNER_RF_GAIN:
        case V4L2_CID_RF_TUNER_LNA_GAIN:
        case V4L2_CID_RF_TUNER_MIXER_GAIN:
        case V4L2_CID_RF_TUNER_IF_GAIN:
@@ -1678,21 +1680,6 @@ static int validate_new(const struct v4l2_ctrl *ctrl, union v4l2_ctrl_ptr p_new)
        unsigned idx;
        int err = 0;
 
-       if (!ctrl->is_ptr) {
-               switch (ctrl->type) {
-               case V4L2_CTRL_TYPE_INTEGER:
-               case V4L2_CTRL_TYPE_INTEGER_MENU:
-               case V4L2_CTRL_TYPE_MENU:
-               case V4L2_CTRL_TYPE_BITMASK:
-               case V4L2_CTRL_TYPE_BOOLEAN:
-               case V4L2_CTRL_TYPE_BUTTON:
-               case V4L2_CTRL_TYPE_CTRL_CLASS:
-               case V4L2_CTRL_TYPE_INTEGER64:
-                       return ctrl->type_ops->validate(ctrl, 0, p_new);
-               default:
-                       break;
-               }
-       }
        for (idx = 0; !err && idx < ctrl->elems; idx++)
                err = ctrl->type_ops->validate(ctrl, idx, p_new);
        return err;
@@ -2513,7 +2500,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr
                        /* We found a control with the given ID, so just get
                           the next valid one in the list. */
                        list_for_each_entry_continue(ref, &hdl->ctrl_refs, node) {
-                               is_compound =
+                               is_compound = ref->ctrl->is_array ||
                                        ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES;
                                if (id < ref->ctrl->id &&
                                    (is_compound & mask) == match)
@@ -2527,7 +2514,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr
                           is one, otherwise the first 'if' above would have
                           been true. */
                        list_for_each_entry(ref, &hdl->ctrl_refs, node) {
-                               is_compound =
+                               is_compound = ref->ctrl->is_array ||
                                        ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES;
                                if (id < ref->ctrl->id &&
                                    (is_compound & mask) == match)
@@ -2899,7 +2886,7 @@ static int get_ctrl(struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c)
         * cur_to_user() calls below would need to be modified not to access
         * userspace memory when called from get_ctrl().
         */
-       if (!ctrl->is_int)
+       if (!ctrl->is_int && ctrl->type != V4L2_CTRL_TYPE_INTEGER64)
                return -EINVAL;
 
        if (ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)
@@ -2957,9 +2944,9 @@ s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl)
 
        /* It's a driver bug if this happens. */
        WARN_ON(ctrl->is_ptr || ctrl->type != V4L2_CTRL_TYPE_INTEGER64);
-       c.value = 0;
+       c.value64 = 0;
        get_ctrl(ctrl, &c);
-       return c.value;
+       return c.value64;
 }
 EXPORT_SYMBOL(v4l2_ctrl_g_ctrl_int64);
 
@@ -3058,7 +3045,7 @@ static void update_from_auto_cluster(struct v4l2_ctrl *master)
 {
        int i;
 
-       for (i = 0; i < master->ncontrols; i++)
+       for (i = 1; i < master->ncontrols; i++)
                cur_to_new(master->cluster[i]);
        if (!call_op(master, g_volatile_ctrl))
                for (i = 1; i < master->ncontrols; i++)