mirror of
https://github.com/torvalds/linux.git
synced 2026-07-30 19:21:28 +02:00
media: exynos-gsc: Access v4l2_fh from file
The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Co-developed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> 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
aa099b1129
commit
9d612344a2
|
|
@ -85,8 +85,6 @@ enum gsc_yuv_fmt {
|
|||
GSC_CRCB,
|
||||
};
|
||||
|
||||
#define fh_to_ctx(__fh) container_of(__fh, struct gsc_ctx, fh)
|
||||
|
||||
#define is_rgb(x) (!!((x) & 0x1))
|
||||
#define is_yuv420(x) (!!((x) & 0x2))
|
||||
#define is_yuv422(x) (!!((x) & 0x4))
|
||||
|
|
@ -384,7 +382,7 @@ struct gsc_ctx {
|
|||
|
||||
static inline struct gsc_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 gsc_ctx, fh);
|
||||
}
|
||||
|
||||
void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm);
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ static int gsc_m2m_enum_fmt(struct file *file, void *priv,
|
|||
static int gsc_m2m_g_fmt_mplane(struct file *file, void *fh,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
|
||||
return gsc_g_fmt_mplane(ctx, f);
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ static int gsc_m2m_g_fmt_mplane(struct file *file, void *fh,
|
|||
static int gsc_m2m_try_fmt_mplane(struct file *file, void *fh,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
|
||||
return gsc_try_fmt_mplane(ctx, f);
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ static int gsc_m2m_try_fmt_mplane(struct file *file, void *fh,
|
|||
static int gsc_m2m_s_fmt_mplane(struct file *file, void *fh,
|
||||
struct v4l2_format *f)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
struct vb2_queue *vq;
|
||||
struct gsc_frame *frame;
|
||||
struct v4l2_pix_format_mplane *pix;
|
||||
|
|
@ -359,7 +359,7 @@ static int gsc_m2m_s_fmt_mplane(struct file *file, void *fh,
|
|||
static int gsc_m2m_reqbufs(struct file *file, void *fh,
|
||||
struct v4l2_requestbuffers *reqbufs)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
struct gsc_dev *gsc = ctx->gsc_dev;
|
||||
u32 max_cnt;
|
||||
|
||||
|
|
@ -374,35 +374,35 @@ static int gsc_m2m_reqbufs(struct file *file, void *fh,
|
|||
static int gsc_m2m_expbuf(struct file *file, void *fh,
|
||||
struct v4l2_exportbuffer *eb)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
return v4l2_m2m_expbuf(file, ctx->m2m_ctx, eb);
|
||||
}
|
||||
|
||||
static int gsc_m2m_querybuf(struct file *file, void *fh,
|
||||
struct v4l2_buffer *buf)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
return v4l2_m2m_querybuf(file, ctx->m2m_ctx, buf);
|
||||
}
|
||||
|
||||
static int gsc_m2m_qbuf(struct file *file, void *fh,
|
||||
struct v4l2_buffer *buf)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
return v4l2_m2m_qbuf(file, ctx->m2m_ctx, buf);
|
||||
}
|
||||
|
||||
static int gsc_m2m_dqbuf(struct file *file, void *fh,
|
||||
struct v4l2_buffer *buf)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf);
|
||||
}
|
||||
|
||||
static int gsc_m2m_streamon(struct file *file, void *fh,
|
||||
enum v4l2_buf_type type)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
|
||||
/* The source and target color format need to be set */
|
||||
if (V4L2_TYPE_IS_OUTPUT(type)) {
|
||||
|
|
@ -418,7 +418,7 @@ static int gsc_m2m_streamon(struct file *file, void *fh,
|
|||
static int gsc_m2m_streamoff(struct file *file, void *fh,
|
||||
enum v4l2_buf_type type)
|
||||
{
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
return v4l2_m2m_streamoff(file, ctx->m2m_ctx, type);
|
||||
}
|
||||
|
||||
|
|
@ -440,8 +440,8 @@ static int is_rectangle_enclosed(struct v4l2_rect *a, struct v4l2_rect *b)
|
|||
static int gsc_m2m_g_selection(struct file *file, void *fh,
|
||||
struct v4l2_selection *s)
|
||||
{
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
struct gsc_frame *frame;
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
|
||||
if ((s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
|
||||
(s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT))
|
||||
|
|
@ -478,7 +478,7 @@ static int gsc_m2m_s_selection(struct file *file, void *fh,
|
|||
struct v4l2_selection *s)
|
||||
{
|
||||
struct gsc_frame *frame;
|
||||
struct gsc_ctx *ctx = fh_to_ctx(fh);
|
||||
struct gsc_ctx *ctx = file_to_ctx(file);
|
||||
struct gsc_variant *variant = ctx->gsc_dev->variant;
|
||||
struct v4l2_selection sel = *s;
|
||||
int ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user