mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
media: imagination: Store v4l2_fh pointer in file->private_data
Most V4L2 drivers store the v4l2_fh pointer in file->private_data. The e5010-jpeg-enc driver instead stores the pointer to the driver-specific structure that embeds the v4l2_fh. Switch to storing the v4l2_fh pointer itself to standardize behaviour across drivers. This also prepares for future refactoring that depends on v4l2_fh being stored in private_data. 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
2ce99accf3
commit
5d8d523d36
|
|
@ -253,7 +253,7 @@ static int e5010_enum_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f)
|
|||
{
|
||||
int i, index = 0;
|
||||
struct e5010_fmt *fmt = NULL;
|
||||
struct e5010_context *ctx = file->private_data;
|
||||
struct e5010_context *ctx = to_e5010_context(file);
|
||||
|
||||
if (!V4L2_TYPE_IS_MULTIPLANAR(f->type)) {
|
||||
v4l2_err(&ctx->e5010->v4l2_dev, "ENUMFMT with Invalid type: %d\n", f->type);
|
||||
|
|
@ -279,7 +279,7 @@ static int e5010_enum_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f)
|
|||
|
||||
static int e5010_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
|
||||
{
|
||||
struct e5010_context *ctx = file->private_data;
|
||||
struct e5010_context *ctx = to_e5010_context(file);
|
||||
struct e5010_q_data *queue;
|
||||
int i;
|
||||
struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
|
||||
|
|
@ -380,14 +380,14 @@ static int e5010_jpeg_try_fmt(struct v4l2_format *f, struct e5010_context *ctx)
|
|||
|
||||
static int e5010_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
|
||||
{
|
||||
struct e5010_context *ctx = file->private_data;
|
||||
struct e5010_context *ctx = to_e5010_context(file);
|
||||
|
||||
return e5010_jpeg_try_fmt(f, ctx);
|
||||
}
|
||||
|
||||
static int e5010_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
|
||||
{
|
||||
struct e5010_context *ctx = file->private_data;
|
||||
struct e5010_context *ctx = to_e5010_context(file);
|
||||
struct vb2_queue *vq;
|
||||
int ret = 0, i = 0;
|
||||
struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
|
||||
|
|
@ -462,7 +462,7 @@ static int e5010_enum_framesizes(struct file *file, void *priv, struct v4l2_frms
|
|||
|
||||
static int e5010_g_selection(struct file *file, void *fh, struct v4l2_selection *s)
|
||||
{
|
||||
struct e5010_context *ctx = file->private_data;
|
||||
struct e5010_context *ctx = to_e5010_context(file);
|
||||
struct e5010_q_data *queue;
|
||||
|
||||
if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
|
||||
|
|
@ -490,7 +490,7 @@ static int e5010_g_selection(struct file *file, void *fh, struct v4l2_selection
|
|||
|
||||
static int e5010_s_selection(struct file *file, void *fh, struct v4l2_selection *s)
|
||||
{
|
||||
struct e5010_context *ctx = file->private_data;
|
||||
struct e5010_context *ctx = to_e5010_context(file);
|
||||
struct e5010_q_data *queue;
|
||||
struct vb2_queue *vq;
|
||||
struct v4l2_rect base_rect;
|
||||
|
|
@ -742,7 +742,7 @@ static int e5010_open(struct file *file)
|
|||
}
|
||||
|
||||
v4l2_fh_init(&ctx->fh, vdev);
|
||||
file->private_data = ctx;
|
||||
file->private_data = &ctx->fh;
|
||||
v4l2_fh_add(&ctx->fh);
|
||||
|
||||
ctx->e5010 = e5010;
|
||||
|
|
@ -781,7 +781,7 @@ static int e5010_open(struct file *file)
|
|||
static int e5010_release(struct file *file)
|
||||
{
|
||||
struct e5010_dev *e5010 = video_drvdata(file);
|
||||
struct e5010_context *ctx = file->private_data;
|
||||
struct e5010_context *ctx = to_e5010_context(file);
|
||||
|
||||
dprintk(e5010, 1, "Releasing instance: 0x%p, m2m_ctx: 0x%p\n", ctx, ctx->fh.m2m_ctx);
|
||||
mutex_lock(&e5010->mutex);
|
||||
|
|
@ -1262,7 +1262,7 @@ static void e5010_buf_queue(struct vb2_buffer *vb)
|
|||
static int e5010_encoder_cmd(struct file *file, void *priv,
|
||||
struct v4l2_encoder_cmd *cmd)
|
||||
{
|
||||
struct e5010_context *ctx = file->private_data;
|
||||
struct e5010_context *ctx = to_e5010_context(file);
|
||||
int ret;
|
||||
struct vb2_queue *cap_vq;
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,11 @@ struct e5010_context {
|
|||
u8 chroma_qp[QP_TABLE_SIZE];
|
||||
};
|
||||
|
||||
static inline struct e5010_context *to_e5010_context(struct file *filp)
|
||||
{
|
||||
return container_of(filp->private_data, struct e5010_context, fh);
|
||||
}
|
||||
|
||||
/*
|
||||
* Buffer structure
|
||||
* Contains info for all buffers
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user