mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:24:45 +01:00
media: Reset file->private_data to NULL in v4l2_fh_del()
Multiple drivers that use v4l2_fh and call v4l2_fh_del() manually reset
the file->private_data pointer to NULL in their video device .release()
file operation handler. Move the code to the v4l2_fh_del() 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 release;
type ret;
@@
ret release(..., struct file *filp, ...)
{
<...
- filp->private_data = NULL;
...
- v4l2_fh_del(fh);
+ v4l2_fh_del(fh, filp);
...>
}
@@
expression fh;
identifier filp;
identifier release;
type ret;
@@
ret release(..., struct file *filp, ...)
{
<...
- v4l2_fh_del(fh);
+ v4l2_fh_del(fh, filp);
...
- filp->private_data = NULL;
...>
}
@@
expression fh;
identifier filp;
identifier release;
type ret;
@@
ret release(..., struct file *filp, ...)
{
<...
- v4l2_fh_del(fh);
+ v4l2_fh_del(fh, filp);
...>
}
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_del() prototype and reset file->private_data, and to
include/media/v4l2-fh.h to update the v4l2_fh_del() function prototype
and its documentation.
Additionally, white space issues have been fixed manually in
drivers/usb/gadget/function/uvc_v4l2.c
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
47f4b1acb4
commit
277966749f
57 changed files with 89 additions and 90 deletions
|
|
@ -65,7 +65,7 @@ Example:
|
|||
struct my_fh *my_fh = container_of(fh, struct my_fh, fh);
|
||||
|
||||
...
|
||||
v4l2_fh_del(&my_fh->fh);
|
||||
v4l2_fh_del(&my_fh->fh, file);
|
||||
v4l2_fh_exit(&my_fh->fh);
|
||||
kfree(my_fh);
|
||||
return 0;
|
||||
|
|
@ -86,7 +86,7 @@ Below is a short description of the :c:type:`v4l2_fh` functions used:
|
|||
Must be called once the file handle is completely initialized.
|
||||
|
||||
:c:func:`v4l2_fh_del <v4l2_fh_del>`
|
||||
(:c:type:`fh <v4l2_fh>`)
|
||||
(:c:type:`fh <v4l2_fh>`, struct file \*filp)
|
||||
|
||||
- Unassociate the file handle from :c:type:`video_device`. The file handle
|
||||
exit function may now be called.
|
||||
|
|
|
|||
|
|
@ -822,7 +822,7 @@ int my_release(struct file *file)
|
|||
struct my_fh *my_fh = container_of(fh, struct my_fh, fh);
|
||||
|
||||
...
|
||||
v4l2_fh_del(&my_fh->fh);
|
||||
v4l2_fh_del(&my_fh->fh, file);
|
||||
v4l2_fh_exit(&my_fh->fh);
|
||||
kfree(my_fh);
|
||||
return 0;
|
||||
|
|
@ -840,7 +840,7 @@ void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp)
|
|||
添加一个 v4l2_fh 到 video_device 文件句柄列表。一旦文件句柄
|
||||
初始化完成就必须调用。
|
||||
|
||||
void v4l2_fh_del(struct v4l2_fh *fh)
|
||||
void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp)
|
||||
|
||||
从 video_device() 中解除文件句柄的关联。文件句柄的退出函数也
|
||||
将被调用。
|
||||
|
|
|
|||
|
|
@ -713,7 +713,7 @@ int cx18_v4l2_close(struct file *filp)
|
|||
vb2_queue_release(vdev->queue);
|
||||
vdev->queue->owner = NULL;
|
||||
}
|
||||
v4l2_fh_del(fh);
|
||||
v4l2_fh_del(fh, filp);
|
||||
v4l2_fh_exit(fh);
|
||||
|
||||
/* 'Unclaim' this stream */
|
||||
|
|
@ -751,7 +751,7 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
|
|||
if (atomic_read(&cx->ana_capturing) > 0) {
|
||||
/* switching to radio while capture is
|
||||
in progress is not polite */
|
||||
v4l2_fh_del(&item->fh);
|
||||
v4l2_fh_del(&item->fh, filp);
|
||||
v4l2_fh_exit(&item->fh);
|
||||
kfree(item);
|
||||
return -EBUSY;
|
||||
|
|
|
|||
|
|
@ -911,7 +911,7 @@ int ivtv_v4l2_close(struct file *filp)
|
|||
ivtv_unmute(itv);
|
||||
}
|
||||
|
||||
v4l2_fh_del(fh);
|
||||
v4l2_fh_del(fh, filp);
|
||||
v4l2_fh_exit(fh);
|
||||
|
||||
/* Easy case first: this stream was never claimed by us */
|
||||
|
|
@ -1006,7 +1006,7 @@ static int ivtv_open(struct file *filp)
|
|||
if (atomic_read(&itv->capturing) > 0) {
|
||||
/* switching to radio while capture is
|
||||
in progress is not polite */
|
||||
v4l2_fh_del(&item->fh);
|
||||
v4l2_fh_del(&item->fh, filp);
|
||||
v4l2_fh_exit(&item->fh);
|
||||
kfree(item);
|
||||
return -EBUSY;
|
||||
|
|
|
|||
|
|
@ -746,7 +746,7 @@ static int fops_release(struct file *file)
|
|||
}
|
||||
}
|
||||
|
||||
v4l2_fh_del(&fh->fh);
|
||||
v4l2_fh_del(&fh->fh, file);
|
||||
v4l2_fh_exit(&fh->fh);
|
||||
kfree(fh);
|
||||
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ static int fops_release(struct file *file)
|
|||
}
|
||||
}
|
||||
|
||||
v4l2_fh_del(&fh->fh);
|
||||
v4l2_fh_del(&fh->fh, file);
|
||||
v4l2_fh_exit(&fh->fh);
|
||||
kfree(fh);
|
||||
|
||||
|
|
|
|||
|
|
@ -3241,7 +3241,7 @@ static int allegro_release(struct file *file)
|
|||
|
||||
v4l2_ctrl_handler_free(&channel->ctrl_handler);
|
||||
|
||||
v4l2_fh_del(&channel->fh);
|
||||
v4l2_fh_del(&channel->fh, file);
|
||||
v4l2_fh_exit(&channel->fh);
|
||||
|
||||
kfree(channel);
|
||||
|
|
|
|||
|
|
@ -883,7 +883,7 @@ static int ge2d_release(struct file *file)
|
|||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -791,7 +791,7 @@ int vpu_v4l2_open(struct file *file, struct vpu_inst *inst)
|
|||
|
||||
return 0;
|
||||
error:
|
||||
v4l2_fh_del(&inst->fh);
|
||||
v4l2_fh_del(&inst->fh, file);
|
||||
v4l2_fh_exit(&inst->fh);
|
||||
vpu_inst_put(inst);
|
||||
return ret;
|
||||
|
|
@ -812,7 +812,7 @@ int vpu_v4l2_close(struct file *file)
|
|||
call_void_vop(inst, release);
|
||||
vpu_inst_unlock(inst);
|
||||
|
||||
v4l2_fh_del(&inst->fh);
|
||||
v4l2_fh_del(&inst->fh, file);
|
||||
v4l2_fh_exit(&inst->fh);
|
||||
|
||||
vpu_inst_unregister(inst);
|
||||
|
|
|
|||
|
|
@ -2725,7 +2725,7 @@ err_clk_ahb:
|
|||
err_clk_enable:
|
||||
pm_runtime_put_sync(dev->dev);
|
||||
err_pm_get:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
err_coda_name_init:
|
||||
ida_free(&dev->ida, ctx->idx);
|
||||
|
|
@ -2763,7 +2763,7 @@ static int coda_release(struct file *file)
|
|||
clk_disable_unprepare(dev->clk_ahb);
|
||||
clk_disable_unprepare(dev->clk_per);
|
||||
pm_runtime_put_sync(dev->dev);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
ida_free(&dev->ida, ctx->idx);
|
||||
if (ctx->ops->release)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ void wave5_cleanup_instance(struct vpu_instance *inst, struct file *filp)
|
|||
wave5_vdi_free_dma_memory(inst->dev, &inst->bitstream_vbuf);
|
||||
v4l2_ctrl_handler_free(&inst->v4l2_ctrl_hdl);
|
||||
if (inst->v4l2_fh.vdev) {
|
||||
v4l2_fh_del(&inst->v4l2_fh);
|
||||
v4l2_fh_del(&inst->v4l2_fh, filp);
|
||||
v4l2_fh_exit(&inst->v4l2_fh);
|
||||
}
|
||||
list_del_init(&inst->list);
|
||||
|
|
|
|||
|
|
@ -769,7 +769,7 @@ static int e5010_open(struct file *file)
|
|||
err_ctrls_setup:
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
exit:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
mutex_unlock(&e5010->mutex);
|
||||
free:
|
||||
|
|
@ -786,7 +786,7 @@ static int e5010_release(struct file *file)
|
|||
mutex_lock(&e5010->mutex);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
mutex_unlock(&e5010->mutex);
|
||||
|
|
|
|||
|
|
@ -880,7 +880,7 @@ static int deinterlace_release(struct file *file)
|
|||
|
||||
dprintk(pcdev, "Releasing instance %p\n", ctx);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
kfree(ctx->xt);
|
||||
|
|
|
|||
|
|
@ -1201,7 +1201,7 @@ static int mtk_jpeg_open(struct file *file)
|
|||
return 0;
|
||||
|
||||
error:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
mutex_unlock(&jpeg->lock);
|
||||
free:
|
||||
|
|
@ -1217,7 +1217,7 @@ static int mtk_jpeg_release(struct file *file)
|
|||
mutex_lock(&jpeg->lock);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_hdl);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
mutex_unlock(&jpeg->lock);
|
||||
|
|
|
|||
|
|
@ -1130,7 +1130,7 @@ err_load_vpu:
|
|||
error_m2m_ctx:
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
error_ctrls:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
mutex_unlock(&mdp->lock);
|
||||
err_lock:
|
||||
|
|
@ -1148,7 +1148,7 @@ static int mtk_mdp_m2m_release(struct file *file)
|
|||
mutex_lock(&mdp->lock);
|
||||
v4l2_m2m_ctx_release(ctx->m2m_ctx);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
mtk_mdp_vpu_deinit(&ctx->vpu);
|
||||
mdp->ctx_num--;
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ err_release_m2m_ctx:
|
|||
v4l2_m2m_ctx_release(ctx->m2m_ctx);
|
||||
err_release_handler:
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
err_exit_fh:
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
ida_free(&mdp->mdp_ida, ctx->id);
|
||||
|
|
@ -657,7 +657,7 @@ static int mdp_m2m_release(struct file *file)
|
|||
mdp_vpu_put_locked(mdp);
|
||||
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
ida_free(&mdp->mdp_ida, ctx->id);
|
||||
mutex_unlock(&mdp->m2m_lock);
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ err_load_fw:
|
|||
err_m2m_ctx_init:
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_hdl);
|
||||
err_ctrls_setup:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
mutex_unlock(&dev->dev_mutex);
|
||||
|
|
@ -307,7 +307,7 @@ static int fops_vcodec_release(struct file *file)
|
|||
v4l2_m2m_ctx_release(ctx->m2m_ctx);
|
||||
mtk_vcodec_dec_release(ctx);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_hdl);
|
||||
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ err_load_fw:
|
|||
err_m2m_ctx_init:
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_hdl);
|
||||
err_ctrls_setup:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
mutex_unlock(&dev->dev_mutex);
|
||||
|
|
@ -209,7 +209,7 @@ static int fops_vcodec_release(struct file *file)
|
|||
|
||||
v4l2_m2m_ctx_release(ctx->m2m_ctx);
|
||||
mtk_vcodec_enc_release(ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_hdl);
|
||||
|
||||
|
|
|
|||
|
|
@ -856,7 +856,7 @@ static int tegra_release(struct file *file)
|
|||
struct tegra_ctx *ctx = fh_to_tegra_ctx(fh);
|
||||
struct tegra_vde *vde = ctx->vde;
|
||||
|
||||
v4l2_fh_del(fh);
|
||||
v4l2_fh_del(fh, file);
|
||||
v4l2_m2m_ctx_release(fh->m2m_ctx);
|
||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||
v4l2_fh_exit(fh);
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ static int dw100_release(struct file *file)
|
|||
{
|
||||
struct dw100_ctx *ctx = dw100_file2ctx(file);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
|
|
|
|||
|
|
@ -2238,7 +2238,7 @@ static int mxc_jpeg_open(struct file *file)
|
|||
err_ctrls_setup:
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
error:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
mutex_unlock(&mxc_jpeg->lock);
|
||||
free:
|
||||
|
|
@ -2751,7 +2751,7 @@ static int mxc_jpeg_release(struct file *file)
|
|||
ctx->slot);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
mutex_unlock(&mxc_jpeg->lock);
|
||||
|
|
|
|||
|
|
@ -1716,7 +1716,7 @@ static int pxp_release(struct file *file)
|
|||
|
||||
dprintk(dev, "Releasing instance %p\n", ctx);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||
mutex_lock(&dev->dev_mutex);
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ static int mxc_isi_m2m_release(struct file *file)
|
|||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
mxc_isi_m2m_ctx_ctrls_delete(ctx);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
|
||||
mutex_destroy(&ctx->vb2_lock);
|
||||
|
|
|
|||
|
|
@ -769,7 +769,7 @@ static int emmaprp_release(struct file *file)
|
|||
mutex_lock(&pcdev->dev_mutex);
|
||||
clk_disable_unprepare(pcdev->clk_emma_ahb);
|
||||
clk_disable_unprepare(pcdev->clk_emma_ipg);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
mutex_unlock(&pcdev->dev_mutex);
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ static void iris_v4l2_fh_init(struct iris_inst *inst, struct file *filp)
|
|||
|
||||
static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)
|
||||
{
|
||||
filp->private_data = NULL;
|
||||
v4l2_fh_del(&inst->fh);
|
||||
v4l2_fh_del(&inst->fh, filp);
|
||||
inst->fh.ctrl_handler = NULL;
|
||||
v4l2_fh_exit(&inst->fh);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ void venus_close_common(struct venus_inst *inst, struct file *filp)
|
|||
v4l2_m2m_ctx_release(inst->m2m_ctx);
|
||||
v4l2_m2m_release(inst->m2m_dev);
|
||||
hfi_session_destroy(inst);
|
||||
v4l2_fh_del(&inst->fh);
|
||||
v4l2_fh_del(&inst->fh, filp);
|
||||
v4l2_fh_exit(&inst->fh);
|
||||
v4l2_ctrl_handler_free(&inst->ctrl_handler);
|
||||
|
||||
|
|
|
|||
|
|
@ -2166,7 +2166,7 @@ static int fdp1_release(struct file *file)
|
|||
|
||||
dprintk(fdp1, "Releasing instance %p\n", ctx);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||
mutex_lock(&fdp1->dev_mutex);
|
||||
|
|
|
|||
|
|
@ -1276,7 +1276,7 @@ jpu_reset_rollback:
|
|||
device_prepare_rollback:
|
||||
mutex_unlock(&jpu->mutex);
|
||||
v4l_prepare_rollback:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
return ret;
|
||||
|
|
@ -1289,7 +1289,7 @@ static int jpu_release(struct file *file)
|
|||
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -1083,7 +1083,7 @@ static int vsp1_video_open(struct file *file)
|
|||
|
||||
ret = vsp1_device_get(video->vsp1);
|
||||
if (ret < 0) {
|
||||
v4l2_fh_del(vfh);
|
||||
v4l2_fh_del(vfh, file);
|
||||
v4l2_fh_exit(vfh);
|
||||
kfree(vfh);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ static int rga_release(struct file *file)
|
|||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -954,7 +954,7 @@ static int rkvdec_release(struct file *filp)
|
|||
{
|
||||
struct rkvdec_ctx *ctx = file_to_rkvdec_ctx(filp);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, filp);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_hdl);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
|
|
|
|||
|
|
@ -654,7 +654,7 @@ static int gsc_m2m_open(struct file *file)
|
|||
|
||||
error_ctrls:
|
||||
gsc_ctrls_delete(ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
error_fh:
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
|
|
@ -675,7 +675,7 @@ static int gsc_m2m_release(struct file *file)
|
|||
|
||||
v4l2_m2m_ctx_release(ctx->m2m_ctx);
|
||||
gsc_ctrls_delete(ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
|
||||
if (--gsc->m2m.refcnt <= 0)
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ error_m2m_ctx:
|
|||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
error_c:
|
||||
fimc_ctrls_delete(ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
error_fh:
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
|
|
@ -684,7 +684,7 @@ static int fimc_m2m_release(struct file *file)
|
|||
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
fimc_ctrls_delete(ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
|
||||
if (--fimc->m2m.refcnt <= 0)
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ static int g2d_release(struct file *file)
|
|||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
mutex_unlock(&dev->mutex);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
v4l2_info(&dev->v4l2_dev, "instance closed\n");
|
||||
|
|
|
|||
|
|
@ -1005,7 +1005,7 @@ static int s5p_jpeg_open(struct file *file)
|
|||
return 0;
|
||||
|
||||
error:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
mutex_unlock(&jpeg->lock);
|
||||
free:
|
||||
|
|
@ -1021,7 +1021,7 @@ static int s5p_jpeg_release(struct file *file)
|
|||
mutex_lock(&jpeg->lock);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
mutex_unlock(&jpeg->lock);
|
||||
|
|
|
|||
|
|
@ -955,7 +955,7 @@ err_ctrls_setup:
|
|||
err_bad_node:
|
||||
dev->ctx[ctx->num] = NULL;
|
||||
err_no_ctx:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
err_alloc:
|
||||
|
|
@ -1010,7 +1010,7 @@ static int s5p_mfc_release(struct file *file)
|
|||
if (dev)
|
||||
dev->ctx[ctx->num] = NULL;
|
||||
s5p_mfc_dec_ctrls_delete(ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
/* vdev is gone if dev is null */
|
||||
if (dev)
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ static int bdisp_open(struct file *file)
|
|||
|
||||
error_ctrls:
|
||||
bdisp_ctrls_delete(ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
error_fh:
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
bdisp_hw_free_nodes(ctx);
|
||||
|
|
@ -659,7 +659,7 @@ static int bdisp_release(struct file *file)
|
|||
|
||||
bdisp_ctrls_delete(ctx);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
|
||||
if (--bdisp->m2m.refcnt <= 0)
|
||||
|
|
|
|||
|
|
@ -1684,7 +1684,7 @@ static int delta_open(struct file *file)
|
|||
return 0;
|
||||
|
||||
err_fh_del:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
err:
|
||||
|
|
@ -1712,7 +1712,7 @@ static int delta_release(struct file *file)
|
|||
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
|
||||
/* disable ST231 clocks */
|
||||
|
|
|
|||
|
|
@ -1218,7 +1218,7 @@ static int hva_open(struct file *file)
|
|||
err_ctrls:
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
err_fh:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
out:
|
||||
|
|
@ -1249,7 +1249,7 @@ static int hva_release(struct file *file)
|
|||
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
|
||||
#ifdef CONFIG_VIDEO_STI_HVA_DEBUGFS
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ static int dma2d_release(struct file *file)
|
|||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
mutex_unlock(&dev->mutex);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -759,7 +759,7 @@ static int deinterlace_release(struct file *file)
|
|||
|
||||
mutex_lock(&dev->dev_mutex);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@ static int rotate_release(struct file *file)
|
|||
mutex_lock(&dev->dev_mutex);
|
||||
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -1336,7 +1336,7 @@ static int isp_video_open(struct file *file)
|
|||
|
||||
done:
|
||||
if (ret < 0) {
|
||||
v4l2_fh_del(&handle->vfh);
|
||||
v4l2_fh_del(&handle->vfh, file);
|
||||
v4l2_fh_exit(&handle->vfh);
|
||||
kfree(handle);
|
||||
}
|
||||
|
|
@ -1360,10 +1360,9 @@ static int isp_video_release(struct file *file)
|
|||
v4l2_pipeline_pm_put(&video->video.entity);
|
||||
|
||||
/* Release the file handle. */
|
||||
v4l2_fh_del(vfh);
|
||||
v4l2_fh_del(vfh, file);
|
||||
v4l2_fh_exit(vfh);
|
||||
kfree(handle);
|
||||
file->private_data = NULL;
|
||||
|
||||
omap3isp_put(video->isp);
|
||||
|
||||
|
|
|
|||
|
|
@ -2421,7 +2421,7 @@ static int vpe_release(struct file *file)
|
|||
vpdma_free_desc_buf(&ctx->sc_coeff_v);
|
||||
vpdma_free_desc_buf(&ctx->sc_coeff_h);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ static int hantro_open(struct file *filp)
|
|||
return 0;
|
||||
|
||||
err_fh_free:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, filp);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
err_ctx_free:
|
||||
kfree(ctx);
|
||||
|
|
@ -693,7 +693,7 @@ static int hantro_release(struct file *filp)
|
|||
* to this file.
|
||||
*/
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, filp);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||
kfree(ctx);
|
||||
|
|
|
|||
|
|
@ -1946,7 +1946,7 @@ static int vicodec_release(struct file *file)
|
|||
mutex_lock(vfd->lock);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
mutex_unlock(vfd->lock);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||
kvfree(ctx->state.compressed_frame);
|
||||
|
|
|
|||
|
|
@ -1450,7 +1450,7 @@ static int vim2m_release(struct file *file)
|
|||
|
||||
dprintk(dev, 1, "Releasing instance %p\n", ctx);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||
mutex_lock(&dev->dev_mutex);
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ static int visl_release(struct file *file)
|
|||
dprintk(dev, "Releasing instance %p\n", ctx);
|
||||
|
||||
tpg_free(&ctx->tpg);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||
mutex_lock(&dev->dev_mutex);
|
||||
|
|
|
|||
|
|
@ -900,9 +900,8 @@ static int pvr2_v4l2_release(struct file *file)
|
|||
fhp->rhp = NULL;
|
||||
}
|
||||
|
||||
v4l2_fh_del(&fhp->fh);
|
||||
v4l2_fh_del(&fhp->fh, file);
|
||||
v4l2_fh_exit(&fhp->fh);
|
||||
file->private_data = NULL;
|
||||
|
||||
pvr2_channel_done(&fhp->channel);
|
||||
pvr2_trace(PVR2_TRACE_STRUCT,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ int v4l2_fh_open(struct file *filp)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_fh_open);
|
||||
|
||||
void v4l2_fh_del(struct v4l2_fh *fh)
|
||||
void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
|
|
@ -75,6 +75,8 @@ void v4l2_fh_del(struct v4l2_fh *fh)
|
|||
list_del_init(&fh->list);
|
||||
spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
|
||||
v4l2_prio_close(fh->vdev->prio, fh->prio);
|
||||
|
||||
filp->private_data = NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_fh_del);
|
||||
|
||||
|
|
@ -94,10 +96,9 @@ int v4l2_fh_release(struct file *filp)
|
|||
struct v4l2_fh *fh = file_to_v4l2_fh(filp);
|
||||
|
||||
if (fh) {
|
||||
v4l2_fh_del(fh);
|
||||
v4l2_fh_del(fh, filp);
|
||||
v4l2_fh_exit(fh);
|
||||
kfree(fh);
|
||||
filp->private_data = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ static int subdev_open(struct file *file)
|
|||
|
||||
err:
|
||||
module_put(subdev_fh->owner);
|
||||
v4l2_fh_del(&subdev_fh->vfh);
|
||||
v4l2_fh_del(&subdev_fh->vfh, file);
|
||||
v4l2_fh_exit(&subdev_fh->vfh);
|
||||
subdev_fh_free(subdev_fh);
|
||||
kfree(subdev_fh);
|
||||
|
|
@ -127,11 +127,10 @@ static int subdev_close(struct file *file)
|
|||
if (sd->internal_ops && sd->internal_ops->close)
|
||||
sd->internal_ops->close(sd, subdev_fh);
|
||||
module_put(subdev_fh->owner);
|
||||
v4l2_fh_del(vfh);
|
||||
v4l2_fh_del(vfh, file);
|
||||
v4l2_fh_exit(vfh);
|
||||
subdev_fh_free(subdev_fh);
|
||||
kfree(subdev_fh);
|
||||
file->private_data = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -792,7 +792,7 @@ static int ipu_csc_scaler_open(struct file *file)
|
|||
err_ctrls:
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
err_ctx:
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
return ret;
|
||||
|
|
@ -807,7 +807,7 @@ static int ipu_csc_scaler_release(struct file *file)
|
|||
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_hdlr);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
kfree(ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -926,7 +926,7 @@ static int vdec_close(struct file *file)
|
|||
|
||||
v4l2_m2m_ctx_release(sess->m2m_ctx);
|
||||
v4l2_m2m_release(sess->m2m_dev);
|
||||
v4l2_fh_del(&sess->fh);
|
||||
v4l2_fh_del(&sess->fh, file);
|
||||
v4l2_fh_exit(&sess->fh);
|
||||
|
||||
mutex_destroy(&sess->lock);
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ static int cedrus_release(struct file *file)
|
|||
|
||||
mutex_lock(&dev->dev_mutex);
|
||||
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_del(&ctx->fh, file);
|
||||
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
||||
|
||||
v4l2_ctrl_handler_free(&ctx->hdl);
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ static int comp_vdev_open(struct file *filp)
|
|||
return 0;
|
||||
|
||||
err_rm:
|
||||
v4l2_fh_del(&fh->fh);
|
||||
v4l2_fh_del(&fh->fh, filp);
|
||||
v4l2_fh_exit(&fh->fh);
|
||||
|
||||
err_dec:
|
||||
|
|
@ -143,7 +143,7 @@ static int comp_vdev_close(struct file *filp)
|
|||
most_stop_channel(mdev->iface, mdev->ch_idx, &comp);
|
||||
mdev->mute = false;
|
||||
|
||||
v4l2_fh_del(&fh->fh);
|
||||
v4l2_fh_del(&fh->fh, filp);
|
||||
v4l2_fh_exit(&fh->fh);
|
||||
|
||||
atomic_dec(&mdev->access_ref);
|
||||
|
|
|
|||
|
|
@ -692,8 +692,7 @@ uvc_v4l2_release(struct file *file)
|
|||
uvc_v4l2_disable(uvc);
|
||||
mutex_unlock(&video->mutex);
|
||||
|
||||
file->private_data = NULL;
|
||||
v4l2_fh_del(&handle->vfh);
|
||||
v4l2_fh_del(&handle->vfh, file);
|
||||
v4l2_fh_exit(&handle->vfh);
|
||||
kfree(handle);
|
||||
|
||||
|
|
|
|||
|
|
@ -114,12 +114,15 @@ int v4l2_fh_open(struct file *filp);
|
|||
* v4l2_fh_del - Remove file handle from the list of file handles.
|
||||
*
|
||||
* @fh: pointer to &struct v4l2_fh
|
||||
* @filp: pointer to &struct file associated with @fh
|
||||
*
|
||||
* The function resets filp->private_data to NULL.
|
||||
*
|
||||
* .. note::
|
||||
* Must be called in v4l2_file_operations->release\(\) handler if the driver
|
||||
* uses &struct v4l2_fh.
|
||||
*/
|
||||
void v4l2_fh_del(struct v4l2_fh *fh);
|
||||
void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp);
|
||||
|
||||
/**
|
||||
* v4l2_fh_exit - Release resources related to a file handle.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue