]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: Set file->private_data in v4l2_fh_add()
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sun, 10 Aug 2025 01:30:08 +0000 (04:30 +0300)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 13 Aug 2025 06:33:39 +0000 (08:33 +0200)
All the drivers that use v4l2_fh and call v4l2_fh_add() manually store a
pointer to the v4l2_fh instance in file->private_data in their video
device .open() file operation handler. Move the code to the
v4l2_fh_add() function to avoid direct access to file->private_data in
drivers. This requires adding a file pointer argument to the function.

Changes to drivers have been generated with the following coccinelle
semantic patch:

@@
expression fh;
identifier filp;
identifier open;
type ret;
@@
ret open(..., struct file *filp, ...)
{
<...
- filp->private_data = fh;
...
- v4l2_fh_add(fh);
+ v4l2_fh_add(fh, filp);
...>
}

@@
expression fh;
identifier filp;
identifier open;
type ret;
@@
ret open(..., struct file *filp, ...)
{
<...
- v4l2_fh_add(fh);
+ v4l2_fh_add(fh, filp);
...
- filp->private_data = fh;
...>
}

Manual changes have been applied to Documentation/ to update the usage
patterns, to drivers/media/v4l2-core/v4l2-fh.c to update the
v4l2_fh_add() prototype set file->private_data, and to
include/media/v4l2-fh.h to update the v4l2_fh_add() function prototype
and its documentation.

Additionally, white space issues have been fixed manually in
drivers/media/platform/nvidia/tegra-vde/v4l2.c,
drivers/media/platform/rockchip/rkvdec/rkvdec.c,
drivers/media/v4l2-core/v4l2-fh.c and
drivers/staging/most/video/video.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
61 files changed:
Documentation/driver-api/media/v4l2-fh.rst
Documentation/translations/zh_CN/video4linux/v4l2-framework.txt
drivers/media/pci/cx18/cx18-fileops.c
drivers/media/pci/ivtv/ivtv-fileops.c
drivers/media/pci/saa7164/saa7164-encoder.c
drivers/media/pci/saa7164/saa7164-vbi.c
drivers/media/platform/allegro-dvt/allegro-core.c
drivers/media/platform/amlogic/meson-ge2d/ge2d.c
drivers/media/platform/amphion/vpu_v4l2.c
drivers/media/platform/chips-media/coda/coda-common.c
drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
drivers/media/platform/imagination/e5010-jpeg-enc.c
drivers/media/platform/m2m-deinterlace.c
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c
drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c
drivers/media/platform/nvidia/tegra-vde/v4l2.c
drivers/media/platform/nxp/dw100/dw100.c
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
drivers/media/platform/nxp/imx-pxp.c
drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
drivers/media/platform/nxp/mx2_emmaprp.c
drivers/media/platform/qcom/iris/iris_vidc.c
drivers/media/platform/qcom/venus/vdec.c
drivers/media/platform/qcom/venus/venc.c
drivers/media/platform/renesas/rcar_fdp1.c
drivers/media/platform/renesas/rcar_jpu.c
drivers/media/platform/renesas/vsp1/vsp1_video.c
drivers/media/platform/rockchip/rga/rga.c
drivers/media/platform/rockchip/rkvdec/rkvdec.c
drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c
drivers/media/platform/samsung/exynos4-is/fimc-m2m.c
drivers/media/platform/samsung/s5p-g2d/g2d.c
drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c
drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c
drivers/media/platform/st/sti/delta/delta-v4l2.c
drivers/media/platform/st/sti/hva/hva-v4l2.c
drivers/media/platform/st/stm32/dma2d/dma2d.c
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c
drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c
drivers/media/platform/ti/omap3isp/ispvideo.c
drivers/media/platform/ti/vpe/vpe.c
drivers/media/platform/verisilicon/hantro_drv.c
drivers/media/test-drivers/vicodec/vicodec-core.c
drivers/media/test-drivers/vim2m.c
drivers/media/test-drivers/visl/visl-core.c
drivers/media/usb/hdpvr/hdpvr-video.c
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
drivers/media/usb/uvc/uvc_v4l2.c
drivers/media/v4l2-core/v4l2-fh.c
drivers/media/v4l2-core/v4l2-subdev.c
drivers/staging/media/imx/imx-media-csc-scaler.c
drivers/staging/media/meson/vdec/vdec.c
drivers/staging/media/sunxi/cedrus/cedrus.c
drivers/staging/most/video/video.c
drivers/usb/gadget/function/uvc_v4l2.c
include/media/v4l2-fh.h

index 2c87b74578d97a171ad06d3eb60a02cd58b557b1..a7393067f5db2183aa677e15ece512296455e23b 100644 (file)
@@ -11,25 +11,22 @@ data that is used by the V4L2 framework.
        since it is also used to implement priority handling
        (:ref:`VIDIOC_G_PRIORITY`).
 
