V4L/DVB (7538): Adds selectable adapter numbers as per module option
authorJanne Grunau <janne-dvb@grunau.be>
Wed, 9 Apr 2008 22:13:13 +0000 (19:13 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:08:00 +0000 (14:08 -0300)
The adapter_nr module options can be used to allocate static adapter
numbers on a driver level. It avoids problems with changing DVB apapter
numbers after warm/cold boot or device unplugging and repluging.

Each driver holds DVB_MAX_ADAPTER long array of the preferred 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.

Signed-off-by: Janne Grunau <janne-dvb@grunau.be>
Acked-by: Hermann Pitton <hermann.pitton@arcor.de>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
37 files changed:
drivers/media/dvb/b2c2/flexcop.c
drivers/media/dvb/bt8xx/dvb-bt8xx.c
drivers/media/dvb/cinergyT2/cinergyT2.c
drivers/media/dvb/dvb-core/dvbdev.c
drivers/media/dvb/dvb-core/dvbdev.h
drivers/media/dvb/dvb-usb/a800.c
drivers/media/dvb/dvb-usb/af9005.c
drivers/media/dvb/dvb-usb/au6610.c
drivers/media/dvb/dvb-usb/cxusb.c
drivers/media/dvb/dvb-usb/dib0700_core.c
drivers/media/dvb/dvb-usb/dibusb-mb.c
drivers/media/dvb/dvb-usb/dibusb-mc.c
drivers/media/dvb/dvb-usb/digitv.c
drivers/media/dvb/dvb-usb/dtt200u.c
drivers/media/dvb/dvb-usb/dvb-usb-common.h
drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
drivers/media/dvb/dvb-usb/dvb-usb-init.c
drivers/media/dvb/dvb-usb/dvb-usb.h
drivers/media/dvb/dvb-usb/gl861.c
drivers/media/dvb/dvb-usb/gp8psk.c
drivers/media/dvb/dvb-usb/m920x.c
drivers/media/dvb/dvb-usb/nova-t-usb2.c
drivers/media/dvb/dvb-usb/opera1.c
drivers/media/dvb/dvb-usb/ttusb2.c
drivers/media/dvb/dvb-usb/umt-010.c
drivers/media/dvb/dvb-usb/vp702x.c
drivers/media/dvb/dvb-usb/vp7045.c
drivers/media/dvb/pluto2/pluto2.c
drivers/media/dvb/ttpci/av7110.c
drivers/media/dvb/ttpci/budget-core.c
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
drivers/media/dvb/ttusb-dec/ttusb_dec.c
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/saa7134/saa7134-dvb.c
drivers/media/video/videobuf-dvb.c
include/media/videobuf-dvb.h

index 205146c241293cde5df6505cc3b09e62fad29d0b..5f79c8dc383651aa9349e3445f854d24947aab9a 100644 (file)
@@ -49,6 +49,8 @@ module_param_named(debug, b2c2_flexcop_debug,  int, 0644);
 MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))." DEBSTATUS);
 #undef DEBSTATUS
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 /* global zero for ibi values */
 flexcop_ibi_value ibi_zero;
 
@@ -66,8 +68,10 @@ static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
 
 static int flexcop_dvb_init(struct flexcop_device *fc)
 {
-       int ret;
-       if ((ret = dvb_register_adapter(&fc->dvb_adapter,"FlexCop Digital TV device",fc->owner,fc->dev)) < 0) {
+       int ret = dvb_register_adapter(&fc->dvb_adapter,
+                                      "FlexCop Digital TV device", fc->owner,
+                                      fc->dev, adapter_nr);
+       if (ret < 0) {
                err("error registering DVB adapter");
                return ret;
        }
index a39439b5f04c07675d45655e85b244a41ad448bd..6afbfbbef0ce304885826365df8a40735c9a5ee7 100644 (file)
@@ -40,6 +40,8 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define dprintk( args... ) \
        do { \
                if (debug) printk(KERN_DEBUG args); \
@@ -717,7 +719,10 @@ static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
 {
        int result;
 
-       if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE, &card->bt->dev->dev)) < 0) {
+       result = dvb_register_adapter(&card->dvb_adapter, card->card_name,
+                                     THIS_MODULE, &card->bt->dev->dev,
+                                     adapter_nr);
+       if (result < 0) {
                printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result);
                return result;
        }
index 29b2459e0b219fefc2e0b0782dfc2959dbbf77cd..f5010e8671b8476109b44df80e90a47079305302 100644 (file)
@@ -58,6 +58,8 @@ static int debug;
 module_param_named(debug, debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define dprintk(level, args...)                                                \
 do {                                                                   \
        if ((debug & level)) {                                          \
@@ -938,7 +940,10 @@ static int cinergyt2_probe (struct usb_interface *intf,
                return -ENOMEM;
        }
 
-       if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE, &cinergyt2->udev->dev)) < 0) {
+       err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME,
+                                  THIS_MODULE, &cinergyt2->udev->dev,
+                                  adapter_nr);
+       if (err < 0) {
                kfree(cinergyt2);
                return err;
        }
index 0a2897bc98733f56fb5122161d36956e25a6db28..8b56d929f7fd52c63f1fbda3165bcce33d0aa11d 100644 (file)
@@ -49,7 +49,6 @@ static const char * const dnames[] = {
        "net", "osd"
 };
 
-#define DVB_MAX_ADAPTERS       8
 #define DVB_MAX_IDS            4
 #define nums2minor(num,type,id)        ((num << 6) | (id << 4) | type)
 #define MAX_DVB_MINORS         (DVB_MAX_ADAPTERS*64)
@@ -262,18 +261,25 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
 }
 EXPORT_SYMBOL(dvb_unregister_device);
 
