mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-08 09:00:46 +00:00
media: ti-vpe: cal: Add context V4L2 cleanup and unregister functions
Create cal_ctx_v4l2_unregister() and cal_ctx_v4l2_cleanup() functions to unregister and cleanup the V4L2-related objects from the context, and call them in cal_remove() and in the error path of cal_probe(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
d68a94e98a
commit
19a2374068
@ -1895,6 +1895,11 @@ static int cal_ctx_v4l2_register(struct cal_ctx *ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cal_ctx_v4l2_unregister(struct cal_ctx *ctx)
|
||||||
|
{
|
||||||
|
video_unregister_device(&ctx->vdev);
|
||||||
|
}
|
||||||
|
|
||||||
static int cal_ctx_v4l2_init(struct cal_ctx *ctx)
|
static int cal_ctx_v4l2_init(struct cal_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct v4l2_ctrl_handler *hdl = &ctx->ctrl_handler;
|
struct v4l2_ctrl_handler *hdl = &ctx->ctrl_handler;
|
||||||
@ -1948,6 +1953,11 @@ static int cal_ctx_v4l2_init(struct cal_ctx *ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cal_ctx_v4l2_cleanup(struct cal_ctx *ctx)
|
||||||
|
{
|
||||||
|
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------
|
/* ------------------------------------------------------------------
|
||||||
* Initialization and module stuff
|
* Initialization and module stuff
|
||||||
* ------------------------------------------------------------------
|
* ------------------------------------------------------------------
|
||||||
@ -2286,7 +2296,7 @@ error_pm_runtime:
|
|||||||
if (ctx) {
|
if (ctx) {
|
||||||
v4l2_async_notifier_unregister(&ctx->notifier);
|
v4l2_async_notifier_unregister(&ctx->notifier);
|
||||||
v4l2_async_notifier_cleanup(&ctx->notifier);
|
v4l2_async_notifier_cleanup(&ctx->notifier);
|
||||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
cal_ctx_v4l2_cleanup(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2313,8 +2323,8 @@ static int cal_remove(struct platform_device *pdev)
|
|||||||
cal_camerarx_disable(ctx->phy);
|
cal_camerarx_disable(ctx->phy);
|
||||||
v4l2_async_notifier_unregister(&ctx->notifier);
|
v4l2_async_notifier_unregister(&ctx->notifier);
|
||||||
v4l2_async_notifier_cleanup(&ctx->notifier);
|
v4l2_async_notifier_cleanup(&ctx->notifier);
|
||||||
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|
cal_ctx_v4l2_cleanup(ctx);
|
||||||
video_unregister_device(&ctx->vdev);
|
cal_ctx_v4l2_unregister(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user