aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorJanne Grunau <janne-dvb@grunau.be>2008-04-09 18:13:13 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:08:00 -0400
commit78e92006f410a4044f8c1760c25ac9d11d259aa2 (patch)
tree293de8abe261420df2db5e12936ec2721ea52c7c /drivers/media/dvb
parent9950c1b5b4b86d4aae12853c2f0a0ef11d976764 (diff)
V4L/DVB (7538): Adds selectable adapter numbers as per module option
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>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/b2c2/flexcop.c8
-rw-r--r--drivers/media/dvb/bt8xx/dvb-bt8xx.c7
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c7
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c41
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.h13
-rw-r--r--drivers/media/dvb/dvb-usb/a800.c6
-rw-r--r--drivers/media/dvb/dvb-usb/af9005.c5
-rw-r--r--drivers/media/dvb/dvb-usb/au6610.c6
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c29
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c5
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-mb.c14
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-mc.c5
-rw-r--r--drivers/media/dvb/dvb-usb/digitv.c8
-rw-r--r--drivers/media/dvb/dvb-usb/dtt200u.c17
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-common.h3
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-dvb.c9
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-init.c16
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h5
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.c6
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.c5
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.c22
-rw-r--r--drivers/media/dvb/dvb-usb/nova-t-usb2.c5
-rw-r--r--drivers/media/dvb/dvb-usb/opera1.c6
-rw-r--r--drivers/media/dvb/dvb-usb/ttusb2.c8
-rw-r--r--drivers/media/dvb/dvb-usb/umt-010.c5
-rw-r--r--drivers/media/dvb/dvb-usb/vp702x.c5
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045.c6
-rw-r--r--drivers/media/dvb/pluto2/pluto2.c5
-rw-r--r--drivers/media/dvb/ttpci/av7110.c4
-rw-r--r--drivers/media/dvb/ttpci/budget-core.c7
-rw-r--r--drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c8
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusb_dec.c6
32 files changed, 225 insertions, 77 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c
index 205146c24129..5f79c8dc3836 100644
--- a/drivers/media/dvb/b2c2/flexcop.c
+++ b/drivers/media/dvb/b2c2/flexcop.c
@@ -49,6 +49,8 @@ module_param_named(debug, b2c2_flexcop_debug, int, 0644);
49MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))." DEBSTATUS); 49MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))." DEBSTATUS);
50#undef DEBSTATUS 50#undef DEBSTATUS
51 51
52DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
53
52/* global zero for ibi values */ 54/* global zero for ibi values */
53flexcop_ibi_value ibi_zero; 55flexcop_ibi_value ibi_zero;
54 56
@@ -66,8 +68,10 @@ static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
66 68
67static int flexcop_dvb_init(struct flexcop_device *fc) 69static int flexcop_dvb_init(struct flexcop_device *fc)
68{ 70{
69 int ret; 71 int ret = dvb_register_adapter(&fc->dvb_adapter,
70 if ((ret = dvb_register_adapter(&fc->dvb_adapter,"FlexCop Digital TV device",fc->owner,fc->dev)) < 0) { 72 "FlexCop Digital TV device", fc->owner,
73 fc->dev, adapter_nr);
74 if (ret < 0) {
71 err("error registering DVB adapter"); 75 err("error registering DVB adapter");
72 return ret; 76 return ret;
73 } 77 }
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index a39439b5f04c..6afbfbbef0ce 100644
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -40,6 +40,8 @@ static int debug;
40module_param(debug, int, 0644); 40module_param(debug, int, 0644);
41MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); 41MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
42 42
43DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
44
43#define dprintk( args... ) \ 45#define dprintk( args... ) \
44 do { \ 46 do { \
45 if (debug) printk(KERN_DEBUG args); \ 47 if (debug) printk(KERN_DEBUG args); \
@@ -717,7 +719,10 @@ static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
717{ 719{
718 int result; 720 int result;
719 721
720 if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE, &card->bt->dev->dev)) < 0) { 722 result = dvb_register_adapter(&card->dvb_adapter, card->card_name,
723 THIS_MODULE, &card->bt->dev->dev,
724 adapter_nr);
725 if (result < 0) {
721 printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result); 726 printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result);
722 return result; 727 return result;
723 } 728 }
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index 29b2459e0b21..f5010e8671b8 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -58,6 +58,8 @@ static int debug;
58module_param_named(debug, debug, int, 0644); 58module_param_named(debug, debug, int, 0644);
59MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); 59MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
60 60
61DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
62
61#define dprintk(level, args...) \ 63#define dprintk(level, args...) \
62do { \ 64do { \
63 if ((debug & level)) { \ 65 if ((debug & level)) { \
@@ -938,7 +940,10 @@ static int cinergyt2_probe (struct usb_interface *intf,
938 return -ENOMEM; 940 return -ENOMEM;
939 } 941 }
940 942
941 if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE, &cinergyt2->udev->dev)) < 0) { 943 err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME,
944 THIS_MODULE, &cinergyt2->udev->dev,
945 adapter_nr);
946 if (err < 0) {
942 kfree(cinergyt2); 947 kfree(cinergyt2);
943 return err; 948 return err;
944 } 949 }
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 0a2897bc9873..8b56d929f7fd 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -49,7 +49,6 @@ static const char * const dnames[] = {
49 "net", "osd" 49 "net", "osd"
50}; 50};
51 51
52#define DVB_MAX_ADAPTERS 8
53#define DVB_MAX_IDS 4 52#define DVB_MAX_IDS 4
54#define nums2minor(num,type,id) ((num << 6) | (id << 4) | type) 53#define nums2minor(num,type,id) ((num << 6) | (id << 4) | type)
55#define MAX_DVB_MINORS (DVB_MAX_ADAPTERS*64) 54#define MAX_DVB_MINORS (DVB_MAX_ADAPTERS*64)
@@ -262,18 +261,25 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
262} 261}
263EXPORT_SYMBOL(dvb_unregister_device); 262EXPORT_SYMBOL(dvb_unregister_device);
264 263
264static int dvbdev_check_free_adapter_num(int num)
265{
266 struct list_head *entry;
267 list_for_each(entry, &dvb_adapter_list) {
268 struct dvb_adapter *adap;
269 adap = list_entry(entry, struct dvb_adapter, list_head);
270 if (adap->num == num)
271 return 0;
272 }
273 return 1;
274}
265 275
266static int dvbdev_get_free_adapter_num (void) 276static int dvbdev_get_free_adapter_num (void)
267{ 277{
268 int num = 0; 278 int num = 0;
269 279
270 while (num < DVB_MAX_ADAPTERS) { 280 while (num < DVB_MAX_ADAPTERS) {
271 struct dvb_adapter *adap; 281 if (dvbdev_check_free_adapter_num(num))
272 list_for_each_entry(adap, &dvb_adapter_list, list_head) 282 return num;
273 if (adap->num == num)
274 goto skip;
275 return num;
276skip:
277 num++; 283 num++;
278 } 284 }
279 285
@@ -281,13 +287,28 @@ skip:
281} 287}
282 288
283 289
284int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct module *module, struct device *device) 290int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
291 struct module *module, struct device *device,
292 short *adapter_nums)
285{ 293{
286 int num; 294 int i, num;
287 295
288 mutex_lock(&dvbdev_register_lock); 296 mutex_lock(&dvbdev_register_lock);
289 297
290 if ((num = dvbdev_get_free_adapter_num ()) < 0) { 298 for (i = 0; i < DVB_MAX_ADAPTERS; ++i) {
299 num = adapter_nums[i];
300 if (num >= 0 && num < DVB_MAX_ADAPTERS) {
301 /* use the one the driver asked for */
302 if (dvbdev_check_free_adapter_num(num))
303 break;
304 } else {
305 num = dvbdev_get_free_adapter_num();
306 break;
307 }
308 num = -1;
309 }
310
311 if (num < 0) {
291 mutex_unlock(&dvbdev_register_lock); 312 mutex_unlock(&dvbdev_register_lock);
292 return -ENFILE; 313 return -ENFILE;
293 } 314 }
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h
index 6dff10ebf470..5f9a737c6de1 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.h
+++ b/drivers/media/dvb/dvb-core/dvbdev.h
@@ -31,6 +31,10 @@
31 31
32#define DVB_MAJOR 212 32#define DVB_MAJOR 212
33 33
34#define DVB_MAX_ADAPTERS 8
35
36#define DVB_UNSET (-1)
37
34#define DVB_DEVICE_VIDEO 0 38#define DVB_DEVICE_VIDEO 0
35#define DVB_DEVICE_AUDIO 1 39#define DVB_DEVICE_AUDIO 1
36#define DVB_DEVICE_SEC 2 40#define DVB_DEVICE_SEC 2
@@ -41,6 +45,11 @@
41#define DVB_DEVICE_NET 7 45#define DVB_DEVICE_NET 7
42#define DVB_DEVICE_OSD 8 46#define DVB_DEVICE_OSD 8
43 47
48#define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
49 static short adapter_nr[] = \
50 {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
51 module_param_array(adapter_nr, short, NULL, 0444); \
52 MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
44 53
45struct dvb_adapter { 54struct dvb_adapter {
46 int num; 55 int num;
@@ -78,7 +87,9 @@ struct dvb_device {
78}; 87};
79 88
80 89
81extern int dvb_register_adapter (struct dvb_adapter *adap, const char *name, struct module *module, struct device *device); 90extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
91 struct module *module, struct device *device,
92 short *adapter_nums);
82extern int dvb_unregister_adapter (struct dvb_adapter *adap); 93extern int dvb_unregister_adapter (struct dvb_adapter *adap);
83 94
84extern int dvb_register_device (struct dvb_adapter *adap, 95extern int dvb_register_device (struct dvb_adapter *adap,
diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c
index a6c5f19f680d..dc8c8784caa8 100644
--- a/drivers/media/dvb/dvb-usb/a800.c
+++ b/drivers/media/dvb/dvb-usb/a800.c
@@ -18,6 +18,9 @@
18static int debug; 18static int debug;
19module_param(debug, int, 0644); 19module_param(debug, int, 0644);
20MODULE_PARM_DESC(debug, "set debugging level (rc=1 (or-able))." DVB_USB_DEBUG_STATUS); 20MODULE_PARM_DESC(debug, "set debugging level (rc=1 (or-able))." DVB_USB_DEBUG_STATUS);
21
22DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
23
21#define deb_rc(args...) dprintk(debug,0x01,args) 24#define deb_rc(args...) dprintk(debug,0x01,args)
22 25
23static int a800_power_ctrl(struct dvb_usb_device *d, int onoff) 26static int a800_power_ctrl(struct dvb_usb_device *d, int onoff)
@@ -94,7 +97,8 @@ static struct dvb_usb_device_properties a800_properties;
94static int a800_probe(struct usb_interface *intf, 97static int a800_probe(struct usb_interface *intf,
95 const struct usb_device_id *id) 98 const struct usb_device_id *id)
96{ 99{
97 return dvb_usb_device_init(intf,&a800_properties,THIS_MODULE,NULL); 100 return dvb_usb_device_init(intf, &a800_properties,
101 THIS_MODULE, NULL, adapter_nr);
98} 102}
99 103
100/* do not change the order of the ID table */ 104/* do not change the order of the ID table */
diff --git a/drivers/media/dvb/dvb-usb/af9005.c b/drivers/media/dvb/dvb-usb/af9005.c
index e7f76f515b4f..cfe71feefcad 100644
--- a/drivers/media/dvb/dvb-usb/af9005.c
+++ b/drivers/media/dvb/dvb-usb/af9005.c
@@ -39,6 +39,8 @@ int dvb_usb_af9005_dump_eeprom = 0;
39module_param_named(dump_eeprom, dvb_usb_af9005_dump_eeprom, int, 0); 39module_param_named(dump_eeprom, dvb_usb_af9005_dump_eeprom, int, 0);
40MODULE_PARM_DESC(dump_eeprom, "dump contents of the eeprom."); 40MODULE_PARM_DESC(dump_eeprom, "dump contents of the eeprom.");
41 41
42DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
43
42/* remote control decoder */ 44/* remote control decoder */
43int (*rc_decode) (struct dvb_usb_device * d, u8 * data, int len, u32 * event, 45int (*rc_decode) (struct dvb_usb_device * d, u8 * data, int len, u32 * event,
44 int *state); 46 int *state);
@@ -1020,7 +1022,8 @@ static struct dvb_usb_device_properties af9005_properties;
1020static int af9005_usb_probe(struct usb_interface *intf, 1022static int af9005_usb_probe(struct usb_interface *intf,
1021 const struct usb_device_id *id) 1023 const struct usb_device_id *id)
1022{ 1024{
1023 return dvb_usb_device_init(intf, &af9005_properties, THIS_MODULE, NULL); 1025 return dvb_usb_device_init(intf, &af9005_properties,
1026 THIS_MODULE, NULL, adapter_nr);
1024} 1027}
1025 1028
1026static struct usb_device_id af9005_usb_table[] = { 1029static struct usb_device_id af9005_usb_table[] = {
diff --git a/drivers/media/dvb/dvb-usb/au6610.c b/drivers/media/dvb/dvb-usb/au6610.c
index f3ff81314696..2ccb90fa60c8 100644
--- a/drivers/media/dvb/dvb-usb/au6610.c
+++ b/drivers/media/dvb/dvb-usb/au6610.c
@@ -19,6 +19,8 @@ static int dvb_usb_au6610_debug;
19module_param_named(debug, dvb_usb_au6610_debug, int, 0644); 19module_param_named(debug, dvb_usb_au6610_debug, int, 0644);
20MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 20MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
21 21
22DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
23
22static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr, 24static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
23 u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) 25 u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
24{ 26{
@@ -163,7 +165,9 @@ static int au6610_probe(struct usb_interface *intf,
163 if (intf->num_altsetting < AU6610_ALTSETTING_COUNT) 165 if (intf->num_altsetting < AU6610_ALTSETTING_COUNT)
164 return -ENODEV; 166 return -ENODEV;
165 167
166 if ((ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d)) == 0) { 168 ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d,
169 adapter_nr);
170 if (ret == 0) {
167 alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING); 171 alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING);
168 172
169 if (alt == NULL) { 173 if (alt == NULL) {
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 4e5118dfe2e0..c4b00660c65f 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -40,6 +40,9 @@
40static int dvb_usb_cxusb_debug; 40static int dvb_usb_cxusb_debug;
41module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); 41module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
42MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 42MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
43
44DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
45
43#define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) 46#define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args)
44#define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \ 47#define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \
45 dprintk(dvb_usb_cxusb_debug,0x01,args) 48 dprintk(dvb_usb_cxusb_debug,0x01,args)
@@ -723,16 +726,24 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
723static int cxusb_probe(struct usb_interface *intf, 726static int cxusb_probe(struct usb_interface *intf,
724 const struct usb_device_id *id) 727 const struct usb_device_id *id)
725{ 728{
726 if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 || 729 if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
727 dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 || 730 THIS_MODULE, NULL, adapter_nr) ||
728 dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 || 731 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
729 dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 || 732 THIS_MODULE, NULL, adapter_nr) ||
730 dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0 || 733 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
731 dvb_usb_device_init(intf,&cxusb_bluebird_dualdig4_properties,THIS_MODULE,NULL) == 0 || 734 THIS_MODULE, NULL, adapter_nr) ||
732 dvb_usb_device_init(intf,&cxusb_bluebird_nano2_properties,THIS_MODULE,NULL) == 0 || 735 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
733 dvb_usb_device_init(intf,&cxusb_bluebird_nano2_needsfirmware_properties,THIS_MODULE,NULL) == 0) { 736 THIS_MODULE, NULL, adapter_nr) ||
737 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
738 THIS_MODULE, NULL, adapter_nr) ||
739 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
740 THIS_MODULE, NULL, adapter_nr) ||
741 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
742 THIS_MODULE, NULL, adapter_nr) ||
743 0 == dvb_usb_device_init(intf,
744 &cxusb_bluebird_nano2_needsfirmware_properties,
745 THIS_MODULE, NULL, adapter_nr))
734 return 0; 746 return 0;
735 }
736 747
737 return -EINVAL; 748 return -EINVAL;
738} 749}
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
index 4b3836e63be9..595a04696c87 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_core.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -17,6 +17,8 @@ int dvb_usb_dib0700_ir_proto = 1;
17module_param(dvb_usb_dib0700_ir_proto, int, 0644); 17module_param(dvb_usb_dib0700_ir_proto, int, 0644);
18MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, "set ir protocol (0=NEC, 1=RC5 (default), 2=RC6)."); 18MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, "set ir protocol (0=NEC, 1=RC5 (default), 2=RC6).");
19 19
20DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
21
20/* expecting rx buffer: request data[0] data[1] ... data[2] */ 22/* expecting rx buffer: request data[0] data[1] ... data[2] */
21static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen) 23static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
22{ 24{
@@ -279,7 +281,8 @@ static int dib0700_probe(struct usb_interface *intf,
279 struct dvb_usb_device *dev; 281 struct dvb_usb_device *dev;
280 282
281 for (i = 0; i < dib0700_device_count; i++) 283 for (i = 0; i < dib0700_device_count; i++)
282 if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE, &dev) == 0) 284 if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE,
285 &dev, adapter_nr) == 0)
283 { 286 {
284 dib0700_rc_setup(dev); 287 dib0700_rc_setup(dev);
285 return 0; 288 return 0;
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c
index 043cadae0859..eeef50bff4f9 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-mb.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c
@@ -14,6 +14,8 @@
14 */ 14 */
15#include "dibusb.h" 15#include "dibusb.h"
16 16
17DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
18
17static int dib3000mb_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) 19static int dib3000mb_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
18{ 20{
19 struct dvb_usb_adapter *adap = fe->dvb->priv; 21 struct dvb_usb_adapter *adap = fe->dvb->priv;
@@ -107,10 +109,14 @@ static struct dvb_usb_device_properties artec_t1_usb2_properties;
107static int dibusb_probe(struct usb_interface *intf, 109static int dibusb_probe(struct usb_interface *intf,
108 const struct usb_device_id *id) 110 const struct usb_device_id *id)
109{ 111{
110 if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE,NULL) == 0 || 112 if (0 == dvb_usb_device_init(intf, &dibusb1_1_properties,
111 dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE,NULL) == 0 || 113 THIS_MODULE, NULL, adapter_nr) ||
112 dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE,NULL) == 0 || 114 0 == dvb_usb_device_init(intf, &dibusb1_1_an2235_properties,
113 dvb_usb_device_init(intf,&artec_t1_usb2_properties,THIS_MODULE,NULL) == 0) 115 THIS_MODULE, NULL, adapter_nr) ||
116 0 == dvb_usb_device_init(intf, &dibusb2_0b_properties,
117 THIS_MODULE, NULL, adapter_nr) ||
118 0 == dvb_usb_device_init(intf, &artec_t1_usb2_properties,
119 THIS_MODULE, NULL, adapter_nr))
114 return 0; 120 return 0;
115 121
116 return -EINVAL; 122 return -EINVAL;
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c
index e7ea3e753d6d..059cec955318 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-mc.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c
@@ -14,13 +14,16 @@
14 */ 14 */
15#include "dibusb.h" 15#include "dibusb.h"
16 16
17DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
18
17/* USB Driver stuff */ 19/* USB Driver stuff */
18static struct dvb_usb_device_properties dibusb_mc_properties; 20static struct dvb_usb_device_properties dibusb_mc_properties;
19 21
20static int dibusb_mc_probe(struct usb_interface *intf, 22static int dibusb_mc_probe(struct usb_interface *intf,
21 const struct usb_device_id *id) 23 const struct usb_device_id *id)
22{ 24{
23 return dvb_usb_device_init(intf,&dibusb_mc_properties,THIS_MODULE,NULL); 25 return dvb_usb_device_init(intf, &dibusb_mc_properties, THIS_MODULE,
26 NULL, adapter_nr);
24} 27}
25 28
26/* do not change the order of the ID table */ 29/* do not change the order of the ID table */
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c
index 3acbda4aa27e..b545cf3eab2e 100644
--- a/drivers/media/dvb/dvb-usb/digitv.c
+++ b/drivers/media/dvb/dvb-usb/digitv.c
@@ -20,6 +20,9 @@
20static int dvb_usb_digitv_debug; 20static int dvb_usb_digitv_debug;
21module_param_named(debug,dvb_usb_digitv_debug, int, 0644); 21module_param_named(debug,dvb_usb_digitv_debug, int, 0644);
22MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 22MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
23
24DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
25
23#define deb_rc(args...) dprintk(dvb_usb_digitv_debug,0x01,args) 26#define deb_rc(args...) dprintk(dvb_usb_digitv_debug,0x01,args)
24 27
25static int digitv_ctrl_msg(struct dvb_usb_device *d, 28static int digitv_ctrl_msg(struct dvb_usb_device *d,
@@ -256,8 +259,9 @@ static int digitv_probe(struct usb_interface *intf,
256 const struct usb_device_id *id) 259 const struct usb_device_id *id)
257{ 260{
258 struct dvb_usb_device *d; 261 struct dvb_usb_device *d;
259 int ret; 262 int ret = dvb_usb_device_init(intf, &digitv_properties, THIS_MODULE, &d,
260 if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) { 263 adapter_nr);
264 if (ret == 0) {
261 u8 b[4] = { 0 }; 265 u8 b[4] = { 0 };
262 266
263 if (d != NULL) { /* do that only when the firmware is loaded */ 267 if (d != NULL) { /* do that only when the firmware is loaded */
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c
index d86cf9bee91c..81a6cbf60160 100644
--- a/drivers/media/dvb/dvb-usb/dtt200u.c
+++ b/drivers/media/dvb/dvb-usb/dtt200u.c
@@ -18,6 +18,8 @@ int dvb_usb_dtt200u_debug;
18module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644); 18module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644);
19MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS); 19MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS);
20 20
21DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
22
21static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff) 23static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
22{ 24{
23 u8 b = SET_INIT; 25 u8 b = SET_INIT;
@@ -101,11 +103,16 @@ static struct dvb_usb_device_properties wt220u_miglia_properties;
101static int dtt200u_usb_probe(struct usb_interface *intf, 103static int dtt200u_usb_probe(struct usb_interface *intf,
102 const struct usb_device_id *id) 104 const struct usb_device_id *id)
103{ 105{
104 if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE,NULL) == 0 || 106 if (0 == dvb_usb_device_init(intf, &dtt200u_properties,
105 dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE,NULL) == 0 || 107 THIS_MODULE, NULL, adapter_nr) ||
106 dvb_usb_device_init(intf,&wt220u_fc_properties,THIS_MODULE,NULL) == 0 || 108 0 == dvb_usb_device_init(intf, &wt220u_properties,
107 dvb_usb_device_init(intf,&wt220u_zl0353_properties,THIS_MODULE,NULL) == 0 || 109 THIS_MODULE, NULL, adapter_nr) ||
108 dvb_usb_device_init(intf,&wt220u_miglia_properties,THIS_MODULE,NULL) == 0) 110 0 == dvb_usb_device_init(intf, &wt220u_fc_properties,
111 THIS_MODULE, NULL, adapter_nr) ||
112 0 == dvb_usb_device_init(intf, &wt220u_zl0353_properties,
113 THIS_MODULE, NULL, adapter_nr) ||
114 0 == dvb_usb_device_init(intf, &wt220u_miglia_properties,
115 THIS_MODULE, NULL, adapter_nr))
109 return 0; 116 return 0;
110 117
111 return -ENODEV; 118 return -ENODEV;
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-common.h b/drivers/media/dvb/dvb-usb/dvb-usb-common.h
index 35ab68f6dcf6..6b7b2a89242e 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-common.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-common.h
@@ -40,7 +40,8 @@ extern int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap);
40extern int dvb_usb_i2c_init(struct dvb_usb_device *); 40extern int dvb_usb_i2c_init(struct dvb_usb_device *);
41extern int dvb_usb_i2c_exit(struct dvb_usb_device *); 41extern int dvb_usb_i2c_exit(struct dvb_usb_device *);
42 42
43extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap); 43extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap,
44 short *adapter_nums);
44extern int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap); 45extern int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap);
45extern int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap); 46extern int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap);
46extern int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap); 47extern int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
index 4561a672da92..ce8cd0c5d831 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
@@ -77,12 +77,13 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
77 return dvb_usb_ctrl_feed(dvbdmxfeed,0); 77 return dvb_usb_ctrl_feed(dvbdmxfeed,0);
78} 78}
79 79
80int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap) 80int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums)
81{ 81{
82 int ret; 82 int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name,
83 adap->dev->owner, &adap->dev->udev->dev,
84 adapter_nums);
83 85
84 if ((ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name, 86 if (ret < 0) {
85 adap->dev->owner, &adap->dev->udev->dev)) < 0) {
86 deb_info("dvb_register_adapter failed: error %d", ret); 87 deb_info("dvb_register_adapter failed: error %d", ret);
87 goto err; 88 goto err;
88 } 89 }
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c
index cdd717c3fe45..e331db8c77b2 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c
@@ -26,7 +26,7 @@ static int dvb_usb_force_pid_filter_usage;
26module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444); 26module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444);
27MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0)."); 27MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0).");
28 28
29static int dvb_usb_adapter_init(struct dvb_usb_device *d) 29static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
30{ 30{
31 struct dvb_usb_adapter *adap; 31 struct dvb_usb_adapter *adap;
32 int ret,n; 32 int ret,n;
@@ -72,7 +72,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d)
72 } 72 }
73 73
74 if ((ret = dvb_usb_adapter_stream_init(adap)) || 74 if ((ret = dvb_usb_adapter_stream_init(adap)) ||
75 (ret = dvb_usb_adapter_dvb_init(adap)) || 75 (ret = dvb_usb_adapter_dvb_init(adap, adapter_nrs)) ||
76 (ret = dvb_usb_adapter_frontend_init(adap))) { 76 (ret = dvb_usb_adapter_frontend_init(adap))) {
77 return ret; 77 return ret;
78 } 78 }
@@ -122,7 +122,7 @@ static int dvb_usb_exit(struct dvb_usb_device *d)
122 return 0; 122 return 0;
123} 123}
124 124
125static int dvb_usb_init(struct dvb_usb_device *d) 125static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums)
126{ 126{
127 int ret = 0; 127 int ret = 0;
128 128
@@ -143,7 +143,7 @@ static int dvb_usb_init(struct dvb_usb_device *d)
143 dvb_usb_device_power_ctrl(d, 1); 143 dvb_usb_device_power_ctrl(d, 1);
144 144
145 if ((ret = dvb_usb_i2c_init(d)) || 145 if ((ret = dvb_usb_i2c_init(d)) ||
146 (ret = dvb_usb_adapter_init(d))) { 146 (ret = dvb_usb_adapter_init(d, adapter_nums))) {
147 dvb_usb_exit(d); 147 dvb_usb_exit(d);
148 return ret; 148 return ret;
149 } 149 }
@@ -213,8 +213,10 @@ int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff)
213/* 213/*
214 * USB 214 * USB
215 */ 215 */
216int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_properties 216int dvb_usb_device_init(struct usb_interface *intf,
217 *props, struct module *owner,struct dvb_usb_device **du) 217 struct dvb_usb_device_properties *props,
218 struct module *owner, struct dvb_usb_device **du,
219 short *adapter_nums)
218{ 220{
219 struct usb_device *udev = interface_to_usbdev(intf); 221 struct usb_device *udev = interface_to_usbdev(intf);
220 struct dvb_usb_device *d = NULL; 222 struct dvb_usb_device *d = NULL;
@@ -254,7 +256,7 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_proper
254 if (du != NULL) 256 if (du != NULL)
255 *du = d; 257 *du = d;
256 258
257 ret = dvb_usb_init(d); 259 ret = dvb_usb_init(d, adapter_nums);
258 260
259 if (ret == 0) 261 if (ret == 0)
260 info("%s successfully initialized and connected.",desc->name); 262 info("%s successfully initialized and connected.",desc->name);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h
index d1b3c7b81fff..b1de0f7e26e8 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -372,7 +372,10 @@ struct dvb_usb_device {
372 void *priv; 372 void *priv;
373}; 373};
374 374
375extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_device_properties *, struct module *, struct dvb_usb_device **); 375extern int dvb_usb_device_init(struct usb_interface *,
376 struct dvb_usb_device_properties *,
377 struct module *, struct dvb_usb_device **,
378 short *adapter_nums);
376extern void dvb_usb_device_exit(struct usb_interface *); 379extern void dvb_usb_device_exit(struct usb_interface *);
377 380
378/* the generic read/write method for device control */ 381/* the generic read/write method for device control */
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
index 6b99d9f4d5b3..0a8ac64a4e33 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -16,6 +16,8 @@ static int dvb_usb_gl861_debug;
16module_param_named(debug,dvb_usb_gl861_debug, int, 0644); 16module_param_named(debug,dvb_usb_gl861_debug, int, 0644);
17MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 17MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
18 18
19DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
20
19static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr, 21static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
20 u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) 22 u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
21{ 23{
@@ -140,7 +142,9 @@ static int gl861_probe(struct usb_interface *intf,
140 if (intf->num_altsetting < 2) 142 if (intf->num_altsetting < 2)
141 return -ENODEV; 143 return -ENODEV;
142 144
143 if ((ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d)) == 0) { 145 ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d,
146 adapter_nr);
147 if (ret == 0) {
144 alt = usb_altnum_to_altsetting(intf, 0); 148 alt = usb_altnum_to_altsetting(intf, 0);
145 149
146 if (alt == NULL) { 150 if (alt == NULL) {
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c
index 83e8535014c6..9a942afaf0af 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.c
+++ b/drivers/media/dvb/dvb-usb/gp8psk.c
@@ -22,6 +22,8 @@ int dvb_usb_gp8psk_debug;
22module_param_named(debug,dvb_usb_gp8psk_debug, int, 0644); 22module_param_named(debug,dvb_usb_gp8psk_debug, int, 0644);
23MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); 23MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
24 24
25DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
26
25int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) 27int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen)
26{ 28{
27 int ret = 0,try = 0; 29 int ret = 0,try = 0;
@@ -190,7 +192,8 @@ static int gp8psk_usb_probe(struct usb_interface *intf,
190{ 192{
191 int ret; 193 int ret;
192 struct usb_device *udev = interface_to_usbdev(intf); 194 struct usb_device *udev = interface_to_usbdev(intf);
193 ret = dvb_usb_device_init(intf,&gp8psk_properties,THIS_MODULE,NULL); 195 ret = dvb_usb_device_init(intf, &gp8psk_properties,
196 THIS_MODULE, NULL, adapter_nr);
194 if (ret == 0) { 197 if (ret == 0) {
195 info("found Genpix USB device pID = %x (hex)", 198 info("found Genpix USB device pID = %x (hex)",
196 le16_to_cpu(udev->descriptor.idProduct)); 199 le16_to_cpu(udev->descriptor.idProduct));
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c
index 29ec2b967742..a12e6f784fda 100644
--- a/drivers/media/dvb/dvb-usb/m920x.c
+++ b/drivers/media/dvb/dvb-usb/m920x.c
@@ -22,6 +22,8 @@ static int dvb_usb_m920x_debug;
22module_param_named(debug,dvb_usb_m920x_debug, int, 0644); 22module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
23MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 23MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
24 24
25DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
26
25static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid); 27static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid);
26 28
27static inline int m920x_read(struct usb_device *udev, u8 request, u16 value, 29static inline int m920x_read(struct usb_device *udev, u8 request, u16 value,
@@ -618,27 +620,31 @@ static int m920x_probe(struct usb_interface *intf,
618 * multi-tuner device 620 * multi-tuner device
619 */ 621 */
620 622
621 if ((ret = dvb_usb_device_init(intf, &megasky_properties, 623 ret = dvb_usb_device_init(intf, &megasky_properties,
622 THIS_MODULE, &d)) == 0) { 624 THIS_MODULE, &d, adapter_nr);
625 if (ret == 0) {
623 rc_init_seq = megasky_rc_init; 626 rc_init_seq = megasky_rc_init;
624 goto found; 627 goto found;
625 } 628 }
626 629
627 if ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties, 630 ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
628 THIS_MODULE, &d)) == 0) { 631 THIS_MODULE, &d, adapter_nr);
632 if (ret == 0) {
629 /* No remote control, so no rc_init_seq */ 633 /* No remote control, so no rc_init_seq */
630 goto found; 634 goto found;
631 } 635 }
632 636
633 /* This configures both tuners on the TV Walker Twin */ 637 /* This configures both tuners on the TV Walker Twin */
634 if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties, 638 ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
635 THIS_MODULE, &d)) == 0) { 639 THIS_MODULE, &d, adapter_nr);
640 if (ret == 0) {
636 rc_init_seq = tvwalkertwin_rc_init; 641 rc_init_seq = tvwalkertwin_rc_init;
637 goto found; 642 goto found;
638 } 643 }
639 644
640 if ((ret = dvb_usb_device_init(intf, &dposh_properties, 645 ret = dvb_usb_device_init(intf, &dposh_properties,
641 THIS_MODULE, &d)) == 0) { 646 THIS_MODULE, &d, adapter_nr);
647 if (ret == 0) {
642 /* Remote controller not supported yet. */ 648 /* Remote controller not supported yet. */
643 goto found; 649 goto found;
644 } 650 }
diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c
index badc468170ea..07fb843c7c2b 100644
--- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c
+++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c
@@ -15,6 +15,8 @@ static int debug;
15module_param(debug, int, 0644); 15module_param(debug, int, 0644);
16MODULE_PARM_DESC(debug, "set debugging level (1=rc,2=eeprom (|-able))." DVB_USB_DEBUG_STATUS); 16MODULE_PARM_DESC(debug, "set debugging level (1=rc,2=eeprom (|-able))." DVB_USB_DEBUG_STATUS);
17 17
18DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
19
18#define deb_rc(args...) dprintk(debug,0x01,args) 20#define deb_rc(args...) dprintk(debug,0x01,args)
19#define deb_ee(args...) dprintk(debug,0x02,args) 21#define deb_ee(args...) dprintk(debug,0x02,args)
20 22
@@ -142,7 +144,8 @@ static struct dvb_usb_device_properties nova_t_properties;
142static int nova_t_probe(struct usb_interface *intf, 144static int nova_t_probe(struct usb_interface *intf,
143 const struct usb_device_id *id) 145 const struct usb_device_id *id)
144{ 146{
145 return dvb_usb_device_init(intf,&nova_t_properties,THIS_MODULE,NULL); 147 return dvb_usb_device_init(intf, &nova_t_properties,
148 THIS_MODULE, NULL, adapter_nr);
146} 149}
147 150
148/* do not change the order of the ID table */ 151/* do not change the order of the ID table */
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c
index 302cc67407c3..0eef5fe094e1 100644
--- a/drivers/media/dvb/dvb-usb/opera1.c
+++ b/drivers/media/dvb/dvb-usb/opera1.c
@@ -46,6 +46,9 @@ MODULE_PARM_DESC(debug,
46 "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64 (or-able))." 46 "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64 (or-able))."
47 DVB_USB_DEBUG_STATUS); 47 DVB_USB_DEBUG_STATUS);
48 48
49DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
50
51
49static int opera1_xilinx_rw(struct usb_device *dev, u8 request, u16 value, 52static int opera1_xilinx_rw(struct usb_device *dev, u8 request, u16 value,
50 u8 * data, u16 len, int flags) 53 u8 * data, u16 len, int flags)
51{ 54{
@@ -548,7 +551,8 @@ static int opera1_probe(struct usb_interface *intf,
548 return -EINVAL; 551 return -EINVAL;
549 } 552 }
550 553
551 if (dvb_usb_device_init(intf, &opera1_properties, THIS_MODULE, NULL) != 0) 554 if (0 != dvb_usb_device_init(intf, &opera1_properties,
555 THIS_MODULE, NULL, adapter_nr))
552 return -EINVAL; 556 return -EINVAL;
553 return 0; 557 return 0;
554} 558}
diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c
index 0eb33378254b..706687c78506 100644
--- a/drivers/media/dvb/dvb-usb/ttusb2.c
+++ b/drivers/media/dvb/dvb-usb/ttusb2.c
@@ -37,6 +37,8 @@ static int dvb_usb_ttusb2_debug;
37module_param_named(debug,dvb_usb_ttusb2_debug, int, 0644); 37module_param_named(debug,dvb_usb_ttusb2_debug, int, 0644);
38MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))." DVB_USB_DEBUG_STATUS); 38MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))." DVB_USB_DEBUG_STATUS);
39 39
40DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
41
40struct ttusb2_state { 42struct ttusb2_state {
41 u8 id; 43 u8 id;
42}; 44};
@@ -181,8 +183,10 @@ static struct dvb_usb_device_properties ttusb2_properties_s2400;
181static int ttusb2_probe(struct usb_interface *intf, 183static int ttusb2_probe(struct usb_interface *intf,
182 const struct usb_device_id *id) 184 const struct usb_device_id *id)
183{ 185{
184 if (dvb_usb_device_init(intf, &ttusb2_properties, THIS_MODULE, NULL) == 0 || 186 if (0 == dvb_usb_device_init(intf, &ttusb2_properties,
185 dvb_usb_device_init(intf, &ttusb2_properties_s2400, THIS_MODULE, NULL) == 0) 187 THIS_MODULE, NULL, adapter_nr) ||
188 0 == dvb_usb_device_init(intf, &ttusb2_properties_s2400,
189 THIS_MODULE, NULL, adapter_nr))
186 return 0; 190 return 0;
187 return -ENODEV; 191 return -ENODEV;
188} 192}
diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c
index 0dcab3d4e236..9e7653bb3b66 100644
--- a/drivers/media/dvb/dvb-usb/umt-010.c
+++ b/drivers/media/dvb/dvb-usb/umt-010.c
@@ -13,6 +13,8 @@
13 13
14#include "mt352.h" 14#include "mt352.h"
15 15
16DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
17
16static int umt_mt352_demod_init(struct dvb_frontend *fe) 18static int umt_mt352_demod_init(struct dvb_frontend *fe)
17{ 19{
18 static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d }; 20 static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d };
@@ -75,7 +77,8 @@ static struct dvb_usb_device_properties umt_properties;
75static int umt_probe(struct usb_interface *intf, 77static int umt_probe(struct usb_interface *intf,
76 const struct usb_device_id *id) 78 const struct usb_device_id *id)
77{ 79{
78 if (dvb_usb_device_init(intf,&umt_properties,THIS_MODULE,NULL) == 0) 80 if (0 == dvb_usb_device_init(intf, &umt_properties,
81 THIS_MODULE, NULL, adapter_nr))
79 return 0; 82 return 0;
80 return -EINVAL; 83 return -EINVAL;
81} 84}
diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c
index e553c139ac44..986fff9a5ba8 100644
--- a/drivers/media/dvb/dvb-usb/vp702x.c
+++ b/drivers/media/dvb/dvb-usb/vp702x.c
@@ -21,6 +21,8 @@ int dvb_usb_vp702x_debug;
21module_param_named(debug,dvb_usb_vp702x_debug, int, 0644); 21module_param_named(debug,dvb_usb_vp702x_debug, int, 0644);
22MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); 22MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
23 23
24DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
25
24struct vp702x_state { 26struct vp702x_state {
25 int pid_filter_count; 27 int pid_filter_count;
26 int pid_filter_can_bypass; 28 int pid_filter_can_bypass;
@@ -238,7 +240,8 @@ static struct dvb_usb_device_properties vp702x_properties;
238static int vp702x_usb_probe(struct usb_interface *intf, 240static int vp702x_usb_probe(struct usb_interface *intf,
239 const struct usb_device_id *id) 241 const struct usb_device_id *id)
240{ 242{
241 return dvb_usb_device_init(intf,&vp702x_properties,THIS_MODULE,NULL); 243 return dvb_usb_device_init(intf, &vp702x_properties,
244 THIS_MODULE, NULL, adapter_nr);
242} 245}
243 246
244static struct usb_device_id vp702x_usb_table [] = { 247static struct usb_device_id vp702x_usb_table [] = {
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c
index c172babf59bb..acb345504e0d 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/drivers/media/dvb/dvb-usb/vp7045.c
@@ -18,6 +18,9 @@
18static int dvb_usb_vp7045_debug; 18static int dvb_usb_vp7045_debug;
19module_param_named(debug,dvb_usb_vp7045_debug, int, 0644); 19module_param_named(debug,dvb_usb_vp7045_debug, int, 0644);
20MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); 20MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
21
22DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
23
21#define deb_info(args...) dprintk(dvb_usb_vp7045_debug,0x01,args) 24#define deb_info(args...) dprintk(dvb_usb_vp7045_debug,0x01,args)
22#define deb_xfer(args...) dprintk(dvb_usb_vp7045_debug,0x02,args) 25#define deb_xfer(args...) dprintk(dvb_usb_vp7045_debug,0x02,args)
23#define deb_rc(args...) dprintk(dvb_usb_vp7045_debug,0x04,args) 26#define deb_rc(args...) dprintk(dvb_usb_vp7045_debug,0x04,args)
@@ -219,7 +222,8 @@ static struct dvb_usb_device_properties vp7045_properties;
219static int vp7045_usb_probe(struct usb_interface *intf, 222static int vp7045_usb_probe(struct usb_interface *intf,
220 const struct usb_device_id *id) 223 const struct usb_device_id *id)
221{ 224{
222 return dvb_usb_device_init(intf,&vp7045_properties,THIS_MODULE,NULL); 225 return dvb_usb_device_init(intf, &vp7045_properties,
226 THIS_MODULE, NULL, adapter_nr);
223} 227}
224 228
225static struct usb_device_id vp7045_usb_table [] = { 229static struct usb_device_id vp7045_usb_table [] = {
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c
index 08a2599ed74a..960ed5763ae1 100644
--- a/drivers/media/dvb/pluto2/pluto2.c
+++ b/drivers/media/dvb/pluto2/pluto2.c
@@ -39,6 +39,8 @@
39#include "dvbdev.h" 39#include "dvbdev.h"
40#include "tda1004x.h" 40#include "tda1004x.h"
41 41
42DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
43
42#define DRIVER_NAME "pluto2" 44#define DRIVER_NAME "pluto2"
43 45
44#define REG_PIDn(n) ((n) << 2) /* PID n pattern registers */ 46#define REG_PIDn(n) ((n) << 2) /* PID n pattern registers */
@@ -662,7 +664,8 @@ static int __devinit pluto2_probe(struct pci_dev *pdev,
662 goto err_pluto_hw_exit; 664 goto err_pluto_hw_exit;
663 665
664 /* dvb */ 666 /* dvb */
665 ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE, &pdev->dev); 667 ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME,
668 THIS_MODULE, &pdev->dev, adapter_nr);
666 if (ret < 0) 669 if (ret < 0)
667 goto err_i2c_del_adapter; 670 goto err_i2c_del_adapter;
668 671
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 78919b9e14dc..747e7f1a6267 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -112,6 +112,8 @@ MODULE_PARM_DESC(wss_cfg_16_9, "WSS 16:9 - default 0x0007 - bit 15: disable, 14:
112module_param(tv_standard, int, 0444); 112module_param(tv_standard, int, 0444);
113MODULE_PARM_DESC(tv_standard, "TV standard: 0 PAL (default), 1 NTSC"); 113MODULE_PARM_DESC(tv_standard, "TV standard: 0 PAL (default), 1 NTSC");
114 114
115DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
116
115static void restart_feeds(struct av7110 *av7110); 117static void restart_feeds(struct av7110 *av7110);
116 118
117static int av7110_num; 119static int av7110_num;
@@ -2461,7 +2463,7 @@ static int __devinit av7110_attach(struct saa7146_dev* dev,
2461 goto err_kfree_0; 2463 goto err_kfree_0;
2462 2464
2463 ret = dvb_register_adapter(&av7110->dvb_adapter, av7110->card_name, 2465 ret = dvb_register_adapter(&av7110->dvb_adapter, av7110->card_name,
2464 THIS_MODULE, &dev->pci->dev); 2466 THIS_MODULE, &dev->pci->dev, adapter_nr);
2465 if (ret < 0) 2467 if (ret < 0)
2466 goto err_put_firmware_1; 2468 goto err_put_firmware_1;
2467 2469
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c
index 06bbce42fcd7..18cac4b12ab2 100644
--- a/drivers/media/dvb/ttpci/budget-core.c
+++ b/drivers/media/dvb/ttpci/budget-core.c
@@ -57,6 +57,8 @@ module_param_named(bufsize, dma_buffer_size, int, 0444);
57MODULE_PARM_DESC(debug, "Turn on/off budget debugging (default:off)."); 57MODULE_PARM_DESC(debug, "Turn on/off budget debugging (default:off).");
58MODULE_PARM_DESC(bufsize, "DMA buffer size in KB, default: 188, min: 188, max: 1410 (Activy: 564)"); 58MODULE_PARM_DESC(bufsize, "DMA buffer size in KB, default: 188, min: 188, max: 1410 (Activy: 564)");
59 59
60DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
61
60/**************************************************************************** 62/****************************************************************************
61 * TT budget / WinTV Nova 63 * TT budget / WinTV Nova
62 ****************************************************************************/ 64 ****************************************************************************/
@@ -471,9 +473,10 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
471 budget->buffer_width, budget->buffer_height); 473 budget->buffer_width, budget->buffer_height);
472 printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size); 474 printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size);
473 475
474 if ((ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, owner, &budget->dev->pci->dev)) < 0) { 476 ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name,
477 owner, &budget->dev->pci->dev, adapter_nr);
478 if (ret < 0)
475 return ret; 479 return ret;
476 }
477 480
478 /* set dd1 stream a & b */ 481 /* set dd1 stream a & b */
479 saa7146_write(dev, DD1_STREAM_B, 0x00000000); 482 saa7146_write(dev, DD1_STREAM_B, 0x00000000);
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 317eccbe5c66..46dc4a3fcb6c 100644
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -56,10 +56,11 @@
56*/ 56*/
57 57
58static int debug; 58static int debug;
59
60module_param(debug, int, 0644); 59module_param(debug, int, 0644);
61MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); 60MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
62 61
62DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
63
63#define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0) 64#define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0)
64 65
65#define ISO_BUF_COUNT 4 66#define ISO_BUF_COUNT 4
@@ -1669,7 +1670,10 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
1669 1670
1670 mutex_unlock(&ttusb->semi2c); 1671 mutex_unlock(&ttusb->semi2c);
1671 1672
1672 if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE, &udev->dev)) < 0) { 1673 result = dvb_register_adapter(&ttusb->adapter,
1674 "Technotrend/Hauppauge Nova-USB",
1675 THIS_MODULE, &udev->dev, adapter_nr);
1676 if (result < 0) {
1673 ttusb_free_iso_urbs(ttusb); 1677 ttusb_free_iso_urbs(ttusb);
1674 kfree(ttusb); 1678 kfree(ttusb);
1675 return result; 1679 return result;
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index 95110c483312..42eee04daa5d 100644
--- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -52,6 +52,8 @@ MODULE_PARM_DESC(output_pva, "Output PVA from dvr device (default:off)");
52module_param(enable_rc, int, 0644); 52module_param(enable_rc, int, 0644);
53MODULE_PARM_DESC(enable_rc, "Turn on/off IR remote control(default: off)"); 53MODULE_PARM_DESC(enable_rc, "Turn on/off IR remote control(default: off)");
54 54
55DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
56
55#define dprintk if (debug) printk 57#define dprintk if (debug) printk
56 58
57#define DRIVER_NAME "TechnoTrend/Hauppauge DEC USB" 59#define DRIVER_NAME "TechnoTrend/Hauppauge DEC USB"
@@ -1437,7 +1439,9 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec)
1437 dprintk("%s\n", __func__); 1439 dprintk("%s\n", __func__);
1438 1440
1439 if ((result = dvb_register_adapter(&dec->adapter, 1441 if ((result = dvb_register_adapter(&dec->adapter,
1440 dec->model_name, THIS_MODULE, &dec->udev->dev)) < 0) { 1442 dec->model_name, THIS_MODULE,
1443 &dec->udev->dev,
1444 adapter_nr)) < 0) {
1441 printk("%s: dvb_register_adapter failed: error %d\n", 1445 printk("%s: dvb_register_adapter failed: error %d\n",
1442 __func__, result); 1446 __func__, result);
1443 1447