-The users of :c:type:`v4l2_fh` (in the V4L2 framework, not the driver) know
-whether a driver uses :c:type:`v4l2_fh` as its ``file->private_data`` pointer
-by testing the ``V4L2_FL_USES_V4L2_FH`` bit in :c:type:`video_device`->flags.
-This bit is set whenever :c:func:`v4l2_fh_init` is called.
-
-struct v4l2_fh is allocated as a part of the driver's own file handle
-structure and ``file->private_data`` is set to it in the driver's ``open()``
-function by the driver. The :c:type:`v4l2_fh` file handle can be retrieved
-from the :c:type:`file` using :c:func:`file_to_v4l2_fh`. Drivers must not
-access ``file->private_data`` directly.
-
-In many cases the struct v4l2_fh will be embedded in a larger
-structure. In that case you should call:
-
-#) :c:func:`v4l2_fh_init` and :c:func:`v4l2_fh_add` in ``open()``
-#) :c:func:`v4l2_fh_del` and :c:func:`v4l2_fh_exit` in ``release()``
-
-Drivers can extract their own file handle structure by using the container_of
-macro.
+struct v4l2_fh is allocated in the driver's ``open()`` file operation handler.
+It is typically embedded in a larger driver-specific structure. The
+:c:type:`v4l2_fh` must be initialized with a call to :c:func:`v4l2_fh_init`,
+and added to the video device with :c:func:`v4l2_fh_add`. This associates the
+:c:type:`v4l2_fh` with the :c:type:`file` by setting ``file->private_data`` to
+point to the :c:type:`v4l2_fh`.
+
+Similarly, the struct v4l2_fh is freed in the driver's ``release()`` file
+operation handler. It must be removed from the video device with
+:c:func:`v4l2_fh_del` and cleaned up with :c:func:`v4l2_fh_exit` before being
+freed.
+
+Drivers must not access ``file->private_data`` directly. They can retrieve the
+:c:type:`v4l2_fh` associated with a :c:type:`file` by calling
+:c:func:`file_to_v4l2_fh`. Drivers can extract their own file handle structure
+by using the container_of macro.
 
 Example:
 
@@ -58,8 +55,7 @@ Example:
 
                ...
 
-               file->private_data = &my_fh->fh;
-               v4l2_fh_add(&my_fh->fh);
+               v4l2_fh_add(&my_fh->fh, file);
                return 0;
        }
 
@@ -84,7 +80,7 @@ Below is a short description of the :c:type:`v4l2_fh` functions used:
   :c:type:`v4l2_file_operations`->open() handler.
 
 :c:func:`v4l2_fh_add <v4l2_fh_add>`
-(:c:type:`fh <v4l2_fh>`)
+(:c:type:`fh <v4l2_fh>`, struct file \*filp)
 
 - Add a :c:type:`v4l2_fh` to :c:type:`video_device` file handle list.
   Must be called once the file handle is completely initialized.
@@ -138,6 +134,12 @@ associated device node:
 
 - Same, but it calls v4l2_fh_is_singular with filp->private_data.
 
+.. note::
+        The V4L2 framework knows whether a driver uses :c:type:`v4l2_fh` as its
+        ``file->private_data`` pointer by testing the ``V4L2_FL_USES_V4L2_FH``
+        bit in :c:type:`video_device`->flags. This bit is set whenever
+        :c:func:`v4l2_fh_init` is called.
+
 
 V4L2 fh functions and data structures
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index a9eb62fa1531c69110ff17945fa2fcfa596f4df8..2d38ae17d9404d9d40c63bc8329f3cc6999b7a11 100644 (file)
@@ -812,8 +812,7 @@ int my_open(struct file *file)
 
        ...
 
-       file->private_data = &my_fh->fh;
-       v4l2_fh_add(&my_fh->fh);
+       v4l2_fh_add(&my_fh->fh, file);
        return 0;
 }
 
@@ -836,7 +835,7 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
   初始化文件句柄。这*必须*在驱动的 v4l2_file_operations->open()
   函数中执行。
 
-void v4l2_fh_add(struct v4l2_fh *fh)
+void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp)
 
   添加一个 v4l2_fh 到 video_device 文件句柄列表。一旦文件句柄
   初始化完成就必须调用。
index 89e38b3036309af0747362bafad5024413c2c5bd..f90b547f5d676308ed5c7956a8da02e208b9446e 100644 (file)
@@ -743,8 +743,7 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
        item->type = s->type;
 
        item->open_id = cx->open_id++;
-       filp->private_data = &item->fh;
-       v4l2_fh_add(&item->fh);
+       v4l2_fh_add(&item->fh, filp);
 
        if (item->type == CX18_ENC_STREAM_TYPE_RAD &&
                        v4l2_fh_is_singular_file(filp)) {
index 67964a3c382c6627a7b3ce6380a2da97dcc47c3d..aa5f5f16427c48123cd314932a7d8bc48f07c031 100644 (file)
@@ -998,9 +998,7 @@ static int ivtv_open(struct file *filp)
        v4l2_fh_init(&item->fh, &s->vdev);
        item->itv = itv;
        item->type = s->type;
-
-       filp->private_data = &item->fh;
-       v4l2_fh_add(&item->fh);
+       v4l2_fh_add(&item->fh, filp);
 
        if (item->type == IVTV_ENC_STREAM_TYPE_RAD &&
                        v4l2_fh_is_singular_file(filp)) {
index 296f50b6b8d38e0ab617f0990d8f697ba96b0016..e6e353a251cf548525c44e87695f7d45bde302a6 100644 (file)
@@ -725,8 +725,7 @@ static int fops_open(struct file *file)
 
        fh->port = port;
        v4l2_fh_init(&fh->fh, video_devdata(file));
-       v4l2_fh_add(&fh->fh);
-       file->private_data = &fh->fh;
+       v4l2_fh_add(&fh->fh, file);
 
        return 0;
 }
index a7e398f304725c7fa5aa4cf1edf0deb0df059641..181442fcb43b08cd96f29c2357bcfadd3ddcedb4 100644 (file)
@@ -428,8 +428,7 @@ static int fops_open(struct file *file)
 
        fh->port = port;
        v4l2_fh_init(&fh->fh, video_devdata(file));
-       v4l2_fh_add(&fh->fh);
-       file->private_data = &fh->fh;
+       v4l2_fh_add(&fh->fh, file);
 
        return 0;
 }
