Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: staging: imx: 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>

authored by

Jacopo Mondi and committed by
Hans Verkuil
d2683099 ee7aa3df

+6 -8
+6 -8
drivers/staging/media/imx/imx-media-csc-scaler.c
··· 23 23 24 24 #include "imx-media.h" 25 25 26 - #define fh_to_ctx(__fh) container_of(__fh, struct ipu_csc_scaler_ctx, fh) 27 - 28 26 #define IMX_CSC_SCALER_NAME "imx-csc-scaler" 29 27 30 28 enum { ··· 66 68 67 69 static inline struct ipu_csc_scaler_ctx *file_to_ctx(struct file *filp) 68 70 { 69 - return fh_to_ctx(file_to_v4l2_fh(filp)); 71 + return container_of(file_to_v4l2_fh(filp), struct ipu_csc_scaler_ctx, fh); 70 72 } 71 73 72 74 static struct ipu_csc_scaler_q_data *get_q_data(struct ipu_csc_scaler_ctx *ctx, ··· 182 184 static int ipu_csc_scaler_g_fmt(struct file *file, void *priv, 183 185 struct v4l2_format *f) 184 186 { 185 - struct ipu_csc_scaler_ctx *ctx = fh_to_ctx(priv); 187 + struct ipu_csc_scaler_ctx *ctx = file_to_ctx(file); 186 188 struct ipu_csc_scaler_q_data *q_data; 187 189 188 190 q_data = get_q_data(ctx, f->type); ··· 195 197 static int ipu_csc_scaler_try_fmt(struct file *file, void *priv, 196 198 struct v4l2_format *f) 197 199 { 198 - struct ipu_csc_scaler_ctx *ctx = fh_to_ctx(priv); 200 + struct ipu_csc_scaler_ctx *ctx = file_to_ctx(file); 199 201 struct ipu_csc_scaler_q_data *q_data = get_q_data(ctx, f->type); 200 202 struct ipu_image test_in, test_out; 201 203 enum v4l2_field field; ··· 243 245 static int ipu_csc_scaler_s_fmt(struct file *file, void *priv, 244 246 struct v4l2_format *f) 245 247 { 248 + struct ipu_csc_scaler_ctx *ctx = file_to_ctx(file); 246 249 struct ipu_csc_scaler_q_data *q_data; 247 - struct ipu_csc_scaler_ctx *ctx = fh_to_ctx(priv); 248 250 struct vb2_queue *vq; 249 251 int ret; 250 252 ··· 299 301 static int ipu_csc_scaler_g_selection(struct file *file, void *priv, 300 302 struct v4l2_selection *s) 301 303 { 302 - struct ipu_csc_scaler_ctx *ctx = fh_to_ctx(priv); 304 + struct ipu_csc_scaler_ctx *ctx = file_to_ctx(file); 303 305 struct ipu_csc_scaler_q_data *q_data; 304 306 305 307 switch (s->target) { ··· 337 339 static int ipu_csc_scaler_s_selection(struct file *file, void *priv, 338 340 struct v4l2_selection *s) 339 341 { 340 - struct ipu_csc_scaler_ctx *ctx = fh_to_ctx(priv); 342 + struct ipu_csc_scaler_ctx *ctx = file_to_ctx(file); 341 343 struct ipu_csc_scaler_q_data *q_data; 342 344 343 345 switch (s->target) {