diff options
Diffstat (limited to 'drivers/media/video/v4l2-event.c')
-rw-r--r-- | drivers/media/video/v4l2-event.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/media/video/v4l2-event.c b/drivers/media/video/v4l2-event.c index 46037f225529..c26ad9637143 100644 --- a/drivers/media/video/v4l2-event.c +++ b/drivers/media/video/v4l2-event.c | |||
@@ -216,6 +216,9 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, | |||
216 | unsigned long flags; | 216 | unsigned long flags; |
217 | unsigned i; | 217 | unsigned i; |
218 | 218 | ||
219 | if (sub->type == V4L2_EVENT_ALL) | ||
220 | return -EINVAL; | ||
221 | |||
219 | if (elems < 1) | 222 | if (elems < 1) |
220 | elems = 1; | 223 | elems = 1; |
221 | if (sub->type == V4L2_EVENT_CTRL) { | 224 | if (sub->type == V4L2_EVENT_CTRL) { |
@@ -283,6 +286,7 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, | |||
283 | { | 286 | { |
284 | struct v4l2_subscribed_event *sev; | 287 | struct v4l2_subscribed_event *sev; |
285 | unsigned long flags; | 288 | unsigned long flags; |
289 | int i; | ||
286 | 290 | ||
287 | if (sub->type == V4L2_EVENT_ALL) { | 291 | if (sub->type == V4L2_EVENT_ALL) { |
288 | v4l2_event_unsubscribe_all(fh); | 292 | v4l2_event_unsubscribe_all(fh); |
@@ -293,8 +297,12 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, | |||
293 | 297 | ||
294 | sev = v4l2_event_subscribed(fh, sub->type, sub->id); | 298 | sev = v4l2_event_subscribed(fh, sub->type, sub->id); |
295 | if (sev != NULL) { | 299 | if (sev != NULL) { |
300 | /* Remove any pending events for this subscription */ | ||
301 | for (i = 0; i < sev->in_use; i++) { | ||
302 | list_del(&sev->events[sev_pos(sev, i)].list); | ||
303 | fh->navailable--; | ||
304 | } | ||
296 | list_del(&sev->list); | 305 | list_del(&sev->list); |
297 | sev->fh = NULL; | ||
298 | } | 306 | } |
299 | 307 | ||
300 | spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); | 308 | spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); |