index 74977f3ae4844022c04de877f31b4fc6aaac0749..8c30f3cd4fc545133f697973b0f002ea888a3a4a 100644 (file)
@@ -3219,8 +3219,7 @@ static int allegro_open(struct file *file)
        }
 
        list_add(&channel->list, &dev->channels);
-       file->private_data = &channel->fh;
-       v4l2_fh_add(&channel->fh);
+       v4l2_fh_add(&channel->fh, file);
 
        allegro_channel_adjust(channel);
 
index c7df29a2d82012b7fc290edf3f629a0c3ed7bcc8..d36891b546bca417e8b98c5e0458ebb15e24c213 100644 (file)
@@ -860,8 +860,7 @@ static int ge2d_open(struct file *file)
                return ret;
        }
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        ge2d_setup_ctrls(ctx);
 
index 57ca6262bb04b356a85e217ef51cfb13cb9a0a36..e13bfe09af1bf0926bf6005b83a8aae7e34a2122 100644 (file)
@@ -760,7 +760,7 @@ int vpu_v4l2_open(struct file *file, struct vpu_inst *inst)
        inst->min_buffer_cap = 2;
        inst->min_buffer_out = 2;
        v4l2_fh_init(&inst->fh, func->vfd);
-       v4l2_fh_add(&inst->fh);
+       v4l2_fh_add(&inst->fh, file);
 
        ret = call_vop(inst, ctrl_init);
        if (ret)
@@ -774,7 +774,6 @@ int vpu_v4l2_open(struct file *file, struct vpu_inst *inst)
        }
 
        inst->fh.ctrl_handler = &inst->ctrl_handler;
-       file->private_data = &inst->fh;
        inst->state = VPU_CODEC_STATE_DEINIT;
        inst->workqueue = alloc_ordered_workqueue("vpu_inst", WQ_MEM_RECLAIM);
        if (inst->workqueue) {
index 459b591493907611db976b08cce69060d8d24faa..7d874fd502b86a6b6137ecd279d6866cd715598b 100644 (file)
@@ -2642,8 +2642,7 @@ static int coda_open(struct file *file)
        if (ctx->ops->seq_end_work)
                INIT_WORK(&ctx->seq_end_work, ctx->ops->seq_end_work);
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
        ctx->dev = dev;
        ctx->idx = idx;
 
index f3188d720ed3e183f3400816a9c939014213711d..88eb933a51448788373775e423ae2ac5042cf8b6 100644 (file)
@@ -1761,8 +1761,7 @@ static int wave5_vpu_open_dec(struct file *filp)
                return -ENOMEM;
 
        v4l2_fh_init(&inst->v4l2_fh, vdev);
-       filp->private_data = &inst->v4l2_fh;
-       v4l2_fh_add(&inst->v4l2_fh);
+       v4l2_fh_add(&inst->v4l2_fh, filp);
 
        INIT_LIST_HEAD(&inst->list);
 
index b69a1206fa12c2ff5f3a32d269b8fd3b80a597aa..322c1498758a0a569eb94cab0d6612ce18cd4c7b 100644 (file)
@@ -1587,8 +1587,7 @@ static int wave5_vpu_open_enc(struct file *filp)
                return -ENOMEM;
 
        v4l2_fh_init(&inst->v4l2_fh, vdev);
-       filp->private_data = &inst->v4l2_fh;
-       v4l2_fh_add(&inst->v4l2_fh);
+       v4l2_fh_add(&inst->v4l2_fh, filp);
 
        INIT_LIST_HEAD(&inst->list);
 
index 295461325862fb2bcac755cf815955955b37e6f0..1da00ff4b1e36a6486ce54e02139f6489d6acf22 100644 (file)
@@ -742,8 +742,7 @@ static int e5010_open(struct file *file)
        }
 
        v4l2_fh_init(&ctx->fh, vdev);
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        ctx->e5010 = e5010;
        ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(e5010->m2m_dev, ctx, queue_init);
index 1812c07837ad33e10db9005fd2009b4ea2a799d0..a343dffd19f03c68557415afae2a8db4b3614d2e 100644 (file)
@@ -847,7 +847,6 @@ static int deinterlace_open(struct file *file)
                return -ENOMEM;
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dev = pcdev;
 
        ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(pcdev->m2m_dev, ctx, &queue_init);
@@ -866,7 +865,7 @@ static int deinterlace_open(struct file *file)
        }
 
        ctx->colorspace = V4L2_COLORSPACE_REC709;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        dprintk(pcdev, "Created instance %p, m2m_ctx: %p\n",
                ctx, ctx->fh.m2m_ctx);
