return 0;
}
-static inline struct mtk_mdp_ctx *fh_to_ctx(struct v4l2_fh *fh)
-{
- return container_of(fh, struct mtk_mdp_ctx, fh);
-}
-
static inline struct mtk_mdp_ctx *file_to_ctx(struct file *filp)
{
- return fh_to_ctx(file_to_v4l2_fh(filp));
+ return container_of(file_to_v4l2_fh(filp), struct mtk_mdp_ctx, fh);
}
static inline struct mtk_mdp_ctx *ctrl_to_ctx(struct v4l2_ctrl *ctrl)
static int mtk_mdp_m2m_querycap(struct file *file, void *fh,
struct v4l2_capability *cap)
{
- struct mtk_mdp_ctx *ctx = fh_to_ctx(fh);
+ struct mtk_mdp_ctx *ctx = file_to_ctx(file);
struct mtk_mdp_dev *mdp = ctx->mdp_dev;
strscpy(cap->driver, MTK_MDP_MODULE_NAME, sizeof(cap->driver));
static int mtk_mdp_m2m_g_fmt_mplane(struct file *file, void *fh,
struct v4l2_format *f)
{
- struct mtk_mdp_ctx *ctx = fh_to_ctx(fh);
+ struct mtk_mdp_ctx *ctx = file_to_ctx(file);
struct mtk_mdp_frame *frame;
struct v4l2_pix_format_mplane *pix_mp;
int i;
static int mtk_mdp_m2m_try_fmt_mplane(struct file *file, void *fh,
struct v4l2_format *f)
{
- struct mtk_mdp_ctx *ctx = fh_to_ctx(fh);
+ struct mtk_mdp_ctx *ctx = file_to_ctx(file);
if (!mtk_mdp_try_fmt_mplane(ctx, f))
return -EINVAL;
static int mtk_mdp_m2m_s_fmt_mplane(struct file *file, void *fh,
struct v4l2_format *f)
{
- struct mtk_mdp_ctx *ctx = fh_to_ctx(fh);
+ struct mtk_mdp_ctx *ctx = file_to_ctx(file);
struct vb2_queue *vq;
struct mtk_mdp_frame *frame;
struct v4l2_pix_format_mplane *pix_mp;
static int mtk_mdp_m2m_reqbufs(struct file *file, void *fh,
struct v4l2_requestbuffers *reqbufs)
{
- struct mtk_mdp_ctx *ctx = fh_to_ctx(fh);
+ struct mtk_mdp_ctx *ctx = file_to_ctx(file);
return v4l2_m2m_reqbufs(file, ctx->m2m_ctx, reqbufs);
}
static int mtk_mdp_m2m_streamon(struct file *file, void *fh,
enum v4l2_buf_type type)
{
- struct mtk_mdp_ctx *ctx = fh_to_ctx(fh);
+ struct mtk_mdp_ctx *ctx = file_to_ctx(file);
int ret;
if (!mtk_mdp_ctx_state_is_set(ctx, MTK_MDP_VPU_INIT)) {
static int mtk_mdp_m2m_g_selection(struct file *file, void *fh,
struct v4l2_selection *s)
{
+ struct mtk_mdp_ctx *ctx = file_to_ctx(file);
struct mtk_mdp_frame *frame;
- struct mtk_mdp_ctx *ctx = fh_to_ctx(fh);
bool valid = false;
if (s->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
static int mtk_mdp_m2m_s_selection(struct file *file, void *fh,
struct v4l2_selection *s)
{
+ struct mtk_mdp_ctx *ctx = file_to_ctx(file);
struct mtk_mdp_frame *frame;
- struct mtk_mdp_ctx *ctx = fh_to_ctx(fh);
struct v4l2_rect new_r;
struct mtk_mdp_variant *variant = ctx->mdp_dev->variant;
int ret;