+static int dvbdev_check_free_adapter_num(int num)
+{
+       struct list_head *entry;
+       list_for_each(entry, &dvb_adapter_list) {
+               struct dvb_adapter *adap;
+               adap = list_entry(entry, struct dvb_adapter, list_head);
+               if (adap->num == num)
+                       return 0;
+       }
+       return 1;
+}
 
 static int dvbdev_get_free_adapter_num (void)
 {
        int num = 0;
 
        while (num < DVB_MAX_ADAPTERS) {
-               struct dvb_adapter *adap;
-               list_for_each_entry(adap, &dvb_adapter_list, list_head)
-                       if (adap->num == num)
-                               goto skip;
-               return num;
-skip:
+               if (dvbdev_check_free_adapter_num(num))
+                       return num;
                num++;
        }
 
@@ -281,13 +287,28 @@ skip:
 }
 
 
-int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct module *module, struct device *device)
+int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
+                        struct module *module, struct device *device,
+                        short *adapter_nums)
 {
-       int num;
+       int i, num;
 
        mutex_lock(&dvbdev_register_lock);
 
-       if ((num = dvbdev_get_free_adapter_num ()) < 0) {
+       for (i = 0; i < DVB_MAX_ADAPTERS; ++i) {
+               num = adapter_nums[i];
+               if (num >= 0  &&  num < DVB_MAX_ADAPTERS) {
+               /* use the one the driver asked for */
+                       if (dvbdev_check_free_adapter_num(num))
+                               break;
+               } else {
+                       num = dvbdev_get_free_adapter_num();
+                       break;
+               }
+               num = -1;
+       }
+
+       if (num < 0) {
                mutex_unlock(&dvbdev_register_lock);
                return -ENFILE;
        }
index 6dff10ebf47052a1f92872e7a95541f56e845646..5f9a737c6de194065d3e5f7e4de06e0407d8c322 100644 (file)
 
 #define DVB_MAJOR 212
 
+#define DVB_MAX_ADAPTERS 8
+
+#define DVB_UNSET (-1)
+
 #define DVB_DEVICE_VIDEO      0
 #define DVB_DEVICE_AUDIO      1
 #define DVB_DEVICE_SEC        2
 #define DVB_DEVICE_NET        7
 #define DVB_DEVICE_OSD        8
 
+#define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
+       static short adapter_nr[] = \
+               {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
+       module_param_array(adapter_nr, short, NULL, 0444); \
+       MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
 
 struct dvb_adapter {
        int num;
@@ -78,7 +87,9 @@ struct dvb_device {
 };
 
 
-extern int dvb_register_adapter (struct dvb_adapter *adap, const char *name, struct module *module, struct device *device);
+extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
+                               struct module *module, struct device *device,
+                               short *adapter_nums);
 extern int dvb_unregister_adapter (struct dvb_adapter *adap);
 
 extern int dvb_register_device (struct dvb_adapter *adap,
index a6c5f19f680d6dd38452a0f5356885bfa082994b..dc8c8784caa8a8c46e36886acdcbff6e8f3eeb1e 100644 (file)
@@ -18,6 +18,9 @@
 static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (rc=1 (or-able))." DVB_USB_DEBUG_STATUS);
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define deb_rc(args...)   dprintk(debug,0x01,args)
 
 static int a800_power_ctrl(struct dvb_usb_device *d, int onoff)
@@ -94,7 +97,8 @@ static struct dvb_usb_device_properties a800_properties;
 static int a800_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       return dvb_usb_device_init(intf,&a800_properties,THIS_MODULE,NULL);
+       return dvb_usb_device_init(intf, &a800_properties,
+                                  THIS_MODULE, NULL, adapter_nr);
 }
 
 /* do not change the order of the ID table */
index e7f76f515b4f6bbe293832596daf20c78dc0d0b4..cfe71feefcad27a8e64598316a366bda99ae8985 100644 (file)
@@ -39,6 +39,8 @@ int dvb_usb_af9005_dump_eeprom = 0;
 module_param_named(dump_eeprom, dvb_usb_af9005_dump_eeprom, int, 0);
 MODULE_PARM_DESC(dump_eeprom, "dump contents of the eeprom.");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 /* remote control decoder */
 int (*rc_decode) (struct dvb_usb_device * d, u8 * data, int len, u32 * event,
                  int *state);
@@ -1020,7 +1022,8 @@ static struct dvb_usb_device_properties af9005_properties;
 static int af9005_usb_probe(struct usb_interface *intf,
                            const struct usb_device_id *id)
 {
-       return dvb_usb_device_init(intf, &af9005_properties, THIS_MODULE, NULL);
+       return dvb_usb_device_init(intf, &af9005_properties,
+                                  THIS_MODULE, NULL, adapter_nr);
 }
 
 static struct usb_device_id af9005_usb_table[] = {
index f3ff8131469607422e2599b88492521bac9e3f78..2ccb90fa60c85917cd9604443cb13e5169e61f5f 100644 (file)
@@ -19,6 +19,8 @@ static int dvb_usb_au6610_debug;
 module_param_named(debug, dvb_usb_au6610_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
                          u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
 {
@@ -163,7 +165,9 @@ static int au6610_probe(struct usb_interface *intf,
        if (intf->num_altsetting < AU6610_ALTSETTING_COUNT)
                return -ENODEV;
 
-       if ((ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d)) == 0) {
+       ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d,
+                                 adapter_nr);
+       if (ret == 0) {
                alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING);
 
                if (alt == NULL) {
index 4e5118dfe2e057d69a7c6d9fad3403332cf0231d..c4b00660c65fcc2b3526125d76fe123b167a76b1 100644 (file)
@@ -40,6 +40,9 @@
 static int dvb_usb_cxusb_debug;
 module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define deb_info(args...)   dprintk(dvb_usb_cxusb_debug,0x01,args)
 #define deb_i2c(args...)    if (d->udev->descriptor.idVendor == USB_VID_MEDION) \
                                dprintk(dvb_usb_cxusb_debug,0x01,args)
@@ -723,16 +726,24 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
 static int cxusb_probe(struct usb_interface *intf,
                       const struct usb_device_id *id)
 {
-       if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&cxusb_bluebird_dualdig4_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&cxusb_bluebird_nano2_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&cxusb_bluebird_nano2_needsfirmware_properties,THIS_MODULE,NULL) == 0) {
+       if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf,
+                               &cxusb_bluebird_nano2_needsfirmware_properties,
+                                    THIS_MODULE, NULL, adapter_nr))
                return 0;
-       }
 
        return -EINVAL;
 }
index 4b3836e63be94e20383ad2375906c5807865f185..595a04696c87af2590588bf87013a44b8e44aa7c 100644 (file)
@@ -17,6 +17,8 @@ int dvb_usb_dib0700_ir_proto = 1;
 module_param(dvb_usb_dib0700_ir_proto, int, 0644);
 MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, "set ir protocol (0=NEC, 1=RC5 (default), 2=RC6).");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 /* expecting rx buffer: request data[0] data[1] ... data[2] */
 static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
 {
@@ -279,7 +281,8 @@ static int dib0700_probe(struct usb_interface *intf,
        struct dvb_usb_device *dev;
 
        for (i = 0; i < dib0700_device_count; i++)
-               if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE, &dev) == 0)
+               if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE,
+                                       &dev, adapter_nr) == 0)
                {
                        dib0700_rc_setup(dev);
                        return 0;
index 043cadae08594f62ed1dead95e77439e728a3a2d..eeef50bff4f9b39c41e984ffd52a76ccb2720ddf 100644 (file)
@@ -14,6 +14,8 @@
  */
 #include "dibusb.h"
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 static int dib3000mb_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
 {
        struct dvb_usb_adapter *adap = fe->dvb->priv;
@@ -107,10 +109,14 @@ static struct dvb_usb_device_properties artec_t1_usb2_properties;
 static int dibusb_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&artec_t1_usb2_properties,THIS_MODULE,NULL) == 0)
+       if (0 == dvb_usb_device_init(intf, &dibusb1_1_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &dibusb1_1_an2235_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &dibusb2_0b_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &artec_t1_usb2_properties,
+                                    THIS_MODULE, NULL, adapter_nr))
                return 0;
 
        return -EINVAL;
index e7ea3e753d6da2eb287af30cb9b245214352b20b..059cec95531826aa8128bc3bcdc6e57e371ee6e7 100644 (file)
  */
 #include "dibusb.h"
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 /* USB Driver stuff */
 static struct dvb_usb_device_properties dibusb_mc_properties;
 
 static int dibusb_mc_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       return dvb_usb_device_init(intf,&dibusb_mc_properties,THIS_MODULE,NULL);
+       return dvb_usb_device_init(intf, &dibusb_mc_properties, THIS_MODULE,
+                                  NULL, adapter_nr);
 }
 
 /* do not change the order of the ID table */
index 3acbda4aa27e1e550cb548e4f2972c050c8d4ada..b545cf3eab2e5c0a63ac1f48ca67fca3cf8eae21 100644 (file)
@@ -20,6 +20,9 @@
 static int dvb_usb_digitv_debug;
 module_param_named(debug,dvb_usb_digitv_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define deb_rc(args...)   dprintk(dvb_usb_digitv_debug,0x01,args)
 
 static int digitv_ctrl_msg(struct dvb_usb_device *d,
@@ -256,8 +259,9 @@ static int digitv_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
        struct dvb_usb_device *d;
-       int ret;
-       if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) {
+       int ret = dvb_usb_device_init(intf, &digitv_properties, THIS_MODULE, &d,
+                                     adapter_nr);
+       if (ret == 0) {
                u8 b[4] = { 0 };
 
                if (d != NULL) { /* do that only when the firmware is loaded */
index d86cf9bee91c23fdd8ec0b528994b51b95cd6f7b..81a6cbf601603a6e8b2313921291350b131bd1ae 100644 (file)
@@ -18,6 +18,8 @@ int dvb_usb_dtt200u_debug;
 module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS);
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
 {
        u8 b = SET_INIT;
@@ -101,11 +103,16 @@ static struct dvb_usb_device_properties wt220u_miglia_properties;
 static int dtt200u_usb_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&wt220u_fc_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&wt220u_zl0353_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&wt220u_miglia_properties,THIS_MODULE,NULL) == 0)
+       if (0 == dvb_usb_device_init(intf, &dtt200u_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &wt220u_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &wt220u_fc_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &wt220u_zl0353_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &wt220u_miglia_properties,
+                                    THIS_MODULE, NULL, adapter_nr))
                return 0;
 
        return -ENODEV;
index 35ab68f6dcf6346e5748e775c95a722c478295e5..6b7b2a89242e797d9bbe0c959ddef57515a25a8f 100644 (file)
@@ -40,7 +40,8 @@ extern int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap);
 extern int dvb_usb_i2c_init(struct dvb_usb_device *);
 extern int dvb_usb_i2c_exit(struct dvb_usb_device *);
 
-extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap);
+extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap,
+                                   short *adapter_nums);
 extern int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap);
 extern int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap);
 extern int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap);
index 4561a672da924c70ab9ba121c056b4591b1f55e4..ce8cd0c5d83120b173ad5fa4950d1f43a8c0a585 100644 (file)
@@ -77,12 +77,13 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
        return dvb_usb_ctrl_feed(dvbdmxfeed,0);
 }
 
-int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap)
+int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums)
 {
-       int ret;
+       int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name,
+                                      adap->dev->owner, &adap->dev->udev->dev,
+                                      adapter_nums);
 
-       if ((ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name,
-                       adap->dev->owner, &adap->dev->udev->dev)) < 0) {
+       if (ret < 0) {
                deb_info("dvb_register_adapter failed: error %d", ret);
                goto err;
        }
index cdd717c3fe45ac79c099a49397d529cf0ffdda5c..e331db8c77b210125c72f4cb475e4c71c9ca8798 100644 (file)
@@ -26,7 +26,7 @@ static int dvb_usb_force_pid_filter_usage;
 module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444);
 MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0).");
 
-static int dvb_usb_adapter_init(struct dvb_usb_device *d)
+static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
 {
        struct dvb_usb_adapter *adap;
        int ret,n;
@@ -72,7 +72,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d)
                }
 
                if ((ret = dvb_usb_adapter_stream_init(adap)) ||
-                       (ret = dvb_usb_adapter_dvb_init(adap)) ||
+                       (ret = dvb_usb_adapter_dvb_init(adap, adapter_nrs)) ||
                        (ret = dvb_usb_adapter_frontend_init(adap))) {
                        return ret;
                }
@@ -122,7 +122,7 @@ static int dvb_usb_exit(struct dvb_usb_device *d)
        return 0;
 }
 
-static int dvb_usb_init(struct dvb_usb_device *d)
+static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums)
 {
        int ret = 0;
 
@@ -143,7 +143,7 @@ static int dvb_usb_init(struct dvb_usb_device *d)
        dvb_usb_device_power_ctrl(d, 1);
 
        if ((ret = dvb_usb_i2c_init(d)) ||
-               (ret = dvb_usb_adapter_init(d))) {
+               (ret = dvb_usb_adapter_init(d, adapter_nums))) {
                dvb_usb_exit(d);
                return ret;
        }
@@ -213,8 +213,10 @@ int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff)
 /*
  * USB
  */
-int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_properties
-               *props, struct module *owner,struct dvb_usb_device **du)
+int dvb_usb_device_init(struct usb_interface *intf,
+                       struct dvb_usb_device_properties *props,
+                       struct module *owner, struct dvb_usb_device **du,
+                       short *adapter_nums)
 {
        struct usb_device *udev = interface_to_usbdev(intf);
        struct dvb_usb_device *d = NULL;
@@ -254,7 +256,7 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_proper
        if (du != NULL)
                *du = d;
 
-       ret = dvb_usb_init(d);
+       ret = dvb_usb_init(d, adapter_nums);
 
        if (ret == 0)
                info("%s successfully initialized and connected.",desc->name);
index d1b3c7b81fffebad0da13a96406903d276db1d01..b1de0f7e26e8dce984c41bf6388ed6d2e932bd5d 100644 (file)
@@ -372,7 +372,10 @@ struct dvb_usb_device {
        void *priv;
 };
 
-extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_device_properties *, struct module *, struct dvb_usb_device **);
+extern int dvb_usb_device_init(struct usb_interface *,
+                              struct dvb_usb_device_properties *,
+                              struct module *, struct dvb_usb_device **,
+                              short *adapter_nums);
 extern void dvb_usb_device_exit(struct usb_interface *);
 
 /* the generic read/write method for device control */