index 3a7a6eb53d8918d1f997f0ca3fa367c7ae433669..5178a1b170fe3215b6aaf540d6107886fde86a64 100644 (file)
@@ -1176,8 +1176,7 @@ static int mtk_jpeg_open(struct file *file)
        INIT_LIST_HEAD(&ctx->dst_done_queue);
        spin_lock_init(&ctx->done_queue_lock);
        v4l2_fh_init(&ctx->fh, vfd);
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        ctx->jpeg = jpeg;
        ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(jpeg->m2m_dev, ctx,
index 2d894b5bfaa7ab377cf8a1427132afb297083d29..7a1a8e51dbca35525887272c30efeb78ea4f31b3 100644 (file)
@@ -1070,14 +1070,13 @@ static int mtk_mdp_m2m_open(struct file *file)
        mutex_init(&ctx->slock);
        ctx->id = mdp->id_counter++;
        v4l2_fh_init(&ctx->fh, vfd);
-       file->private_data = &ctx->fh;
        ret = mtk_mdp_ctrls_create(ctx);
        if (ret)
                goto error_ctrls;
 
        /* Use separate control handler per file handle */
        ctx->fh.ctrl_handler = &ctx->ctrl_handler;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
        INIT_LIST_HEAD(&ctx->list);
 
        ctx->mdp_dev = mdp;
index 886ff25c70eb9a9738f167ffcc5bd0f79a6861ae..847d6b310e74e2dada48f0b8ec94b9c76445c052 100644 (file)
@@ -590,14 +590,13 @@ static int mdp_m2m_open(struct file *file)
        ctx->mdp_dev = mdp;
 
        v4l2_fh_init(&ctx->fh, vdev);
-       file->private_data = &ctx->fh;
        ret = mdp_m2m_ctrls_create(ctx);
        if (ret)
                goto err_exit_fh;
 
        /* Use separate control handler per file handle */
        ctx->fh.ctrl_handler = &ctx->ctrl_handler;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        mutex_init(&ctx->ctx_lock);
        ctx->m2m_ctx = v4l2_m2m_ctx_init(mdp->m2m_dev, ctx, mdp_m2m_queue_init);
index 18801883c31a80b2179eb0d9280150eeb4aa3770..952a77c383bdb8dba94c74916674e729ee5aba35 100644 (file)
@@ -206,8 +206,7 @@ static int fops_vcodec_open(struct file *file)
        mutex_lock(&dev->dev_mutex);
        ctx->id = dev->id_counter++;
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
        INIT_LIST_HEAD(&ctx->list);
        ctx->dev = dev;
        if (ctx->dev->vdec_pdata->is_subdev_supported) {
index e26a6c3ffa0cee17385575215b55b575b14e58f4..9cacb6cbcf28357826db2df7e15c3588e7b4d4c8 100644 (file)
@@ -129,8 +129,7 @@ static int fops_vcodec_open(struct file *file)
         */
        ctx->id = dev->id_counter++;
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
        INIT_LIST_HEAD(&ctx->list);
        ctx->dev = dev;
        init_waitqueue_head(&ctx->queue[0]);
index 393dc3f07d5c78ff5ab0ae7b6368914859564458..688b776b30107df4ec3642a4bc0e896759ccf0fe 100644 (file)
@@ -832,8 +832,7 @@ static int tegra_open(struct file *file)
                goto free_ctrls;
        }
 
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        tegra_reset_coded_fmt(ctx);
        tegra_try_coded_fmt(file, &ctx->fh, &ctx->coded_fmt);
index 2460f09a6813a320f7637bc332e641b7741ced21..2bd30910ddf98401dfc9d8f2e3b19fe8672320e3 100644 (file)
@@ -607,7 +607,6 @@ static int dw100_open(struct file *file)
 
        mutex_init(&ctx->vq_mutex);
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dw_dev = dw_dev;
 
        ctx->q_data[DW100_QUEUE_SRC].fmt = &formats[0];
@@ -651,7 +650,7 @@ static int dw100_open(struct file *file)
                goto err;
        }
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        return 0;
 
index 8eef7ebd0428a88c3ccfcca861d56a6a50557ebf..d7cecc56a9eb56e521748b412bb5fc15b505d30a 100644 (file)
@@ -2205,8 +2205,7 @@ static int mxc_jpeg_open(struct file *file)
        }
 
        v4l2_fh_init(&ctx->fh, mxc_vfd);
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        ctx->mxc_jpeg = mxc_jpeg;
 
index 879b1803a2b38c6748fa4748f25504665f8106bb..9602409f3ecef7e2a77a58f9c3376823a72ec551 100644 (file)
@@ -1660,7 +1660,6 @@ static int pxp_open(struct file *file)
        }
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dev = dev;
        hdl = &ctx->hdl;
        v4l2_ctrl_handler_init(hdl, 4);
