From patchwork Fri Feb 27 16:31:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 881 Return-path: X-OfflineIMAP-x1878657952-426f6d626164696c-494e424f582e6c696e75782d6d65646961: 1241211805-0602688709688-v6.0.3 X-OfflineIMAP-x644853479-4c6f63616c-496e667261646561642e6c696e75782d6d65646961: 1241138692-0388512951446-v6.0.3 Envelope-to: mchehab@infradead.org Delivery-date: Fri, 27 Feb 2009 16:32:00 +0000 Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Ld5d2-0005XU-Dz for mchehab@infradead.org; Fri, 27 Feb 2009 16:32:00 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754679AbZB0Qb7 (ORCPT ); Fri, 27 Feb 2009 11:31:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755208AbZB0Qb6 (ORCPT ); Fri, 27 Feb 2009 11:31:58 -0500 Received: from smtp.nokia.com ([192.100.105.134]:61243 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754679AbZB0Qb6 (ORCPT ); Fri, 27 Feb 2009 11:31:58 -0500 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n1RGVQcr012882; Fri, 27 Feb 2009 10:31:38 -0600 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 27 Feb 2009 18:31:34 +0200 Received: from mgw-int02.ntc.nokia.com ([172.21.143.97]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 27 Feb 2009 18:31:35 +0200 Received: from maxwell.research.nokia.com (maxwell.research.nokia.com [172.21.50.162]) by mgw-int02.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n1RGVXZp027990; Fri, 27 Feb 2009 18:31:33 +0200 Received: from kaali.localdomain (kaali.localdomain [192.168.239.7]) by maxwell.research.nokia.com (Postfix) with ESMTP id 4AC497000C; Fri, 27 Feb 2009 18:31:33 +0200 (EET) Received: from sailus by kaali.localdomain with local (Exim 4.69) (envelope-from ) id 1Ld5cb-0003lR-8D; Fri, 27 Feb 2009 18:31:33 +0200 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: video4linux-list@redhat.com, tuukka.o.toivonen@nokia.com, saaguirre@ti.com, antti.koskipaa@nokia.com, david.cohen@nokia.com, Sakari Ailus Subject: [PATCH 2/4] V4L: Int if: Dummy slave Date: Fri, 27 Feb 2009 18:31:31 +0200 Message-Id: <1235752293-14452-2-git-send-email-sakari.ailus@maxwell.research.nokia.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1235752293-14452-1-git-send-email-sakari.ailus@maxwell.research.nokia.com> References: <49A81502.3090002@maxwell.research.nokia.com> <1235752293-14452-1-git-send-email-sakari.ailus@maxwell.research.nokia.com> X-OriginalArrivalTime: 27 Feb 2009 16:31:35.0239 (UTC) FILETIME=[DB200570:01C998F8] X-Nokia-AV: Clean Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Sakari Ailus 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 --- 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 eb8dc84..483ee2e 100644 --- a/drivers/media/video/v4l2-int-device.c +++ b/drivers/media/video/v4l2-int-device.c @@ -67,6 +67,25 @@ static void __v4l2_int_device_try_attach_all(void) } } +static struct v4l2_int_slave dummy_slave = { + /* Dummy pointer to avoid underflow in find_ioctl. */ + .ioctls = (void *)sizeof(struct v4l2_int_ioctl_desc), + .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) { mutex_lock(&mutex); diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h index fbf5855..5d254c4 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);