index 6b99d9f4d5b35846892f023998d903aafdc8caa5..0a8ac64a4e33a6a345cd6eea538b7397a33c6536 100644 (file)
@@ -16,6 +16,8 @@ static int dvb_usb_gl861_debug;
 module_param_named(debug,dvb_usb_gl861_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
                         u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
 {
@@ -140,7 +142,9 @@ static int gl861_probe(struct usb_interface *intf,
        if (intf->num_altsetting < 2)
                return -ENODEV;
 
-       if ((ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d)) == 0) {
+       ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d,
+                                 adapter_nr);
+       if (ret == 0) {
                alt = usb_altnum_to_altsetting(intf, 0);
 
                if (alt == NULL) {
index 83e8535014c6d092fc08f5c91e0963f31408dca2..9a942afaf0af8d1a3c16cf9e5681656d3c1eca72 100644 (file)
@@ -22,6 +22,8 @@ int dvb_usb_gp8psk_debug;
 module_param_named(debug,dvb_usb_gp8psk_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen)
 {
        int ret = 0,try = 0;
@@ -190,7 +192,8 @@ static int gp8psk_usb_probe(struct usb_interface *intf,
 {
        int ret;
        struct usb_device *udev = interface_to_usbdev(intf);
-       ret =  dvb_usb_device_init(intf,&gp8psk_properties,THIS_MODULE,NULL);
+       ret = dvb_usb_device_init(intf, &gp8psk_properties,
+                                 THIS_MODULE, NULL, adapter_nr);
        if (ret == 0) {
                info("found Genpix USB device pID = %x (hex)",
                        le16_to_cpu(udev->descriptor.idProduct));
index 29ec2b9677427088a6d22ff518ca21c37180ae32..a12e6f784fdae92aade0f2b08040f93948206155 100644 (file)
@@ -22,6 +22,8 @@ static int dvb_usb_m920x_debug;
 module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid);
 
 static inline int m920x_read(struct usb_device *udev, u8 request, u16 value,
@@ -618,27 +620,31 @@ static int m920x_probe(struct usb_interface *intf,
                 * multi-tuner device
                 */
 
-               if ((ret = dvb_usb_device_init(intf, &megasky_properties,
-                                              THIS_MODULE, &d)) == 0) {
+               ret = dvb_usb_device_init(intf, &megasky_properties,
+                                         THIS_MODULE, &d, adapter_nr);
+               if (ret == 0) {
                        rc_init_seq = megasky_rc_init;
                        goto found;
                }
 
-               if ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
-                                              THIS_MODULE, &d)) == 0) {
+               ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
+                                         THIS_MODULE, &d, adapter_nr);
+               if (ret == 0) {
                        /* No remote control, so no rc_init_seq */
                        goto found;
                }
 
                /* This configures both tuners on the TV Walker Twin */
-               if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
-                                              THIS_MODULE, &d)) == 0) {
+               ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
+                                         THIS_MODULE, &d, adapter_nr);
+               if (ret == 0) {
                        rc_init_seq = tvwalkertwin_rc_init;
                        goto found;
                }
 
-               if ((ret = dvb_usb_device_init(intf, &dposh_properties,
-                                              THIS_MODULE, &d)) == 0) {
+               ret = dvb_usb_device_init(intf, &dposh_properties,
+                                         THIS_MODULE, &d, adapter_nr);
+               if (ret == 0) {
                        /* Remote controller not supported yet. */
                        goto found;
                }
index badc468170ea615aff5a0eaa2332cd6559db4f09..07fb843c7c2b22d35b4a977dd405e2b6d5e97ab7 100644 (file)
@@ -15,6 +15,8 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc,2=eeprom (|-able))." DVB_USB_DEBUG_STATUS);
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define deb_rc(args...) dprintk(debug,0x01,args)
 #define deb_ee(args...) dprintk(debug,0x02,args)
 
@@ -142,7 +144,8 @@ static struct dvb_usb_device_properties nova_t_properties;
 static int nova_t_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       return dvb_usb_device_init(intf,&nova_t_properties,THIS_MODULE,NULL);
+       return dvb_usb_device_init(intf, &nova_t_properties,
+                                  THIS_MODULE, NULL, adapter_nr);
 }
 
 /* do not change the order of the ID table */
index 302cc67407c397e17091bc729c078e9d63f54031..0eef5fe094e13cb2085ad565e512af363fa868e5 100644 (file)
@@ -46,6 +46,9 @@ MODULE_PARM_DESC(debug,
                 "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64 (or-able))."
                 DVB_USB_DEBUG_STATUS);
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
+
 static int opera1_xilinx_rw(struct usb_device *dev, u8 request, u16 value,
                            u8 * data, u16 len, int flags)
 {
@@ -548,7 +551,8 @@ static int opera1_probe(struct usb_interface *intf,
                return -EINVAL;
        }
 
-       if (dvb_usb_device_init(intf, &opera1_properties, THIS_MODULE, NULL) != 0)
+       if (0 != dvb_usb_device_init(intf, &opera1_properties,
+                                    THIS_MODULE, NULL, adapter_nr))
                return -EINVAL;
        return 0;
 }
index 0eb33378254b3bfbf7cb56ee7add099b1d02b75c..706687c78506e8d34a7231671bf7107bac431b15 100644 (file)
@@ -37,6 +37,8 @@ static int dvb_usb_ttusb2_debug;
 module_param_named(debug,dvb_usb_ttusb2_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))." DVB_USB_DEBUG_STATUS);
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 struct ttusb2_state {
        u8 id;
 };
@@ -181,8 +183,10 @@ static struct dvb_usb_device_properties ttusb2_properties_s2400;
 static int ttusb2_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       if (dvb_usb_device_init(intf, &ttusb2_properties, THIS_MODULE, NULL) == 0 ||
-               dvb_usb_device_init(intf, &ttusb2_properties_s2400, THIS_MODULE, NULL) == 0)
+       if (0 == dvb_usb_device_init(intf, &ttusb2_properties,
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0 == dvb_usb_device_init(intf, &ttusb2_properties_s2400,
+                                    THIS_MODULE, NULL, adapter_nr))
                return 0;
        return -ENODEV;
 }
index 0dcab3d4e2362bcfd5f1862a236aa56f4b94b920..9e7653bb3b660bc4c44985db551cf94e0f65ee5e 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "mt352.h"
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 static int umt_mt352_demod_init(struct dvb_frontend *fe)
 {
        static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d };
@@ -75,7 +77,8 @@ static struct dvb_usb_device_properties umt_properties;
 static int umt_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       if (dvb_usb_device_init(intf,&umt_properties,THIS_MODULE,NULL) == 0)
+       if (0 == dvb_usb_device_init(intf, &umt_properties,
+                                    THIS_MODULE, NULL, adapter_nr))
                return 0;
        return -EINVAL;
 }
index e553c139ac44947abbc4ad010564ec4ec8bdcb6d..986fff9a5ba81580c6a40bcbfb2bd13100b0dddb 100644 (file)
@@ -21,6 +21,8 @@ int dvb_usb_vp702x_debug;
 module_param_named(debug,dvb_usb_vp702x_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 struct vp702x_state {
        int pid_filter_count;
        int pid_filter_can_bypass;
@@ -238,7 +240,8 @@ static struct dvb_usb_device_properties vp702x_properties;
 static int vp702x_usb_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       return dvb_usb_device_init(intf,&vp702x_properties,THIS_MODULE,NULL);
+       return dvb_usb_device_init(intf, &vp702x_properties,
+                                  THIS_MODULE, NULL, adapter_nr);
 }
 
 static struct usb_device_id vp702x_usb_table [] = {
index c172babf59bbf5d850c41dcb2eacd083887ce4ce..acb345504e0da0cbd8d3c2d3541a1a5a092a6def 100644 (file)
@@ -18,6 +18,9 @@
 static int dvb_usb_vp7045_debug;
 module_param_named(debug,dvb_usb_vp7045_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define deb_info(args...) dprintk(dvb_usb_vp7045_debug,0x01,args)
 #define deb_xfer(args...) dprintk(dvb_usb_vp7045_debug,0x02,args)
 #define deb_rc(args...)   dprintk(dvb_usb_vp7045_debug,0x04,args)
@@ -219,7 +222,8 @@ static struct dvb_usb_device_properties vp7045_properties;
 static int vp7045_usb_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       return dvb_usb_device_init(intf,&vp7045_properties,THIS_MODULE,NULL);
+       return dvb_usb_device_init(intf, &vp7045_properties,
+                                  THIS_MODULE, NULL, adapter_nr);
 }
 
 static struct usb_device_id vp7045_usb_table [] = {
index 08a2599ed74a7463293ae0e8858642fd6b495d84..960ed5763ae1300f929538210bdbb509d36c4be0 100644 (file)
@@ -39,6 +39,8 @@
 #include "dvbdev.h"
 #include "tda1004x.h"
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define DRIVER_NAME            "pluto2"
 
 #define REG_PIDn(n)            ((n) << 2)      /* PID n pattern registers */
@@ -662,7 +664,8 @@ static int __devinit pluto2_probe(struct pci_dev *pdev,
                goto err_pluto_hw_exit;
 
        /* dvb */
-       ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE, &pdev->dev);
+       ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME,
+                                  THIS_MODULE, &pdev->dev, adapter_nr);
        if (ret < 0)
                goto err_i2c_del_adapter;
 
index 78919b9e14dccd4b493093c8f4c78fd257827345..747e7f1a6267be0a9d3d9cf4eb1d4766c97691b5 100644 (file)
@@ -112,6 +112,8 @@ MODULE_PARM_DESC(wss_cfg_16_9, "WSS 16:9 - default 0x0007 - bit 15: disable, 14:
 module_param(tv_standard, int, 0444);
 MODULE_PARM_DESC(tv_standard, "TV standard: 0 PAL (default), 1 NTSC");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 static void restart_feeds(struct av7110 *av7110);
 
 static int av7110_num;
@@ -2461,7 +2463,7 @@ static int __devinit av7110_attach(struct saa7146_dev* dev,
                goto err_kfree_0;
 
        ret = dvb_register_adapter(&av7110->dvb_adapter, av7110->card_name,
-                                  THIS_MODULE, &dev->pci->dev);
+                                  THIS_MODULE, &dev->pci->dev, adapter_nr);
        if (ret < 0)
                goto err_put_firmware_1;
 
index 06bbce42fcd740d488122d2943c7ddb77213b940..18cac4b12ab28f73fb97a25f219788438b703bee 100644 (file)
@@ -57,6 +57,8 @@ module_param_named(bufsize, dma_buffer_size, int, 0444);
 MODULE_PARM_DESC(debug, "Turn on/off budget debugging (default:off).");
 MODULE_PARM_DESC(bufsize, "DMA buffer size in KB, default: 188, min: 188, max: 1410 (Activy: 564)");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 /****************************************************************************
  * TT budget / WinTV Nova
  ****************************************************************************/
@@ -471,9 +473,10 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
                budget->buffer_width, budget->buffer_height);
        printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size);
 
-       if ((ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, owner, &budget->dev->pci->dev)) < 0) {
+       ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name,
+                                  owner, &budget->dev->pci->dev, adapter_nr);
+       if (ret < 0)
                return ret;
-       }
 
        /* set dd1 stream a & b */
        saa7146_write(dev, DD1_STREAM_B, 0x00000000);
index 317eccbe5c663ffe9d4a83ccf752f9c40db3d340..46dc4a3fcb6c7c208b521c0f653a55a2bfbadbf3 100644 (file)
 */
 
 static int debug;
-
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0)
 
 #define ISO_BUF_COUNT      4
@@ -1669,7 +1670,10 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
 
        mutex_unlock(&ttusb->semi2c);
 
-       if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE, &udev->dev)) < 0) {
+       result = dvb_register_adapter(&ttusb->adapter,
+                                     "Technotrend/Hauppauge Nova-USB",
+                                     THIS_MODULE, &udev->dev, adapter_nr);
+       if (result < 0) {
                ttusb_free_iso_urbs(ttusb);
                kfree(ttusb);
                return result;
index 95110c4833126d4ad7d03f077769769a3cf5f5fd..42eee04daa5da4407c4d383982aeffbf51c1f15c 100644 (file)
@@ -52,6 +52,8 @@ MODULE_PARM_DESC(output_pva, "Output PVA from dvr device (default:off)");
 module_param(enable_rc, int, 0644);
 MODULE_PARM_DESC(enable_rc, "Turn on/off IR remote control(default: off)");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define dprintk        if (debug) printk
 
 #define DRIVER_NAME            "TechnoTrend/Hauppauge DEC USB"
@@ -1437,7 +1439,9 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec)
        dprintk("%s\n", __func__);
 
        if ((result = dvb_register_adapter(&dec->adapter,
-                                          dec->model_name, THIS_MODULE, &dec->udev->dev)) < 0) {
+                                          dec->model_name, THIS_MODULE,
+                                          &dec->udev->dev,
+                                          adapter_nr)) < 0) {
                printk("%s: dvb_register_adapter failed: error %d\n",
                       __func__, result);
 
index 74baa28d16ab3fb42ad8a923e936b0dbb294dc77..1a720abbd066bbe02e2cf9bc1e744ccc1bfbf0a2 100644 (file)
@@ -54,6 +54,8 @@ static unsigned int alt_tuner;
 module_param(alt_tuner, int, 0644);
 MODULE_PARM_DESC(alt_tuner, "Enable alternate tuner configuration");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 /* ------------------------------------------------------------------ */
 
 static int dvb_buf_setup(struct videobuf_queue *q,
@@ -333,7 +335,7 @@ static int dvb_register(struct cx23885_tsport *port)
 
        /* register everything */
        return videobuf_dvb_register(&port->dvb, THIS_MODULE, port,
-                                    &dev->pci->dev);
+                                    &dev->pci->dev, adapter_nr);
 }
 
 int cx23885_dvb_register(struct cx23885_tsport *port)
