All of lore.kernel.org
 help / color / mirror / Atom feed
* [REVIEW PATCH 01/14] V4L: Int if: Dummy slave
@ 2009-01-13  2:03 Aguirre Rodriguez, Sergio Alberto
  2009-01-13 20:33 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Aguirre Rodriguez, Sergio Alberto @ 2009-01-13  2:03 UTC (permalink / raw)
  To: linux-omap@vger.kernel.org
  Cc: linux-media@vger.kernel.org, video4linux-list@redhat.com,
	Sakari Ailus, Tuukka.O Toivonen, Nagalla, Hari

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 <sakari.ailus@nokia.com>
Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
---
 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);
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [REVIEW PATCH 01/14] V4L: Int if: Dummy slave
@ 2008-12-11 20:37 Aguirre Rodriguez, Sergio Alberto
  0 siblings, 0 replies; 4+ messages in thread
From: Aguirre Rodriguez, Sergio Alberto @ 2008-12-11 20:37 UTC (permalink / raw)
  To: linux-omap@vger.kernel.org, video4linux-list@redhat.com
  Cc: Sakari Ailus, Tuukka.O Toivonen, Nagalla, Hari

>From d6e52dcc4ec93dcca3218763ccf21fd1bea08d55 Mon Sep 17 00:00:00 2001
From: Sergio Aguirre <saaguirre@ti.com>
Date: Thu, 11 Dec 2008 13:35:52 -0600
Subject: [PATCH] V4L: Int if: Dummy slave

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 <sakari.ailus@nokia.com>
---
 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);
-- 
1.5.6.5


--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-22  9:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-13  2:03 [REVIEW PATCH 01/14] V4L: Int if: Dummy slave Aguirre Rodriguez, Sergio Alberto
2009-01-13 20:33 ` Mauro Carvalho Chehab
2009-01-22  9:37   ` Sakari Ailus
  -- strict thread matches above, loose matches on Subject: below --
2008-12-11 20:37 Aguirre Rodriguez, Sergio Alberto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.