mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-22 10:55:07 -04:00
media: ti: vpe: Store v4l2_fh pointer in file->private_data
Most V4L2 drivers store the v4l2_fh pointer in file->private_data. The ti-vpe 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:
committed by
Hans Verkuil
parent
5d8d523d36
commit
597944ffa0
@@ -422,6 +422,10 @@ struct vpe_ctx {
|
||||
unsigned int src_mv_buf_selector;
|
||||
};
|
||||
|
||||
static inline struct vpe_ctx *to_vpe_ctx(struct file *filp)
|
||||
{
|
||||
return container_of(filp->private_data, struct vpe_ctx, fh);
|
||||
}
|
||||
|
||||
/*
|
||||
* M2M devices get 2 queues.
|
||||
@@ -1562,7 +1566,7 @@ static int vpe_enum_fmt(struct file *file, void *priv,
|
||||
static int vpe_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
|
||||
{
|
||||
struct v4l2_pix_format_mplane *pix = &f->fmt.pix_mp;
|
||||
struct vpe_ctx *ctx = file->private_data;
|
||||
struct vpe_ctx *ctx = to_vpe_ctx(file);
|
||||
struct vb2_queue *vq;
|
||||
struct vpe_q_data *q_data;
|
||||
|
||||
@@ -1719,7 +1723,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f,
|
||||
|
||||
static int vpe_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
|
||||
{
|
||||
struct vpe_ctx *ctx = file->private_data;
|
||||
struct vpe_ctx *ctx = to_vpe_ctx(file);
|
||||
struct vpe_fmt *fmt = find_format(f);
|
||||
|
||||
if (V4L2_TYPE_IS_OUTPUT(f->type))
|
||||
@@ -1783,7 +1787,7 @@ static int __vpe_s_fmt(struct vpe_ctx *ctx, struct v4l2_format *f)
|
||||
static int vpe_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
|
||||
{
|
||||
int ret;
|
||||
struct vpe_ctx *ctx = file->private_data;
|
||||
struct vpe_ctx *ctx = to_vpe_ctx(file);
|
||||
|
||||
ret = vpe_try_fmt(file, priv, f);
|
||||
if (ret)
|
||||
@@ -1871,7 +1875,7 @@ static int __vpe_try_selection(struct vpe_ctx *ctx, struct v4l2_selection *s)
|
||||
static int vpe_g_selection(struct file *file, void *fh,
|
||||
struct v4l2_selection *s)
|
||||
{
|
||||
struct vpe_ctx *ctx = file->private_data;
|
||||
struct vpe_ctx *ctx = to_vpe_ctx(file);
|
||||
struct vpe_q_data *q_data;
|
||||
struct v4l2_pix_format_mplane *pix;
|
||||
bool use_c_rect = false;
|
||||
@@ -1935,7 +1939,7 @@ static int vpe_g_selection(struct file *file, void *fh,
|
||||
static int vpe_s_selection(struct file *file, void *fh,
|
||||
struct v4l2_selection *s)
|
||||
{
|
||||
struct vpe_ctx *ctx = file->private_data;
|
||||
struct vpe_ctx *ctx = to_vpe_ctx(file);
|
||||
struct vpe_q_data *q_data;
|
||||
struct v4l2_selection sel = *s;
|
||||
int ret;
|
||||
@@ -2306,7 +2310,7 @@ static int vpe_open(struct file *file)
|
||||
init_adb_hdrs(ctx);
|
||||
|
||||
v4l2_fh_init(&ctx->fh, video_devdata(file));
|
||||
file->private_data = ctx;
|
||||
file->private_data = &ctx->fh;
|
||||
|
||||
hdl = &ctx->hdl;
|
||||
v4l2_ctrl_handler_init(hdl, 1);
|
||||
@@ -2400,7 +2404,7 @@ static int vpe_open(struct file *file)
|
||||
static int vpe_release(struct file *file)
|
||||
{
|
||||
struct vpe_dev *dev = video_drvdata(file);
|
||||
struct vpe_ctx *ctx = file->private_data;
|
||||
struct vpe_ctx *ctx = to_vpe_ctx(file);
|
||||
|
||||
vpe_dbg(dev, "releasing instance %p\n", ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user