[linux-dvb] idea on how to break the static dependencies on demodulator modules

Andrew de Quincey adq_dvb at lidskialf.net
Tue Apr 18 01:29:49 CEST 2006

Hi, Manu and I were just discussing this, and we think we have come up with an 
idea. See the attached patch.

Note: this is just an idea - it needs completed. The patch is just 
illustrative - it won't tune or anything.

Anyway: if you look at the frontend_init() code. Instead of calling the attach 
methods (eg. stv0299_attach()) directly, we instead define something like the 
macros I have added (e.g. STV0299_ATTACH).

These use symbol_get() to dynamically get the address of the XXX_attach() 
method and, if found, call it. Otherwise they fake a NULL return, and the 
normal frontend failure code comes into effect.

This method (suprisingly!) seems to work really well - dmesg for my test card 
in this machine when I modprobed the modified budget-ci module:

saa7146: register extension 'budget_ci dvb'.
ACPI: PCI Interrupt 0000:05:06.0[A] -> Link [APC1] -> GSI 16 (level, low) -> 
IRQ 66
saa7146: found saa7146 @ mem ffffc20010d04000 (revision 1, irq 66) 
saa7146 (0): dma buffer size 192512
DVB: registering new adapter (TT-Budget/WinTV-NOVA-CI PCI).
adapter has MAC addr = 00:d0:5c:21:10:f5
input: Budget-CI dvb ir receiver saa7146 (0) as /class/input/input6
DVB: registering frontend 0 (ST STV0299 DVB-S)...

The only DVB modules loaded are however:

Can anyone see anything fundamentally wrong with doing it this way? Due to the 
frontend refactoring a while back, we already have these nice tables of 
function pointers everywhere anyway.

We do have a few static function calls to deal with - I just hacked 'em out in 
the patch. With the PLL refactoring (see my other post) more of these are 
going away anyway, so the few remaining ones can be dealt with in some neater 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attach.patch
Type: text/x-diff
Size: 5656 bytes
Desc: not available
Url : http://www.linuxtv.org/pipermail/linux-dvb/attachments/20060418/fb9c8cbb/attach.bin

More information about the linux-dvb mailing list