Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242022
b: refs/heads/master
c: f0beea8
h: refs/heads/master
v: v3
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Mar 22, 2011
1 parent 54beb0c commit 25ddcfc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7cd5a16b22af7dc92190a60f336b6854a6fcb99d
refs/heads/master: f0beea8f46142ea7abd7ed3f44fd0967c603fae0
16 changes: 13 additions & 3 deletions trunk/drivers/media/video/v4l2-subdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static int subdev_open(struct file *file)
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
struct v4l2_subdev_fh *subdev_fh;
#if defined(CONFIG_MEDIA_CONTROLLER)
struct media_entity *entity;
struct media_entity *entity = NULL;
#endif
int ret;

Expand Down Expand Up @@ -101,9 +101,19 @@ static int subdev_open(struct file *file)
}
#endif

if (sd->internal_ops && sd->internal_ops->open) {
ret = sd->internal_ops->open(sd, subdev_fh);
if (ret < 0)
goto err;
}

return 0;

err:
#if defined(CONFIG_MEDIA_CONTROLLER)
if (entity)
media_entity_put(entity);
#endif
v4l2_fh_del(&subdev_fh->vfh);
v4l2_fh_exit(&subdev_fh->vfh);
subdev_fh_free(subdev_fh);
Expand All @@ -114,13 +124,13 @@ static int subdev_open(struct file *file)

static int subdev_close(struct file *file)
{
#if defined(CONFIG_MEDIA_CONTROLLER)
struct video_device *vdev = video_devdata(file);
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
#endif
struct v4l2_fh *vfh = file->private_data;
struct v4l2_subdev_fh *subdev_fh = to_v4l2_subdev_fh(vfh);

if (sd->internal_ops && sd->internal_ops->close)
sd->internal_ops->close(sd, subdev_fh);
#if defined(CONFIG_MEDIA_CONTROLLER)
if (sd->v4l2_dev->mdev)
media_entity_put(&sd->entity);
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/media/v4l2-subdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct v4l2_ctrl_handler;
struct v4l2_event_subscription;
struct v4l2_fh;
struct v4l2_subdev;
struct v4l2_subdev_fh;
struct tuner_setup;

/* decode_vbi_line */
Expand Down Expand Up @@ -431,10 +432,16 @@ struct v4l2_subdev_ops {
*
* unregistered: called when this subdev is unregistered. When called the
* v4l2_dev field is still set to the correct v4l2_device.
*
* open: called when the subdev device node is opened by an application.
*
* close: called when the subdev device node is closed.
*/
struct v4l2_subdev_internal_ops {
int (*registered)(struct v4l2_subdev *sd);
void (*unregistered)(struct v4l2_subdev *sd);
int (*open)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
int (*close)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
};

#define V4L2_SUBDEV_NAME_SIZE 32
Expand Down

0 comments on commit 25ddcfc

Please sign in to comment.