index e83d9869e68ba05351659c1e66a4199e36f54b50..fda7334d934b64a00797fad99e20fc207e0cf89f 100644 (file)
@@ -58,6 +58,8 @@ static unsigned int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug,"enable debug messages [dvb]");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define dprintk(level,fmt, arg...)     if (debug >= level) \
        printk(KERN_DEBUG "%s/2-dvb: " fmt, core->name, ## arg)
 
@@ -862,7 +864,8 @@ static int dvb_register(struct cx8802_dev *dev)
        cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL);
 
        /* register everything */
-       return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev);
+       return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev,
+                                    &dev->pci->dev, adapter_nr);
 }
 
 /* ----------------------------------------------------------- */
index e5c3569dd2c831bc6f9eeaf4eb97f616b5769c0e..73154c1a0239cf7aef24290ac621a5ff60a3e632 100644 (file)
@@ -65,6 +65,8 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off module debugging (default:off).");
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 #define dprintk(fmt, arg...)   do { if (debug) \
        printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg); } while(0)
 
@@ -1257,7 +1259,8 @@ static int dvb_init(struct saa7134_dev *dev)
        }
 
        /* register everything else */
-       ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev);
+       ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev,
+                                   adapter_nr);
 
        /* this sequence is necessary to make the tda1004x load its firmware
         * and to enter analog mode of hybrid boards
index 4ba8b7db7fda6fc5da831f64aa55766ac8b923c1..0f8542a4c71a333facc4f9f56aa4cebf78400168 100644 (file)
@@ -138,14 +138,16 @@ static int videobuf_dvb_stop_feed(struct dvb_demux_feed *feed)
 int videobuf_dvb_register(struct videobuf_dvb *dvb,
                          struct module *module,
                          void *adapter_priv,
-                         struct device *device)
+                         struct device *device,
+                         short *adapter_nr)
 {
        int result;
 
        mutex_init(&dvb->lock);
 
        /* register adapter */
-       result = dvb_register_adapter(&dvb->adapter, dvb->name, module, device);
+       result = dvb_register_adapter(&dvb->adapter, dvb->name, module, device,
+                                     adapter_nr);
        if (result < 0) {
                printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n",
                       dvb->name, result);
index 8233cafdeef6de74970ed18f752294e42005c525..b777486963292443ebd9ed9e07b732d34a997ffe 100644 (file)
@@ -27,7 +27,8 @@ struct videobuf_dvb {
 int videobuf_dvb_register(struct videobuf_dvb *dvb,
                          struct module *module,
                          void *adapter_priv,
-                         struct device *device);
+                         struct device *device,
+                         short *adapter_nr);
 void videobuf_dvb_unregister(struct videobuf_dvb *dvb);
 
 /*