On Wed, Apr 26, 2006, 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. I just asked myself how this could work until I found out that the kernel calls 'modprobe "symbol:foo"', and module-init-tools implements it. However I think it is suspicious that symbol_request() has zero users in the 2.6.16 kernel... Johannes _______________________________________________ linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb