Mailing List archive

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

[linux-dvb] Re: cinergyT2: which kernel/usb module to use?



Hi Johannes, hi Stefan,

Holger Waechtler wrote:

Johannes Stezenbach wrote:

I would hesistate to implement a workaround limiting the number of events (e.g. by a synchronous counter incremented by the wakeup(poll_wq) call and decremented in the ioctl()) since this would just hide application bugs in the future, too and introduce new workarounds in every new driver exposing the same behaviour.

Look, it seems you don't like the API. Fine. But I kindly
ask you to play by the rules and implement the same API
as the other drivers do. The reason is simple: Interoperability.

You don't like how VDR uses the API and want VDR to be changed
so it works with your driver? And what about mplayer, xine,
kaxtv, mythtv, dvbstream and whatever is out there?

I have no problems if you start dvb-kernel-v5 and implement
your dream API, but your driver only has a right to be
included in dvb-kernel if it maintains API compatibility
with the other drivers in dvb-kernel. Period.

:) sounds like we need the evil counter-hack to get peace...

can you please try the attached patch and test if it solves your problem?

Holger


btw: Johannes, since the original v3 frontend API was designed by Ralph, Andre and me I think it is just fair if the original authors publicly announce their criticism, propose changes for future API versions as well as implementation recommendations arised out of pasttime experiences. Please stop nagging. thanks.

? build-2.4/include/linux
Index: linux/drivers/media/dvb/cinergyT2/cinergyT2.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/cinergyT2/cinergyT2.c,v
retrieving revision 1.15.2.3
diff -p -u -p -u -r1.15.2.3 cinergyT2.c
--- linux/drivers/media/dvb/cinergyT2/cinergyT2.c	27 Nov 2004 19:15:22 -0000	1.15.2.3
+++ linux/drivers/media/dvb/cinergyT2/cinergyT2.c	29 Nov 2004 18:24:54 -0000
@@ -176,6 +176,7 @@ struct cinergyt2 {
 	struct work_struct query_work;
 
 	wait_queue_head_t poll_wq;
+	int pending_fe_events;
 
 	void *streambuf;
 	dma_addr_t streambuf_dmahandle;
@@ -663,6 +664,12 @@ int cinergyt2_ioctl (struct inode *inode
 		 *  are trivial to fill as soon FE_GET_FRONTEND is done.
 		 */
 		struct dvb_frontend_event *e = (void *) arg;
+		if (cinergyt2->pending_fe_events == 0) {
+			if (file->f_flags & O_NONBLOCK)
+				return -EWOULDBLOCK;
+			wait_event_interruptible(cinergyt2->poll_wq,
+						 cinergyt2->pending_fe_events > 0);
+		}
 		return cinergyt2_ioctl(inode, file, FE_READ_STATUS,
 					(unsigned long) &e->status);
 	}
@@ -695,7 +702,7 @@ int cinergyt2_mmap(struct file *file, st
 		goto bailout;
 	}
 
-        vma->vm_flags |= (VM_IO | VM_DONTCOPY);
+	vma->vm_flags |= (VM_IO | VM_DONTCOPY);
 	vma->vm_file = file;
 
 	ret = remap_pfn_range(vma, vma->vm_start,
@@ -711,11 +718,11 @@ bailout:
 
 static
 struct file_operations cinergyt2_fops = {
-	.owner          = THIS_MODULE,
+	.owner		= THIS_MODULE,
 	.ioctl		= cinergyt2_ioctl,
-	.poll           = cinergyt2_poll,
-	.open           = cinergyt2_open,
-	.release        = cinergyt2_release,
+	.poll		= cinergyt2_poll,
+	.open		= cinergyt2_open,
+	.release	= cinergyt2_release,
 /*	.mmap		= cinergyt2_mmap*/
 };
 
@@ -800,8 +807,10 @@ static void cinergyt2_query (void *data)
 	unc += le32_to_cpu(s->uncorrected_block_count);
 	s->uncorrected_block_count = unc;
 
-	if (lock_bits != s->lock_bits)
+	if (lock_bits != s->lock_bits) {
 		wake_up_interruptible(&cinergyt2->poll_wq);
+		cinergyt2->pending_fe_events++;
+	}
 
 	schedule_delayed_work(&cinergyt2->query_work,
 			      msecs_to_jiffies(QUERY_INTERVAL));

Home | Main Index | Thread Index