Hi list, When rewriting the skystar2 driver I saw something, which maybe can be put into an upper layer: Every driver, which's hardware supports PID filtering (in the demod or anywhere else), implements a similar mechanism: They hold a table or a static list with at least an unique ID, a pid value and an active-switch. Each time the start_feed-callback is called they look for a free entry in this list and reserve it until it is freed by the stop_feed-callback. The unique ID can be understood as the position in the pid-filter-table of the hardware, just incrementing the feed_count is of course not enough and ID can be reused. For examples, see dvb-dibusb-pid, skystar2, ttusb-budget. The easiest solution would be to add a unique ID to struct dvb_demux_feed. Some ugly code duplicates can then be removed. Please have a look at the attached patch. Does this small change in dvb_demux.[ch] is sufficient, or did I miss anything? Thanks for your attention, Patrick. -- Mail: patrick.boettcher@xxxxxxx WWW: http://www.wi-bw.tfh-wildau.de/~pboettch/ -------------- next part -------------- ? .built-in.o.cmd ? .dmxdev.o.cmd ? .dvb-core.ko.cmd ? .dvb-core.mod.o.cmd ? .dvb-core.o.cmd ? .dvb_ca_en50221.o.cmd ? .dvb_demux.o.cmd ? .dvb_filter.o.cmd ? .dvb_frontend.o.cmd ? .dvb_frontend.o.d ? .dvb_functions.o.cmd ? .dvb_i2c.o.cmd ? .dvb_ksyms.o.cmd ? .dvb_net.o.cmd ? .dvb_ringbuffer.o.cmd ? .dvbdev.o.cmd ? dvb-core.ko ? dvb-core.mod.c Index: dvb_demux.c =================================================================== RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_demux.c,v retrieving revision 1.61 diff -u -3 -p -r1.61 dvb_demux.c --- dvb_demux.c 12 Feb 2005 01:24:28 -0000 1.61 +++ dvb_demux.c 14 Feb 2005 17:29:46 -0000 @@ -1232,8 +1232,10 @@ int dvb_dmx_init(struct dvb_demux *dvbde dvbdemux->filter[i].index = i; } - for (i=0; i<dvbdemux->feednum; i++) + for (i=0; i<dvbdemux->feednum; i++) { dvbdemux->feed[i].state = DMX_STATE_FREE; + dvbdemux->feed[i].index = i; + } dvbdemux->frontend_list.next= dvbdemux->frontend_list.prev= Index: dvb_demux.h =================================================================== RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_demux.h,v retrieving revision 1.22 diff -u -3 -p -r1.22 dvb_demux.h --- dvb_demux.h 12 Feb 2005 01:24:28 -0000 1.22 +++ dvb_demux.h 14 Feb 2005 17:29:46 -0000 @@ -79,6 +79,7 @@ struct dvb_demux_feed { struct dvb_demux *demux; void *priv; int type; + int index; int state; u16 pid; u8 *buffer;