From patchwork Sun Feb 7 18:40:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 77633 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o17IeRbr008449 for ; Sun, 7 Feb 2010 18:40:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933049Ab0BGSkA (ORCPT ); Sun, 7 Feb 2010 13:40:00 -0500 Received: from smtp.nokia.com ([192.100.122.233]:52395 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932957Ab0BGSj5 (ORCPT ); Sun, 7 Feb 2010 13:39:57 -0500 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o17Idpku003179; Sun, 7 Feb 2010 20:39:54 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 7 Feb 2010 20:39:52 +0200 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Sun, 7 Feb 2010 20:39:51 +0200 Received: from maxwell.research.nokia.com (maxwell.research.nokia.com [172.21.50.162]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o17IdjZG030019 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 7 Feb 2010 20:39:46 +0200 Received: from lanttu (unknown [192.168.239.74]) by maxwell.research.nokia.com (Postfix) with ESMTPS id C7AC97010E; Sun, 7 Feb 2010 20:39:44 +0200 (EET) Received: from sakke by lanttu with local (Exim 4.69) (envelope-from ) id 1NeC3u-000867-Hj; Sun, 07 Feb 2010 20:40:50 +0200 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, iivanov@mm-sol.com, gururaj.nagendra@intel.com, david.cohen@nokia.com, Sakari Ailus Subject: [PATCH v2 7/7] V4L: Events: Support all events Date: Sun, 7 Feb 2010 20:40:47 +0200 Message-Id: <1265568047-31073-7-git-send-email-sakari.ailus@maxwell.research.nokia.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <4B6F0922.9070206@maxwell.research.nokia.com> References: <4B6F0922.9070206@maxwell.research.nokia.com> X-OriginalArrivalTime: 07 Feb 2010 18:39:51.0722 (UTC) FILETIME=[EF19E0A0:01CAA824] X-Nokia-AV: Clean Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 07 Feb 2010 18:40:28 +0000 (UTC) diff --git a/drivers/media/video/v4l2-event.c b/drivers/media/video/v4l2-event.c index cd744d0..131bab7 100644 --- a/drivers/media/video/v4l2-event.c +++ b/drivers/media/video/v4l2-event.c @@ -133,6 +133,14 @@ static struct v4l2_subscribed_event *__v4l2_event_subscribed( struct v4l2_events *events = fh->events; struct v4l2_subscribed_event *sev; + if (list_empty(&events->subscribed)) + return NULL; + + sev = list_entry(events->subscribed.next, + struct v4l2_subscribed_event, list); + if (sev->type == V4L2_EVENT_ALL) + return sev; + list_for_each_entry(sev, &events->subscribed, list) { if (sev->type == type) return sev; @@ -212,6 +220,8 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, /* Allow subscribing to valid events only. */ if (sub->type < V4L2_EVENT_PRIVATE_START) switch (sub->type) { + case V4L2_EVENT_ALL: + break; default: return -EINVAL; } @@ -252,7 +262,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, sev = __v4l2_event_subscribed(fh, sub->type); - if (sev == NULL) { + if (sev == NULL || + (sub->type != V4L2_EVENT_ALL && sev->type == V4L2_EVENT_ALL)) { spin_unlock_irqrestore(&fh->vdev->fhs.lock, flags); return -EINVAL; } diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index a19ae89..9ae9a1c 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1553,6 +1553,7 @@ struct v4l2_event_subscription { __u32 reserved[7]; }; +#define V4L2_EVENT_ALL 0 #define V4L2_EVENT_PRIVATE_START 0x08000000 /*