[yavta PATCH v3 01/11] Separate device object initialisation and opening

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxx>
---
 yavta.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/yavta.c b/yavta.c
index 739463d..c7ad7b4 100644
--- a/yavta.c
+++ b/yavta.c
@@ -220,17 +220,20 @@ static const char *v4l2_format_name(unsigned int fourcc)
 	return name;
 }
 
-static int video_open(struct device *dev, const char *devname, int no_query)
+static void video_init(struct device *dev)
 {
-	struct v4l2_capability cap;
-	unsigned int capabilities;
-	int ret;
-
 	memset(dev, 0, sizeof *dev);
 	dev->fd = -1;
 	dev->memtype = V4L2_MEMORY_MMAP;
 	dev->buffers = NULL;
 	dev->type = (enum v4l2_buf_type)-1;
+}
+
+static int video_open(struct device *dev, const char *devname, int no_query)
+{
+	struct v4l2_capability cap;
+	unsigned int capabilities;
+	int ret;
 
 	dev->fd = open(devname, O_RDWR);
 	if (dev->fd < 0) {
@@ -1599,6 +1602,8 @@ int main(int argc, char *argv[])
 
 	unsigned int rt_priority = 1;
 
+	video_init(&dev);
+
 	opterr = 0;
 	while ((c = getopt_long(argc, argv, "c::Cd:f:F::hi:Iln:pq:r:R::s:t:uw:", opts, NULL)) != -1) {
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux