[linux-dvb] [RFC PATCH] Choose dvb adapter number with a driver specific module option

Michael Krufky mkrufky at linuxtv.org
Sat Aug 4 00:28:33 CEST 2007

Manu Abraham wrote:
> On 8/2/07, Janne Grunau <janne-dvb at grunau.be> wrote:
>> Hi,
>> Dynamic loading of modules by udev on startup (aka coldplugging) doesn't
>> result in deterministic dvb adapter numbers.
>> V4L drivers have the {radio|vbi|video}_nr module options to allocate
>> static minor numbers per driver.
>> Attached patch adds a similiar mechanism to the dvb subsystem. To avoid
>> problems with device unplugging and repluging each driver holds
>> a DVB_MAX_ADAPTER long array of the preffered order of adapter numbers.
>> options dvb-usb-dib0700 adapter_nr=7,6,5,4,3,2,1,0 would result in a
>> reversed allocation of adapter numbers.
>> With adapter_nr=2,5 it tries first to get adapter number 2 and 5. If both
>> are already in use it will allocate the lowest free adapter number.
>> Besides following changes in dvb-core and dvb-usb core the patch adds to
>> all drivers
>> +static int adapter_nr[] = {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET };
>> +module_param_array(adapter_nr, int, NULL, 0444);
>> +MODULE_PARM_DESC(adapter_nr,"DVB adapter numbers");
>> and modifies the dvb_register_adapter call. Full patch is attached as
>> compressed file.
> Do we really want to have adapter numbers in DVB bridge drivers ?
> IMHO, it doesn't look pleasing to have that.
> Is there any other possible better alternatives ? If it is that
> absolute a necessity, can we hide the ugliness in dvb-core at least ?
> (Although dvb-core is becoming a nightmare, with lot of cruft, i don't
> see anything that's going to clear up any time soon, but rather
> increase over time, with backward compatibility and things like that)


Please see Janne's latest patch.  Does that satisfy your concern?  Rather than
adding the repeated code in every driver, he used a macro, and things look quite

I like this a lot, and I'd like to commit it, if nobody speaks against it.
Would you say it's fair if I wait until Sunday before doing so?


Michael Krufky

More information about the linux-dvb mailing list