cx88 and many readers

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

 



Hello,

with the latest snapshots it isn't possible to open the frontend device
of cx88-dvb multiple times. I used this to monitor signal quality with
an external tool (femon).
With the attached patch it's working again. Is it ok if the same
hardware on the transport bus is used more than once?

regards, Roland
--- v4l-dvb.orig/linux/drivers/media/video/cx88/cx88.h	2007-01-01 14:11:59.000000000 +0100
+++ v4l-dvb/linux/drivers/media/video/cx88/cx88.h	2007-01-02 23:30:54.000000000 +0100
@@ -351,6 +351,7 @@
 	/* cx88-video needs to access cx8802 for hybrid tuner pll access. */
 	struct cx8802_dev          *dvbdev;
 	enum cx88_board_type       active_type_id;
+	int			   active_ref;
 };
 
 struct cx8800_dev;
--- v4l-dvb.orig/linux/drivers/media/video/cx88/cx88-mpeg.c	2007-01-02 22:41:56.000000000 +0100
+++ v4l-dvb/linux/drivers/media/video/cx88/cx88-mpeg.c	2007-01-02 23:53:58.000000000 +0100
@@ -639,12 +639,15 @@
 	struct cx88_core *core = drv->core;
 
 	/* Fail a request for hardware if the device is busy. */
-	if (core->active_type_id != CX88_BOARD_NONE)
+	if ( core->active_type_id != CX88_BOARD_NONE && 
+ 		core->active_type_id != drv->type_id )
 		return -EBUSY;
 
-	if (drv->advise_acquire)
+	if ( core->active_type_id == CX88_BOARD_NONE && 
+		drv->advise_acquire )
 	{
 		core->active_type_id = drv->type_id;
+		core->active_ref++;
 		drv->advise_acquire(drv);
 
 		mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO));
@@ -658,7 +661,7 @@
 {
 	struct cx88_core *core = drv->core;
 
-	if (drv->advise_release)
+	if ( drv->advise_release && --core->active_ref == 0)
 	{
 		drv->advise_release(drv);
 		core->active_type_id = CX88_BOARD_NONE;
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux