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

Andrew de Quincey adq_dvb at lidskialf.net
Thu Apr 27 00:07:22 CEST 2006

On Wednesday 26 April 2006 22:59, Trent Piepho wrote:
> On Tue, 25 Apr 2006, Andrew de Quincey wrote:
> > This has had the various feedbacks from various people applied - let me
> > know what you think.
> I haven't tested this, but what about using this for dvb_attach:
> #define dvb_attach(FUNCTION, ARGS...) ({ \
>     struct dvb_frontend *__r = NULL; \
>     typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
>     if (__a) { \
>         if (!(__r = __a(ARGS))) symbol_put(FUNCTION); \
>     } else printk(KERN_ERR "DVB: Unable to get function "#FUNCTION"()\n");
> \ __r; \
> })
> The idea is to use symbol_request, which will try to get the symbol, and if
> it's not there and module loading is enabled, it will try to load the
> module it is in.  You don't need to specify the module name manually,
> modprobe knows which module exports which symbols.  Modules can be renamed,
> split, combined, etc. without having to fix all the module names in the
> card drivers.  It also doesn't call request_module() if it's not necessary.

Oooh, that looks good! Thanks!

I just need to figure out a nice way to solve the problem Johannes raised 
about the symbol_puts now.

More information about the linux-dvb mailing list