Re: cx88 and many readers

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

 



Am Freitag, den 19.01.2007, 11:03 -0500 schrieb Michael Krufky:
> Roland Stoll wrote:
> > 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
> 
> Steve,
> 
> Roland's patch looks sane to me...  Can you check this as well, to make sure
> this wont break the control of cx88-mpeg between cx88-dvb and cx88-blackbird for
> dual-functionality devices such as the hvr1300 ?
> 
> It's been a few weeks since Roland sent this in, so I've attached the original
> patch from Roland just in case you dont have it.
> 
> 
> Roland, just a few things...
> 
> First off, we will need you to provide a sign-off, in the form:
> 
> Signed-off-by: Your Name <email@xxxxxxxx>
> 
> ...in order for us to be able to apply this changeset to the kernel.
> 
> Also, you have broken some whitespace codingstyle.  This is a minor issue, but
> we shouldn't insert any extra spaces inside the (parenthesis) like ( this ).
> 
> I'd just like to hear confirmation that this doesnt break the cx88-mpeg
> switching on the hvr1300 before we apply this.
> 
> Cheers,
> 
> Michael Krufky

Here is a new version with fixed whitespaces and the reference count is
now incremented correctly.

regards, Roland

Signed-off-by: Roland Stoll <roland@xxxxxxxxx>

diff -r 0d8665c378a4 linux/drivers/media/video/cx88/cx88-mpeg.c
--- a/linux/drivers/media/video/cx88/cx88-mpeg.c	Tue Jan 02 01:14:37 2007 -0200
+++ b/linux/drivers/media/video/cx88/cx88-mpeg.c	Sat Jan 20 08:09:58 2007 +0100
@@ -639,13 +639,17 @@ int cx8802_request_acquire(struct cx8802
 	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)
 	{
-		core->active_type_id = drv->type_id;
-		drv->advise_acquire(drv);
+		core->active_ref++;
+		if (core->active_type_id == CX88_BOARD_NONE) {
+			core->active_type_id = drv->type_id;
+			drv->advise_acquire(drv);
+		}
 
 		mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO));
 	}
@@ -658,7 +662,7 @@ int cx8802_request_release(struct cx8802
 {
 	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;
diff -r 0d8665c378a4 linux/drivers/media/video/cx88/cx88.h
--- a/linux/drivers/media/video/cx88/cx88.h	Tue Jan 02 01:14:37 2007 -0200
+++ b/linux/drivers/media/video/cx88/cx88.h	Tue Jan 02 23:30:54 2007 +0100
@@ -351,6 +351,7 @@ struct cx88_core {
 	/* 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;
_______________________________________________
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