@@ -34,6 +34,7 @@
static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
{
+ fh->subdev = sd;
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
fh->pad = kzalloc(sizeof(*fh->pad) * sd->entity.num_pads, GFP_KERNEL);
if (fh->pad == NULL)
@@ -626,6 +626,7 @@ struct v4l2_subdev_try_buf {
struct v4l2_subdev_fh {
struct v4l2_fh vfh;
+ struct v4l2_subdev *subdev;
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
struct v4l2_subdev_try_buf *pad;
#endif
@@ -640,8 +641,7 @@ struct v4l2_subdev_fh {
v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \
unsigned int pad) \
{ \
- BUG_ON(pad >= vdev_to_v4l2_subdev( \
- fh->vfh.vdev)->entity.num_pads); \
+ BUG_ON(pad >= fh->subdev->entity.num_pads); \
return &fh->pad[pad].field_name; \
}
This is useful for cases, when there's no video-device associated with a V4L2 file-handle, e.g. in case of a dummy file-handle. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> --- drivers/media/v4l2-core/v4l2-subdev.c | 1 + include/media/v4l2-subdev.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)