From patchwork Tue Jan 13 02:03:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aguirre Rodriguez, Sergio Alberto" X-Patchwork-Id: 2051 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0D1xaKr016391 for ; Mon, 12 Jan 2009 17:59:37 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753221AbZAMCDf (ORCPT ); Mon, 12 Jan 2009 21:03:35 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753602AbZAMCDf (ORCPT ); Mon, 12 Jan 2009 21:03:35 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:38950 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753221AbZAMCDe convert rfc822-to-8bit (ORCPT ); Mon, 12 Jan 2009 21:03:34 -0500 Received: from dlep95.itg.ti.com ([157.170.170.107]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n0D23A0d017596; Mon, 12 Jan 2009 20:03:15 -0600 Received: from dlee73.ent.ti.com (localhost [127.0.0.1]) by dlep95.itg.ti.com (8.13.8/8.13.8) with ESMTP id n0D23A0g008519; Mon, 12 Jan 2009 20:03:10 -0600 (CST) Received: from dlee02.ent.ti.com ([157.170.170.17]) by dlee73.ent.ti.com ([157.170.170.88]) with mapi; Mon, 12 Jan 2009 20:03:10 -0600 From: "Aguirre Rodriguez, Sergio Alberto" To: "linux-omap@vger.kernel.org" CC: "linux-media@vger.kernel.org" , "video4linux-list@redhat.com" , Sakari Ailus , "Tuukka.O Toivonen" , "Nagalla, Hari" Date: Mon, 12 Jan 2009 20:03:08 -0600 Subject: [REVIEW PATCH 01/14] V4L: Int if: Dummy slave Thread-Topic: [REVIEW PATCH 01/14] V4L: Int if: Dummy slave Thread-Index: Acl1IxR5xvr3teunR6KllDMSo7bRLg== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch implements a dummy slave that has no functionality. Helps managing slaves in the OMAP 3 camera driver; no need to check for NULL pointers. Signed-off-by: Sakari Ailus Signed-off-by: Sergio Aguirre --- drivers/media/video/v4l2-int-device.c | 19 +++++++++++++++++++ include/media/v4l2-int-device.h | 2 ++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/v4l2-int-device.c b/drivers/media/video/v4l2-int-device.c index a935bae..cba1c9c 100644 --- a/drivers/media/video/v4l2-int-device.c +++ b/drivers/media/video/v4l2-int-device.c @@ -32,6 +32,25 @@ static DEFINE_MUTEX(mutex); static LIST_HEAD(int_list); +static struct v4l2_int_slave dummy_slave = { + /* Dummy pointer to avoid underflow in find_ioctl. */ + .ioctls = (void *)0x80000000, + .num_ioctls = 0, +}; + +static struct v4l2_int_device dummy = { + .type = v4l2_int_type_slave, + .u = { + .slave = &dummy_slave, + }, +}; + +struct v4l2_int_device *v4l2_int_device_dummy() +{ + return &dummy; +} +EXPORT_SYMBOL_GPL(v4l2_int_device_dummy); + void v4l2_int_device_try_attach_all(void) { struct v4l2_int_device *m, *s; diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h index 9c2df41..85a1834 100644 --- a/include/media/v4l2-int-device.h +++ b/include/media/v4l2-int-device.h @@ -84,6 +84,8 @@ struct v4l2_int_device { void *priv; }; +struct v4l2_int_device *v4l2_int_device_dummy(void); + void v4l2_int_device_try_attach_all(void); int v4l2_int_device_register(struct v4l2_int_device *d);