diff options
author | Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | 2013-01-22 17:00:23 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-05 12:05:26 -0500 |
commit | 22fa4279eebc3fa4b3c3dc2b190158dbbafcda9f (patch) | |
tree | 35e661c4993be3dda8342f836c8a7d7dc9e067c6 | |
parent | 4f4d14b70a29c679dd53e367b0d9b007a7117ee3 (diff) |
[media] V4L: Add v4l2_ctrl_subdev_subscribe_event() helper function
Add a v4l2 core helper function that can be used as the subdev
.subscribe_event handler. This allows to eliminate some boilerplate
from drivers that are only handling the control events.
Signed-off-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ctrls.c | 9 | ||||
-rw-r--r-- | include/media/v4l2-ctrls.h | 5 |
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 3f27571b814d..9051ec53875c 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c | |||
@@ -2885,6 +2885,15 @@ int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh, | |||
2885 | } | 2885 | } |
2886 | EXPORT_SYMBOL(v4l2_ctrl_subscribe_event); | 2886 | EXPORT_SYMBOL(v4l2_ctrl_subscribe_event); |
2887 | 2887 | ||
2888 | int v4l2_ctrl_subdev_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, | ||
2889 | struct v4l2_event_subscription *sub) | ||
2890 | { | ||
2891 | if (!sd->ctrl_handler) | ||
2892 | return -EINVAL; | ||
2893 | return v4l2_ctrl_subscribe_event(fh, sub); | ||
2894 | } | ||
2895 | EXPORT_SYMBOL(v4l2_ctrl_subdev_subscribe_event); | ||
2896 | |||
2888 | unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait) | 2897 | unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait) |
2889 | { | 2898 | { |
2890 | struct v4l2_fh *fh = file->private_data; | 2899 | struct v4l2_fh *fh = file->private_data; |
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 91125b6f05a5..1e849461fc9d 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -654,4 +654,9 @@ int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs | |||
654 | int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl); | 654 | int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl); |
655 | int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl); | 655 | int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl); |
656 | 656 | ||
657 | /* Can be used as a subscribe_event function that just subscribes control | ||
658 | events. */ | ||
659 | int v4l2_ctrl_subdev_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, | ||
660 | struct v4l2_event_subscription *sub); | ||
661 | |||
657 | #endif | 662 | #endif |