@@ -1699,7 +1698,7 @@ static int pxp_open(struct file *file)
                goto open_unlock;
        }
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
        atomic_inc(&dev->num_inst);
 
        dprintk(dev, "Created instance: %p, m2m_ctx: %p\n",
index 6444392c5e629a1ce5da1b3383fb8a8c96992d5b..d6df6e2725f58ed4875d0d87bca5193cf59915fa 100644 (file)
@@ -673,7 +673,6 @@ static int mxc_isi_m2m_open(struct file *file)
        mutex_init(&ctx->vb2_lock);
 
        v4l2_fh_init(&ctx->fh, vdev);
-       file->private_data = &ctx->fh;
 
        ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(m2m->m2m_dev, ctx,
                                            &mxc_isi_m2m_queue_init);
@@ -694,7 +693,7 @@ static int mxc_isi_m2m_open(struct file *file)
        if (ret)
                goto err_ctrls;
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        return 0;
 
index 5c8c6285ec1e7b2e8df64132228e71e1b097183e..8c8f834e6250f5effcbb7f098f388a9ccc96302c 100644 (file)
@@ -730,7 +730,6 @@ static int emmaprp_open(struct file *file)
                return -ENOMEM;
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dev = pcdev;
 
        if (mutex_lock_interruptible(&pcdev->dev_mutex)) {
@@ -752,7 +751,7 @@ static int emmaprp_open(struct file *file)
        clk_prepare_enable(pcdev->clk_emma_ahb);
        ctx->q_data[V4L2_M2M_SRC].fmt = &formats[1];
        ctx->q_data[V4L2_M2M_DST].fmt = &formats[0];
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
        mutex_unlock(&pcdev->dev_mutex);
 
        dprintk(pcdev, "Created instance %p, m2m_ctx: %p\n", ctx, ctx->fh.m2m_ctx);
index 64ebec2ca6b3d58118ac1a6f4ddeed2e43de6d5b..cdd34a3b71ff4309829f0f159241c3815658bcb8 100644 (file)
@@ -25,8 +25,7 @@ static void iris_v4l2_fh_init(struct iris_inst *inst, struct file *filp)
 {
        v4l2_fh_init(&inst->fh, inst->core->vdev_dec);
        inst->fh.ctrl_handler = &inst->ctrl_handler;
-       v4l2_fh_add(&inst->fh);
-       filp->private_data = &inst->fh;
+       v4l2_fh_add(&inst->fh, filp);
 }
 
 static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)
index d10ca6d89f6d76c052b27b1154c8dd9c49466e23..55c27345b7d89bf400e216ed9aa59a871e501a44 100644 (file)
@@ -1732,9 +1732,8 @@ static int vdec_open(struct file *file)
        v4l2_fh_init(&inst->fh, core->vdev_dec);
 
        inst->fh.ctrl_handler = &inst->ctrl_handler;
-       v4l2_fh_add(&inst->fh);
+       v4l2_fh_add(&inst->fh, file);
        inst->fh.m2m_ctx = inst->m2m_ctx;
-       file->private_data = &inst->fh;
 
        return 0;
 
index 0838d64ce8fee5dd8299d5c394e97910f10f7ee3..fba07557a3996a55fcd6a4f65376c418ec0c92a7 100644 (file)
@@ -1515,9 +1515,8 @@ static int venc_open(struct file *file)
        v4l2_fh_init(&inst->fh, core->vdev_enc);
 
        inst->fh.ctrl_handler = &inst->ctrl_handler;
-       v4l2_fh_add(&inst->fh);
+       v4l2_fh_add(&inst->fh, file);
        inst->fh.m2m_ctx = inst->m2m_ctx;
-       file->private_data = &inst->fh;
 
        return 0;
 
index 12a5dcc0ca6c7201ae8f4b89f4781ecb5bcb3b6f..f1ea303ac0380d30996bc46015d3f5d43f2516f2 100644 (file)
@@ -2093,7 +2093,6 @@ static int fdp1_open(struct file *file)
        }
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->fdp1 = fdp1;
 
        /* Initialise Queues */
@@ -2142,7 +2141,7 @@ static int fdp1_open(struct file *file)
        if (ret < 0)
                goto error_pm;
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        dprintk(fdp1, "Created instance: %p, m2m_ctx: %p\n",
                ctx, ctx->fh.m2m_ctx);
index 7d5e9df53dfbd2a82f3417c3f441798b0238ff26..d0d4ee3f8bdc8b15c7ad5a23a227f10a5e534cc5 100644 (file)
@@ -1231,8 +1231,7 @@ static int jpu_open(struct file *file)
 
        v4l2_fh_init(&ctx->fh, vfd);
        ctx->fh.ctrl_handler = &ctx->ctrl_handler;
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        ctx->jpu = jpu;
        ctx->encoder = vfd == &jpu->vfd_encoder;
index 656fb5e6cb303cfcde1d91c839a9aceca79c77f7..b6dc1ee3dc50ac8d0eb79408b06c601cb501e9b8 100644 (file)
@@ -1079,9 +1079,7 @@ static int vsp1_video_open(struct file *file)
                return -ENOMEM;
 
        v4l2_fh_init(vfh, &video->video);
-       v4l2_fh_add(vfh);
-
-       file->private_data = vfh;
+       v4l2_fh_add(vfh, file);
 
        ret = vsp1_device_get(video->vsp1);
        if (ret < 0) {
index 8a6e618d605c216b5113062d90df03dc632dc7c8..d88817023996b29afc79cdd6fbdd42dfc5829b13 100644 (file)
@@ -395,8 +395,7 @@ static int rga_open(struct file *file)
                return ret;
        }
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        rga_setup_ctrls(ctx);
 
