Fix common misspellings
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / media / video / cx18 / cx18-ioctl.c
index 08ed75de1912fb219d06eaedcd1ff5ec4e373980..4f041c033c54420dc69caa106c0dcbf778232719 100644 (file)
@@ -148,7 +148,7 @@ u16 cx18_get_service_set(struct v4l2_sliced_vbi_format *fmt)
 static int cx18_g_fmt_vid_cap(struct file *file, void *fh,
                                struct v4l2_format *fmt)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
        struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
 
@@ -173,7 +173,7 @@ static int cx18_g_fmt_vid_cap(struct file *file, void *fh,
 static int cx18_g_fmt_vbi_cap(struct file *file, void *fh,
                                struct v4l2_format *fmt)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
        struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi;
 
        vbifmt->sampling_rate = 27000000;
@@ -192,7 +192,7 @@ static int cx18_g_fmt_vbi_cap(struct file *file, void *fh,
 static int cx18_g_fmt_sliced_vbi_cap(struct file *file, void *fh,
                                        struct v4l2_format *fmt)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
        struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced;
 
        /* sane, V4L2 spec compliant, defaults */
@@ -221,7 +221,7 @@ static int cx18_g_fmt_sliced_vbi_cap(struct file *file, void *fh,
 static int cx18_try_fmt_vid_cap(struct file *file, void *fh,
                                struct v4l2_format *fmt)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
        int w = fmt->fmt.pix.width;
        int h = fmt->fmt.pix.height;
@@ -252,7 +252,7 @@ static int cx18_try_fmt_vbi_cap(struct file *file, void *fh,
 static int cx18_try_fmt_sliced_vbi_cap(struct file *file, void *fh,
                                        struct v4l2_format *fmt)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
        struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced;
 
        vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36;
@@ -271,16 +271,12 @@ static int cx18_try_fmt_sliced_vbi_cap(struct file *file, void *fh,
 static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
                                struct v4l2_format *fmt)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
        struct v4l2_mbus_framefmt mbus_fmt;
        int ret;
        int w, h;
 
-       ret = v4l2_prio_check(&cx->prio, id->prio);
-       if (ret)
-               return ret;
-
        ret = cx18_try_fmt_vid_cap(file, fh, fmt);
        if (ret)
                return ret;
@@ -303,14 +299,10 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
 static int cx18_s_fmt_vbi_cap(struct file *file, void *fh,
                                struct v4l2_format *fmt)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
        int ret;
 
-       ret = v4l2_prio_check(&cx->prio, id->prio);
-       if (ret)
-               return ret;
-
        /*
         * Changing the Encoder's Raw VBI parameters won't have any effect
         * if any analog capture is ongoing
@@ -320,7 +312,7 @@ static int cx18_s_fmt_vbi_cap(struct file *file, void *fh,
 
        /*
         * Set the digitizer registers for raw active VBI.
-        * Note cx18_av_vbi_wipes out alot of the passed in fmt under valid
+        * Note cx18_av_vbi_wipes out a lot of the passed in fmt under valid
         * calling conditions
         */
        ret = v4l2_subdev_call(cx->sd_av, vbi, s_raw_fmt, &fmt->fmt.vbi);
@@ -337,15 +329,11 @@ static int cx18_s_fmt_vbi_cap(struct file *file, void *fh,
 static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh,
                                        struct v4l2_format *fmt)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
        int ret;
        struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced;
 
-       ret = v4l2_prio_check(&cx->prio, id->prio);
-       if (ret)
-               return ret;
-
        cx18_try_fmt_sliced_vbi_cap(file, fh, fmt);
 
        /*
@@ -372,7 +360,7 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh,
 static int cx18_g_chip_ident(struct file *file, void *fh,
                                struct v4l2_dbg_chip_ident *chip)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
        int err = 0;
 
        chip->ident = V4L2_IDENT_NONE;
@@ -442,7 +430,7 @@ static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
 static int cx18_g_register(struct file *file, void *fh,
                                struct v4l2_dbg_register *reg)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        if (v4l2_chip_match_host(&reg->match))
                return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg);
@@ -454,7 +442,7 @@ static int cx18_g_register(struct file *file, void *fh,
 static int cx18_s_register(struct file *file, void *fh,
                                struct v4l2_dbg_register *reg)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        if (v4l2_chip_match_host(&reg->match))
                return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg);
@@ -464,26 +452,10 @@ static int cx18_s_register(struct file *file, void *fh,
 }
 #endif
 
-static int cx18_g_priority(struct file *file, void *fh, enum v4l2_priority *p)
-{
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
-
-       *p = v4l2_prio_max(&cx->prio);
-       return 0;
-}
-
-static int cx18_s_priority(struct file *file, void *fh, enum v4l2_priority prio)
-{
-       struct cx18_open_id *id = fh;
-       struct cx18 *cx = id->cx;
-
-       return v4l2_prio_change(&cx->prio, &id->prio, prio);
-}
-
 static int cx18_querycap(struct file *file, void *fh,
                                struct v4l2_capability *vcap)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
        strlcpy(vcap->card, cx->card_name, sizeof(vcap->card));
@@ -496,14 +468,14 @@ static int cx18_querycap(struct file *file, void *fh,
 
 static int cx18_enumaudio(struct file *file, void *fh, struct v4l2_audio *vin)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        return cx18_get_audio_input(cx, vin->index, vin);
 }
 
 static int cx18_g_audio(struct file *file, void *fh, struct v4l2_audio *vin)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        vin->index = cx->audio_input;
        return cx18_get_audio_input(cx, vin->index, vin);
@@ -511,7 +483,7 @@ static int cx18_g_audio(struct file *file, void *fh, struct v4l2_audio *vin)
 
 static int cx18_s_audio(struct file *file, void *fh, struct v4l2_audio *vout)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        if (vout->index >= cx->nof_audio_inputs)
                return -EINVAL;
@@ -522,7 +494,7 @@ static int cx18_s_audio(struct file *file, void *fh, struct v4l2_audio *vout)
 
 static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        /* set it to defaults from our table */
        return cx18_get_input(cx, vin->index, vin);
@@ -531,7 +503,7 @@ static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin)
 static int cx18_cropcap(struct file *file, void *fh,
                        struct v4l2_cropcap *cropcap)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                return -EINVAL;
@@ -546,13 +518,8 @@ static int cx18_cropcap(struct file *file, void *fh,
 
 static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
-       int ret;
-
-       ret = v4l2_prio_check(&cx->prio, id->prio);
-       if (ret)
-               return ret;
 
        if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                return -EINVAL;
@@ -562,7 +529,7 @@ static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop)
 
 static int cx18_g_crop(struct file *file, void *fh, struct v4l2_crop *crop)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                return -EINVAL;
@@ -590,7 +557,7 @@ static int cx18_enum_fmt_vid_cap(struct file *file, void *fh,
 
 static int cx18_g_input(struct file *file, void *fh, unsigned int *i)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        *i = cx->active_input;
        return 0;
@@ -598,13 +565,8 @@ static int cx18_g_input(struct file *file, void *fh, unsigned int *i)
 
 int cx18_s_input(struct file *file, void *fh, unsigned int inp)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
-       int ret;
-
-       ret = v4l2_prio_check(&cx->prio, id->prio);
-       if (ret)
-               return ret;
 
        if (inp >= cx->nof_inputs)
                return -EINVAL;
@@ -633,7 +595,7 @@ int cx18_s_input(struct file *file, void *fh, unsigned int inp)
 static int cx18_g_frequency(struct file *file, void *fh,
                                struct v4l2_frequency *vf)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        if (vf->tuner != 0)
                return -EINVAL;
@@ -644,13 +606,8 @@ static int cx18_g_frequency(struct file *file, void *fh,
 
 int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
-       int ret;
-
-       ret = v4l2_prio_check(&cx->prio, id->prio);
-       if (ret)
-               return ret;
 
        if (vf->tuner != 0)
                return -EINVAL;
@@ -664,7 +621,7 @@ int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
 
 static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        *std = cx->std;
        return 0;
@@ -672,13 +629,8 @@ static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std)
 
 int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
-       int ret;
-
-       ret = v4l2_prio_check(&cx->prio, id->prio);
-       if (ret)
-               return ret;
 
        if ((*std & V4L2_STD_ALL) == 0)
                return -EINVAL;
@@ -713,13 +665,8 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std)
 
 static int cx18_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
-       int ret;
-
-       ret = v4l2_prio_check(&cx->prio, id->prio);
-       if (ret)
-               return ret;
 
        if (vt->index != 0)
                return -EINVAL;
@@ -730,7 +677,7 @@ static int cx18_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
 
 static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        if (vt->index != 0)
                return -EINVAL;
@@ -751,7 +698,7 @@ static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
 static int cx18_g_sliced_vbi_cap(struct file *file, void *fh,
                                        struct v4l2_sliced_vbi_cap *cap)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
        int set = cx->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525;
        int f, l;
 
@@ -872,7 +819,7 @@ static int cx18_process_idx_data(struct cx18_stream *s, struct cx18_mdl *mdl,
 static int cx18_g_enc_index(struct file *file, void *fh,
                                struct v4l2_enc_idx *idx)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
        struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX];
        s32 tmp;
        struct cx18_mdl *mdl;
@@ -919,7 +866,7 @@ static int cx18_g_enc_index(struct file *file, void *fh,
 static int cx18_encoder_cmd(struct file *file, void *fh,
                                struct v4l2_encoder_cmd *enc)
 {
-       struct cx18_open_id *id = fh;
+       struct cx18_open_id *id = fh2id(fh);
        struct cx18 *cx = id->cx;
        u32 h;
 
@@ -980,7 +927,7 @@ static int cx18_encoder_cmd(struct file *file, void *fh,
 static int cx18_try_encoder_cmd(struct file *file, void *fh,
                                struct v4l2_encoder_cmd *enc)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        switch (enc->cmd) {
        case V4L2_ENC_CMD_START:
@@ -1012,7 +959,7 @@ static int cx18_try_encoder_cmd(struct file *file, void *fh,
 
 static int cx18_log_status(struct file *file, void *fh)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
        struct v4l2_input vidin;
        struct v4l2_audio audin;
        int i;
@@ -1060,7 +1007,7 @@ static int cx18_log_status(struct file *file, void *fh)
 static long cx18_default(struct file *file, void *fh, bool valid_prio,
                                                        int cmd, void *arg)
 {
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
+       struct cx18 *cx = fh2id(fh)->cx;
 
        switch (cmd) {
        case VIDIOC_INT_RESET: {
@@ -1082,14 +1029,12 @@ long cx18_v4l2_ioctl(struct file *filp, unsigned int cmd,
                    unsigned long arg)
 {
        struct video_device *vfd = video_devdata(filp);
-       struct cx18_open_id *id = filp->private_data;
+       struct cx18_open_id *id = file2id(filp);
        struct cx18 *cx = id->cx;
        long res;
 
        mutex_lock(&cx->serialize_lock);
 
-       /* FIXME - consolidate v4l2_prio_check()'s here */
-
        if (cx18_debug & CX18_DBGFLG_IOCTL)
                vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
        res = video_ioctl2(filp, cmd, arg);
@@ -1100,8 +1045,6 @@ long cx18_v4l2_ioctl(struct file *filp, unsigned int cmd,
 
 static const struct v4l2_ioctl_ops cx18_ioctl_ops = {
        .vidioc_querycap                = cx18_querycap,
-       .vidioc_g_priority              = cx18_g_priority,
-       .vidioc_s_priority              = cx18_s_priority,
        .vidioc_s_audio                 = cx18_s_audio,
        .vidioc_g_audio                 = cx18_g_audio,
        .vidioc_enumaudio               = cx18_enumaudio,