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@xxxxxx> --- drivers/media/v4l2-core/v4l2-subdev.c | 1 + include/media/v4l2-subdev.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 996c248..ec9f0d8 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -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) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 4424a7c..0581781 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -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; \ } -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html