index 41ab90cbcc0cdbe279f6512decc4301b6cff2dfa..2fbad685e92cee4916420565a28c778b1a5e1a8e 100644 (file)
@@ -938,8 +938,7 @@ static int rkvdec_open(struct file *filp)
        if (ret)
                goto err_cleanup_m2m_ctx;
 
-       filp->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, filp);
 
        return 0;
 
index 968bb4327b7a1697641815dfb08dc64251f5e927..39d84ffd1b05990ba4b8af281aba09e3f9cc5340 100644 (file)
@@ -625,8 +625,7 @@ static int gsc_m2m_open(struct file *file)
 
        /* Use separate control handler per file handle */
        ctx->fh.ctrl_handler = &ctx->ctrl_handler;
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        ctx->gsc_dev = gsc;
        /* Default color format */
index feedf60dad09bd413cb8fe65d965fd39b26b8764..b002b02a899efdd95df4ae8a5db59b9f144a61db 100644 (file)
@@ -634,8 +634,7 @@ static int fimc_m2m_open(struct file *file)
 
        /* Use separate control handler per file handle */
        ctx->fh.ctrl_handler = &ctx->ctrls.handler;
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        /* Setup the device context for memory-to-memory mode */
        ctx->state = FIMC_CTX_M2M;
index 44fcedbbc90a9863827aacbcd5f56d850cb552ea..e34cae9c9cf65d3161822b68233d28472171f917 100644 (file)
@@ -257,8 +257,7 @@ static int g2d_open(struct file *file)
                return ret;
        }
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        g2d_setup_ctrls(ctx);
 
index a5ecfe03db0916de6bef91a9617425d9be2d5f01..9e35dd939ad7a338b1f0971893b423ddcc4a1867 100644 (file)
@@ -970,8 +970,7 @@ static int s5p_jpeg_open(struct file *file)
        v4l2_fh_init(&ctx->fh, vfd);
        /* Use separate control handler per file handle */
        ctx->fh.ctrl_handler = &ctx->ctrl_handler;
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        ctx->jpeg = jpeg;
        if (vfd == jpeg->vfd_encoder) {
index dd9761df59df5dd7b07b4e9afd2d7939c46cb2de..74629db05121ac9181af9daa471c113876f9d323 100644 (file)
@@ -801,8 +801,7 @@ static int s5p_mfc_open(struct file *file)
        }
        init_waitqueue_head(&ctx->queue);
        v4l2_fh_init(&ctx->fh, vdev);
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
        ctx->dev = dev;
        INIT_LIST_HEAD(&ctx->src_queue);
        INIT_LIST_HEAD(&ctx->dst_queue);
index f3844e4e47caacdbfcde5f0563e9f41dcdd98b04..5e983799e298f1355af5a4acd94c970cec203cdb 100644 (file)
@@ -608,8 +608,7 @@ static int bdisp_open(struct file *file)
 
        /* Use separate control handler per file handle */
        ctx->fh.ctrl_handler = &ctx->ctrl_handler;
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        /* Default format */
        ctx->src = bdisp_dflt_fmt;
index a12fdbd8abed6460ef676c0dbfcee7f28deaa86b..3063a98ed25b0942ba4aa28bbd23fe4b48f76d9a 100644 (file)
@@ -1639,8 +1639,7 @@ static int delta_open(struct file *file)
        ctx->dev = delta;
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        INIT_WORK(&ctx->run_work, delta_run_work);
        mutex_init(&ctx->lock);
index 29142c806cb74a510b2f27e79c9e10ca4088b1e9..2f9413fa7318f42b390f96447dcb1a905836703e 100644 (file)
@@ -1174,8 +1174,7 @@ static int hva_open(struct file *file)
 
        INIT_WORK(&ctx->run_work, hva_run_work);
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        ret = hva_ctrls_setup(ctx);
        if (ret) {
index f4c5d73447a7c3efb0ad5d9bb8a09432c1a8fa60..b2bced06a1e603f7479620d5db3c12ee89e5149e 100644 (file)
@@ -304,8 +304,7 @@ static int dma2d_open(struct file *file)
        }
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        dma2d_setup_ctrls(ctx);
 
index e9c7c99fbc559de85c33736a8f459cd216b8cdbf..7823eb97faf7e9bd13286ab14db2b436fc5caf1f 100644 (file)
@@ -730,7 +730,6 @@ static int deinterlace_open(struct file *file)
        deinterlace_prepare_format(&ctx->dst_fmt);
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dev = dev;
 
        ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx,
@@ -740,7 +739,7 @@ static int deinterlace_open(struct file *file)
                goto err_free;
        }
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        mutex_unlock(&dev->dev_mutex);
 
index 9ea65cb7187fee323051b1cb62b342e119f7bb3d..368a858b8c0fdea462b85c8c71e22058d10a6c05 100644 (file)
@@ -659,7 +659,6 @@ static int rotate_open(struct file *file)
        rotate_set_cap_format(ctx, &ctx->dst_fmt, ctx->rotate);
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dev = dev;
 
        ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx,
@@ -669,7 +668,7 @@ static int rotate_open(struct file *file)
                goto err_free;
        }
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        ret = rotate_setup_ctrls(ctx);
        if (ret)
index b76d40aeca17cf5b8b7619cadf0afe66ff283a9d..d10a2b96c13cf1f5103504a8bd10c65111392a1e 100644 (file)
@@ -1297,7 +1297,7 @@ static int isp_video_open(struct file *file)
                return -ENOMEM;
 
        v4l2_fh_init(&handle->vfh, &video->video);
