return container_of(ctrl->handler, struct mtk_jpeg_ctx, ctrl_hdl);
}
-static inline struct mtk_jpeg_ctx *mtk_jpeg_fh_to_ctx(struct v4l2_fh *fh)
-{
- return container_of(fh, struct mtk_jpeg_ctx, fh);
-}
-
static inline struct mtk_jpeg_ctx *mtk_jpeg_file_to_ctx(struct file *filp)
{
- return mtk_jpeg_fh_to_ctx(file_to_v4l2_fh(filp));
+ return container_of(file_to_v4l2_fh(filp), struct mtk_jpeg_ctx, fh);
}
static inline struct mtk_jpeg_src_buf *mtk_jpeg_vb2_to_srcbuf(
static int mtk_jpeg_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
- struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
+ struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
struct mtk_jpeg_dev *jpeg = ctx->jpeg;
return mtk_jpeg_enum_fmt(jpeg->variant->formats,
static int mtk_jpeg_enum_fmt_vid_out(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
- struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
+ struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
struct mtk_jpeg_dev *jpeg = ctx->jpeg;
return mtk_jpeg_enum_fmt(jpeg->variant->formats,
struct vb2_queue *vq;
struct mtk_jpeg_q_data *q_data = NULL;
struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
- struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
+ struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
struct mtk_jpeg_dev *jpeg = ctx->jpeg;
int i;
static int mtk_jpeg_try_fmt_vid_cap_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
+ struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
struct mtk_jpeg_dev *jpeg = ctx->jpeg;
struct mtk_jpeg_fmt *fmt;
static int mtk_jpeg_try_fmt_vid_out_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
+ struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
struct mtk_jpeg_dev *jpeg = ctx->jpeg;
struct mtk_jpeg_fmt *fmt;
if (ret)
return ret;
- return mtk_jpeg_s_fmt_mplane(mtk_jpeg_fh_to_ctx(priv), f,
+ return mtk_jpeg_s_fmt_mplane(mtk_jpeg_file_to_ctx(file), f,
MTK_JPEG_FMT_FLAG_OUTPUT);
}
if (ret)
return ret;
- return mtk_jpeg_s_fmt_mplane(mtk_jpeg_fh_to_ctx(priv), f,
+ return mtk_jpeg_s_fmt_mplane(mtk_jpeg_file_to_ctx(file), f,
MTK_JPEG_FMT_FLAG_CAPTURE);
}
static int mtk_jpeg_enc_g_selection(struct file *file, void *priv,
struct v4l2_selection *s)
{
- struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
+ struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
return -EINVAL;
static int mtk_jpeg_dec_g_selection(struct file *file, void *priv,
struct v4l2_selection *s)
{
- struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
+ struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
static int mtk_jpeg_enc_s_selection(struct file *file, void *priv,
struct v4l2_selection *s)
{
- struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
+ struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
return -EINVAL;
static int mtk_jpeg_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
{
struct v4l2_fh *fh = file_to_v4l2_fh(file);
- struct mtk_jpeg_ctx *ctx = mtk_jpeg_fh_to_ctx(priv);
+ struct mtk_jpeg_ctx *ctx = mtk_jpeg_file_to_ctx(file);
struct vb2_queue *vq;
struct vb2_buffer *vb;
struct mtk_jpeg_src_buf *jpeg_src_buf;