-       v4l2_fh_add(&handle->vfh);
+       v4l2_fh_add(&handle->vfh, file);
 
        /* If this is the first user, initialise the pipeline. */
        if (omap3isp_get(video->isp) == NULL) {
@@ -1333,7 +1333,6 @@ static int isp_video_open(struct file *file)
        handle->timeperframe.denominator = 1;
 
        handle->video = video;
-       file->private_data = &handle->vfh;
 
 done:
        if (ret < 0) {
index 4b9b2bec7377d724c272ff76fb8116b65227c542..a47c5d31c47550cd9c6c8803b25cda1253f906a9 100644 (file)
@@ -2310,7 +2310,6 @@ static int vpe_open(struct file *file)
        init_adb_hdrs(ctx);
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
 
        hdl = &ctx->hdl;
        v4l2_ctrl_handler_init(hdl, 1);
@@ -2364,7 +2363,7 @@ static int vpe_open(struct file *file)
                goto exit_fh;
        }
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        /*
         * for now, just report the creation of the first instance, we can later
index b20b9c7f41319e1d9586d641200aeeebbd1ee761..aadc3d8fb3d1c1267b370edac6723b99bd00f9bf 100644 (file)
@@ -663,8 +663,7 @@ static int hantro_open(struct file *filp)
        }
 
        v4l2_fh_init(&ctx->fh, vdev);
-       filp->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, filp);
 
        hantro_reset_fmts(ctx);
 
index e27f6761cba18e78e1833745e77347f7405957e0..f20d9d9643f5e3d39f4807ad337f05c957594e1e 100644 (file)
@@ -1848,7 +1848,6 @@ static int vicodec_open(struct file *file)
                ctx->is_stateless = true;
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dev = dev;
        hdl = &ctx->hdl;
        v4l2_ctrl_handler_init(hdl, 5);
@@ -1932,7 +1931,7 @@ static int vicodec_open(struct file *file)
                goto open_unlock;
        }
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
 open_unlock:
        mutex_unlock(vfd->lock);
index 55d885be5bcc0541e4ea539a2fafeeb2d76680e3..24574025f58fc34a0b98e8048294624607e39e2a 100644 (file)
@@ -1389,7 +1389,6 @@ static int vim2m_open(struct file *file)
        }
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dev = dev;
        hdl = &ctx->hdl;
        v4l2_ctrl_handler_init(hdl, 4);
@@ -1433,7 +1432,7 @@ static int vim2m_open(struct file *file)
                goto open_unlock;
        }
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
        atomic_inc(&dev->num_inst);
 
        dprintk(dev, 1, "Created instance: %p, m2m_ctx: %p\n",
index 5bf3136b36eb30be5cf6b7f65ca3ab7314d84f98..0f43ec23f40b40362979646b47b09b75b7786fb2 100644 (file)
@@ -341,7 +341,6 @@ static int visl_open(struct file *file)
        ctx->tpg_str_buf = kzalloc(TPG_STR_BUF_SZ, GFP_KERNEL);
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dev = dev;
 
        rc = visl_init_ctrls(ctx);
@@ -361,7 +360,7 @@ static int visl_open(struct file *file)
        if (rc)
                goto free_m2m_ctx;
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        dprintk(dev, "Created instance: %p, m2m_ctx: %p\n",
                ctx, ctx->fh.m2m_ctx);
index ea17f1a5f5b0a01d7ae159b7f00d65ce952f4974..6c6e467f85549e86598e73d29352a84de7df2f4d 100644 (file)
@@ -380,8 +380,7 @@ static int hdpvr_open(struct file *file)
                return -ENOMEM;
        fh->legacy_mode = true;
        v4l2_fh_init(&fh->fh, video_devdata(file));
-       v4l2_fh_add(&fh->fh);
-       file->private_data = &fh->fh;
+       v4l2_fh_add(&fh->fh, file);
        return 0;
 }
 
index 481b03bbecf8134f75b3988e45fc392f07ae90fd..04c77af0c51ec2174193387253015383d6fac486 100644 (file)
@@ -1003,10 +1003,9 @@ static int pvr2_v4l2_open(struct file *file)
        }
 
        fhp->file = file;
-       file->private_data = &fhp->fh;
 
        fhp->fw_mode_flag = pvr2_hdw_cpufw_get_enabled(hdw);
-       v4l2_fh_add(&fhp->fh);
+       v4l2_fh_add(&fhp->fh, file);
 
        return 0;
 }
index 6dd329a972fda5c2574231b8526105676df3d4a1..09677ed639ae9252a57ce09cdbcfd567ad7aabc2 100644 (file)
@@ -600,10 +600,9 @@ static int uvc_v4l2_open(struct file *file)
                return -ENOMEM;
 
        v4l2_fh_init(&handle->vfh, &stream->vdev);
-       v4l2_fh_add(&handle->vfh);
+       v4l2_fh_add(&handle->vfh, file);
        handle->chain = stream->chain;
        handle->stream = stream;
-       file->private_data = &handle->vfh;
 
        return 0;
 }
index 7a5f7aa5e25341df62bb4e3380bf19f46e2df955..b59b1084d8cdf1b62da12879e21dbe56c2109648 100644 (file)
@@ -41,10 +41,12 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
 }
 EXPORT_SYMBOL_GPL(v4l2_fh_init);
 
-void v4l2_fh_add(struct v4l2_fh *fh)
+void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp)
 {
        unsigned long flags;
 
+       filp->private_data = fh;
+
        v4l2_prio_open(fh->vdev->prio, &fh->prio);
        spin_lock_irqsave(&fh->vdev->fh_lock, flags);
        list_add(&fh->list, &fh->vdev->fh_list);
@@ -57,11 +59,10 @@ int v4l2_fh_open(struct file *filp)
        struct video_device *vdev = video_devdata(filp);
        struct v4l2_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL);
 
-       filp->private_data = fh;
        if (fh == NULL)
                return -ENOMEM;
        v4l2_fh_init(fh, vdev);
-       v4l2_fh_add(fh);
+       v4l2_fh_add(fh, filp);
        return 0;
 }
 EXPORT_SYMBOL_GPL(v4l2_fh_open);
index 29d3b788b288675c9ec849bb14e1936356d95743..bf35ac436249fdbf218ed08a712abf546a49b4eb 100644 (file)
@@ -86,8 +86,7 @@ static int subdev_open(struct file *file)
        }
 
        v4l2_fh_init(&subdev_fh->vfh, vdev);
-       v4l2_fh_add(&subdev_fh->vfh);
-       file->private_data = &subdev_fh->vfh;
+       v4l2_fh_add(&subdev_fh->vfh, file);
 
        if (sd->v4l2_dev->mdev && sd->entity.graph_obj.mdev->dev) {
                struct module *owner;
index fb67b383436dc67b16fd47f6149c93b68cb3f458..7fedb33dda347ab828725fda567e2ac43d1015ec 100644 (file)
@@ -765,8 +765,7 @@ static int ipu_csc_scaler_open(struct file *file)
        ctx->rot_mode = IPU_ROTATE_NONE;
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
        ctx->priv = priv;
 
        ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(priv->m2m_dev, ctx,
index f1ee53f9f29868ae7cb02ce00764631f821ee74b..b92666ff50a15196de0143f2ba5bf476c6f7729d 100644 (file)
@@ -908,9 +908,8 @@ static int vdec_open(struct file *file)
 
        v4l2_fh_init(&sess->fh, core->vdev_dec);
        sess->fh.ctrl_handler = &sess->ctrl_handler;
-       v4l2_fh_add(&sess->fh);
+       v4l2_fh_add(&sess->fh, file);
        sess->fh.m2m_ctx = sess->m2m_ctx;
-       file->private_data = &sess->fh;
 
        return 0;
 
index 80b43187f6eef827c7212a601aa2056dbc606bd4..ebefd646dbdb4e998bf6a8a0f0be6d7e4bf7d28b 100644 (file)
@@ -366,7 +366,6 @@ static int cedrus_open(struct file *file)
        }
 
        v4l2_fh_init(&ctx->fh, video_devdata(file));
-       file->private_data = &ctx->fh;
        ctx->dev = dev;
        ctx->bit_depth = 8;
 
@@ -383,7 +382,7 @@ static int cedrus_open(struct file *file)
        if (ret)
                goto err_m2m_release;
 
-       v4l2_fh_add(&ctx->fh);
+       v4l2_fh_add(&ctx->fh, file);
 
        mutex_unlock(&dev->dev_mutex);
 
index 116331cead2a6676f2c018b3f8fc10b0716dfc3a..24a68e3e54195cf5f8952a35fe103d93bb0fd3e5 100644 (file)
@@ -96,9 +96,7 @@ static int comp_vdev_open(struct file *filp)
 
        fh->mdev = mdev;
        v4l2_fh_init(&fh->fh, vdev);
-       filp->private_data = &fh->fh;
-
-       v4l2_fh_add(&fh->fh);
+       v4l2_fh_add(&fh->fh, filp);
 
        ret = most_start_channel(mdev->iface, mdev->ch_idx, &comp);
        if (ret) {
index 886300a29b908a6dda3e2dfcb6b3414f782b172b..680f25d17dc2c7b99529441de8f079abe3b3411f 100644 (file)
@@ -672,10 +672,9 @@ uvc_v4l2_open(struct file *file)
                return -ENOMEM;
 
        v4l2_fh_init(&handle->vfh, vdev);
-       v4l2_fh_add(&handle->vfh);
+       v4l2_fh_add(&handle->vfh, file);
 
        handle->device = &uvc->video;
-       file->private_data = &handle->vfh;
 
        return 0;
 }
index 14e7136e693f0a7b8b25959200603028e0db36ac..d8fcf49f10e09452b73499f4a9bd1285bc2835a5 100644 (file)
@@ -87,11 +87,14 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
  * v4l2_fh_add - Add the fh to the list of file handles on a video_device.
  *
  * @fh: pointer to &struct v4l2_fh
+ * @filp: pointer to &struct file associated with @fh
+ *
+ * The function sets filp->private_data to point to @fh.
  *
  * .. note::
  *    The @fh file handle must be initialised first.
  */
-void v4l2_fh_add(struct v4l2_fh *fh);
+void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp);
 
 /**
  * v4l2_fh_open - Ancillary routine that can be used as the open\(\) op