Re: [RFC PATCH] Choose dvb adapter number with a driver specific module option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 03 August 2007 21:28:01 Michael Krufky wrote:
> I say Janne should continue on and convert the rest of the drivers...
> Is anybody opposed?

done

Janne
Adds adapter_nr module parameter to all dvb drivers to specify the
preferred allocation of device minor numbers per driver.

Signed-off-by: Janne Grunau <janne-dvb@xxxxxxxxx>
Index: v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/b2c2/flexcop.c
+++ v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop.c
@@ -64,10 +64,10 @@ static int flexcop_dvb_stop_feed(struct 
 	return flexcop_pid_feed_control(fc,dvbdmxfeed,0);
 }
 
-static int flexcop_dvb_init(struct flexcop_device *fc)
+static int flexcop_dvb_init(struct flexcop_device *fc, int *adapter_nums)
 {
 	int ret;
-	if ((ret = dvb_register_adapter(&fc->dvb_adapter,"FlexCop Digital TV device",fc->owner,fc->dev)) < 0) {
+	if ((ret = dvb_register_adapter(&fc->dvb_adapter,"FlexCop Digital TV device",fc->owner,fc->dev,adapter_nums)) < 0) {
 		err("error registering DVB adapter");
 		return ret;
 	}
@@ -243,7 +243,7 @@ void flexcop_device_kfree(struct flexcop
 }
 EXPORT_SYMBOL(flexcop_device_kfree);
 
-int flexcop_device_initialize(struct flexcop_device *fc)
+int flexcop_device_initialize(struct flexcop_device *fc, int *adapter_nums)
 {
 	int ret;
 	ibi_zero.raw = 0;
@@ -255,7 +255,7 @@ int flexcop_device_initialize(struct fle
 
 	flexcop_smc_ctrl(fc, 0);
 
-	if ((ret = flexcop_dvb_init(fc)))
+	if ((ret = flexcop_dvb_init(fc, adapter_nums)))
 		goto error;
 
 	/* do the MAC address reading after initializing the dvb_adapter */
Index: v4l-dvb/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ v4l-dvb/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -42,6 +42,8 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 #define dprintk( args... ) \
 	do \
 		if (debug) printk(KERN_DEBUG args); \
@@ -717,7 +719,7 @@ static int __devinit dvb_bt8xx_load_card
 {
 	int result;
 
-	if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE, &card->bt->dev->dev)) < 0) {
+	if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE, &card->bt->dev->dev, adapter_nr)) < 0) {
 		printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result);
 		return result;
 	}
Index: v4l-dvb/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ v4l-dvb/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -61,6 +61,8 @@ static int debug;
 module_param_named(debug, debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
 #define dprintk(level, args...)						\
 do {									\
@@ -992,7 +994,7 @@ static int cinergyt2_probe (struct usb_i
 		return -ENOMEM;
 	}
 
-	if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE, &cinergyt2->udev->dev)) < 0) {
+	if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE, &cinergyt2->udev->dev, adapter_nr)) < 0) {
 		kfree(cinergyt2);
 		return err;
 	}
Index: v4l-dvb/linux/drivers/media/dvb/dvb-core/dvbdev.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-core/dvbdev.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-core/dvbdev.c
@@ -53,7 +53,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)
@@ -286,21 +285,25 @@ void dvb_unregister_device(struct dvb_de
 }
 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 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)
-				goto skip;
-		}
-		return num;
-skip:
+		if (dvbdev_check_free_adapter_num(num))
+			return num;
 		num++;
 	}
 
@@ -308,13 +311,27 @@ 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, int *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: v4l-dvb/linux/drivers/media/dvb/dvb-core/dvbdev.h
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-core/dvbdev.h
+++ v4l-dvb/linux/drivers/media/dvb/dvb-core/dvbdev.h
@@ -31,6 +31,8 @@
 
 #define DVB_MAJOR 212
 
+#define DVB_MAX_ADAPTERS 8
+
 #define DVB_DEVICE_VIDEO      0
 #define DVB_DEVICE_AUDIO      1
 #define DVB_DEVICE_SEC        2
@@ -41,6 +43,11 @@
 #define DVB_DEVICE_NET        7
 #define DVB_DEVICE_OSD        8
 
+#define DVB_UNSET (-1)
+
+#define DVB_ADAPTER_NR_MODULE_PARAM	static int adapter_nr[] = {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
+					module_param_array(adapter_nr, int, NULL, 0444); \
+					MODULE_PARM_DESC(adapter_nr,"DVB adapter numbers");
 
 struct dvb_adapter {
 	int num;
@@ -78,7 +85,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,
+				 int *adapter_nums);
 extern int dvb_unregister_adapter (struct dvb_adapter *adap);
 
 extern int dvb_register_device (struct dvb_adapter *adap,
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/a800.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/a800.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/a800.c
@@ -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_ADAPTER_NR_MODULE_PARAM
+
 #define deb_rc(args...)   dprintk(debug,0x01,args)
 
 static int a800_power_ctrl(struct dvb_usb_device *d, int onoff)
@@ -94,7 +97,7 @@ static struct dvb_usb_device_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: v4l-dvb/linux/drivers/media/dvb/dvb-usb/af9005.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/af9005.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/af9005.c
@@ -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_ADAPTER_NR_MODULE_PARAM
+
 /* remote control decoder */
 int (*rc_decode) (struct dvb_usb_device * d, u8 * data, int len, u32 * event,
 		  int *state);
@@ -1020,7 +1022,7 @@ static struct dvb_usb_device_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: v4l-dvb/linux/drivers/media/dvb/dvb-usb/au6610.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/au6610.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/au6610.c
@@ -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_ADAPTER_NR_MODULE_PARAM
+
 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,7 @@ static int au6610_probe(struct usb_inter
 	if (intf->num_altsetting < AU6610_ALTSETTING_COUNT)
 		return -ENODEV;
 
-	if ((ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d)) == 0) {
+	if ((ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d, adapter_nr)) == 0) {
 		alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING);
 
 		if (alt == NULL) {
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/cxusb.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/cxusb.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/cxusb.c
@@ -36,6 +36,8 @@ 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_ADAPTER_NR_MODULE_PARAM
+
 static int cxusb_ctrl_msg(struct dvb_usb_device *d,
 			  u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
 {
@@ -483,11 +485,11 @@ static struct dvb_usb_device_properties 
 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) {
+	if (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) {
 		return 0;
 	}
 
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/dib0700_core.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/dib0700_core.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -17,6 +17,8 @@ static 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_ADAPTER_NR_MODULE_PARAM
+
 /* expecting rx buffer: request data[0] data[1] ... data[2] */
 static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
 {
@@ -292,7 +294,7 @@ static int dib0700_probe(struct usb_inte
 #endif
 
 	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: v4l-dvb/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/dibusb-mb.c
@@ -14,6 +14,8 @@
  */
 #include "dibusb.h"
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 static int dib3000mb_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
 {
 	struct dvb_usb_adapter *adap = fe->dvb->priv;
@@ -107,10 +109,10 @@ static struct dvb_usb_device_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 (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) == 0)
 		return 0;
 
 	return -EINVAL;
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/dibusb-mc.c
@@ -14,13 +14,15 @@
  */
 #include "dibusb.h"
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 /* 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: v4l-dvb/linux/drivers/media/dvb/dvb-usb/digitv.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/digitv.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/digitv.c
@@ -21,6 +21,8 @@ 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_ADAPTER_NR_MODULE_PARAM
+
 static int digitv_ctrl_msg(struct dvb_usb_device *d,
 		u8 cmd, u8 vv, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
 {
@@ -256,7 +258,7 @@ static int digitv_probe(struct usb_inter
 {
 	struct dvb_usb_device *d;
 	int ret;
-	if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) {
+	if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d,adapter_nr)) == 0) {
 		u8 b[4] = { 0 };
 
 		if (d != NULL) { /* do that only when the firmware is loaded */
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/dtt200u.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/dtt200u.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/dtt200u.c
@@ -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_ADAPTER_NR_MODULE_PARAM
+
 static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
 {
 	u8 b = SET_INIT;
@@ -101,11 +103,11 @@ static struct dvb_usb_device_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 (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) == 0)
 		return 0;
 
 	return -ENODEV;
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/dvb-usb-common.h
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/dvb-usb-common.h
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/dvb-usb-common.h
@@ -40,7 +40,7 @@ extern int dvb_usb_adapter_stream_exit(s
 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, int *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: v4l-dvb/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
@@ -77,12 +77,12 @@ static int dvb_usb_stop_feed(struct dvb_
 	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, int *adapter_nums)
 {
 	int ret;
 
 	if ((ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name,
-			adap->dev->owner, &adap->dev->udev->dev)) < 0) {
+			adap->dev->owner, &adap->dev->udev->dev, adapter_nums)) < 0) {
 		deb_info("dvb_register_adapter failed: error %d", ret);
 		goto err;
 	}
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c
@@ -26,7 +26,7 @@ static int dvb_usb_force_pid_filter_usag
 module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444);
 MODULE_PARM_DESC(disable_rc_polling, "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, s8 *adapter_nrs)
 {
 	struct dvb_usb_adapter *adap;
 	int ret,n;
@@ -72,7 +72,7 @@ static int dvb_usb_adapter_init(struct 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_d
 	return 0;
 }
 
-static int dvb_usb_init(struct dvb_usb_device *d)
+static int dvb_usb_init(struct dvb_usb_device *d, int *adapter_nums)
 {
 	int ret = 0;
 
@@ -143,7 +143,7 @@ static int dvb_usb_init(struct dvb_usb_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;
 	}
@@ -214,7 +214,7 @@ int dvb_usb_device_power_ctrl(struct dvb
  * USB
  */
 int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_properties
-		*props, struct module *owner,struct dvb_usb_device **du)
+		*props, struct module *owner,struct dvb_usb_device **du, int *adapter_nums)
 {
 	struct usb_device *udev = interface_to_usbdev(intf);
 	struct dvb_usb_device *d = NULL;
@@ -254,7 +254,7 @@ int dvb_usb_device_init(struct usb_inter
 	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: v4l-dvb/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -387,7 +387,7 @@ 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 **, int *adapter_nums);
 extern void dvb_usb_device_exit(struct usb_interface *);
 
 /* the generic read/write method for device control */
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/gl861.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/gl861.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/gl861.c
@@ -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_ADAPTER_NR_MODULE_PARAM
+
 static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
 			 u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
 {
@@ -140,7 +142,7 @@ static int gl861_probe(struct usb_interf
 	if (intf->num_altsetting < 2)
 		return -ENODEV;
 
-	if ((ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d)) == 0) {
+	if ((ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d, adapter_nr)) == 0) {
 		alt = usb_altnum_to_altsetting(intf, 0);
 
 		if (alt == NULL) {
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/gp8psk.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/gp8psk.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/gp8psk.c
@@ -21,6 +21,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_ADAPTER_NR_MODULE_PARAM
+
 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;
@@ -177,7 +179,7 @@ static struct dvb_usb_device_properties 
 static int gp8psk_usb_probe(struct usb_interface *intf,
 		const struct usb_device_id *id)
 {
-	return dvb_usb_device_init(intf,&gp8psk_properties,THIS_MODULE,NULL);
+	return dvb_usb_device_init(intf,&gp8psk_properties,THIS_MODULE,NULL,adapter_nr);
 }
 
 static struct usb_device_id gp8psk_usb_table [] = {
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/m920x.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/m920x.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/m920x.c
@@ -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_ADAPTER_NR_MODULE_PARAM
+
 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,
@@ -619,26 +621,26 @@ static int m920x_probe(struct usb_interf
 		 */
 
 		if ((ret = dvb_usb_device_init(intf, &megasky_properties,
-					       THIS_MODULE, &d)) == 0) {
+					       THIS_MODULE, &d, adapter_nr)) == 0) {
 			rc_init_seq = megasky_rc_init;
 			goto found;
 		}
 
 		if ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
-					       THIS_MODULE, &d)) == 0) {
+					       THIS_MODULE, &d, adapter_nr)) == 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) {
+					       THIS_MODULE, &d, adapter_nr)) == 0) {
 			rc_init_seq = tvwalkertwin_rc_init;
 			goto found;
 		}
 
 		if ((ret = dvb_usb_device_init(intf, &dposh_properties,
-					       THIS_MODULE, &d)) == 0) {
+					       THIS_MODULE, &d, adapter_nr)) == 0) {
 			/* Remote controller not supported yet. */
 			goto found;
 		}
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/nova-t-usb2.c
@@ -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_ADAPTER_NR_MODULE_PARAM
+
 #define deb_rc(args...) dprintk(debug,0x01,args)
 #define deb_ee(args...) dprintk(debug,0x02,args)
 
@@ -142,7 +144,7 @@ static struct dvb_usb_device_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: v4l-dvb/linux/drivers/media/dvb/dvb-usb/opera1.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/opera1.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/opera1.c
@@ -43,6 +43,9 @@ module_param_named(debug, dvb_usb_opera1
 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_ADAPTER_NR_MODULE_PARAM
+
 #if 0
 struct mutex mymutex;
 #endif
@@ -557,7 +560,7 @@ static int opera1_probe(struct usb_inter
 		return -EINVAL;
 	}
 
-	if (dvb_usb_device_init(intf, &opera1_properties, THIS_MODULE, NULL) != 0)
+	if (dvb_usb_device_init(intf, &opera1_properties, THIS_MODULE, NULL, adapter_nr) != 0)
 		return -EINVAL;
 	return 0;
 }
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/ttusb2.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/ttusb2.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/ttusb2.c
@@ -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_ADAPTER_NR_MODULE_PARAM
+
 struct ttusb2_state {
 	u8 id;
 };
@@ -185,7 +187,7 @@ static struct dvb_usb_device_properties 
 static int ttusb2_probe(struct usb_interface *intf,
 		const struct usb_device_id *id)
 {
-	return dvb_usb_device_init(intf,&ttusb2_properties,THIS_MODULE,NULL);
+	return dvb_usb_device_init(intf,&ttusb2_properties,THIS_MODULE,NULL,adapter_nr);
 }
 
 static struct usb_device_id ttusb2_table [] = {
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/umt-010.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/umt-010.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/umt-010.c
@@ -13,6 +13,8 @@
 
 #include "mt352.h"
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 static int umt_mt352_demod_init(struct dvb_frontend *fe)
 {
 	static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d };
@@ -75,7 +77,7 @@ static struct dvb_usb_device_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 (dvb_usb_device_init(intf,&umt_properties,THIS_MODULE,NULL,adapter_nr) == 0)
 		return 0;
 	return -EINVAL;
 }
Index: v4l-dvb/linux/drivers/media/dvb/dvb-usb/vp702x.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/vp702x.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/vp702x.c
@@ -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_ADAPTER_NR_MODULE_PARAM
+
 struct vp702x_state {
 	int pid_filter_count;
 	int pid_filter_can_bypass;
@@ -283,7 +285,7 @@ static struct dvb_usb_device_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: v4l-dvb/linux/drivers/media/dvb/dvb-usb/vp7045.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/vp7045.c
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/vp7045.c
@@ -19,6 +19,8 @@ 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_ADAPTER_NR_MODULE_PARAM
+
 int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen, int msec)
 {
 	int ret = 0;
@@ -224,7 +226,7 @@ static struct dvb_usb_device_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: v4l-dvb/linux/drivers/media/dvb/pluto2/pluto2.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/pluto2/pluto2.c
+++ v4l-dvb/linux/drivers/media/dvb/pluto2/pluto2.c
@@ -91,6 +91,8 @@
 #define I2C_ADDR_TUA6034	0xc2
 #define NHWFILTERS		8
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 struct pluto {
 	/* pci */
 	struct pci_dev *pdev;
@@ -666,7 +668,7 @@ static int __devinit pluto2_probe(struct
 		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: v4l-dvb/linux/drivers/media/dvb/ttpci/av7110.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttpci/av7110.c
+++ v4l-dvb/linux/drivers/media/dvb/ttpci/av7110.c
@@ -113,6 +113,8 @@ MODULE_PARM_DESC(wss_cfg_16_9, "WSS 16:9
 module_param(tv_standard, int, 0444);
 MODULE_PARM_DESC(tv_standard, "TV standard: 0 PAL (default), 1 NTSC");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 static void restart_feeds(struct av7110 *av7110);
 
 static int av7110_num;
@@ -2462,7 +2464,7 @@ static int __devinit av7110_attach(struc
 		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: v4l-dvb/linux/drivers/media/dvb/ttpci/budget-core.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttpci/budget-core.c
+++ v4l-dvb/linux/drivers/media/dvb/ttpci/budget-core.c
@@ -410,7 +410,7 @@ static void budget_unregister(struct bud
 
 int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
 		      struct saa7146_pci_extension_data *info,
-		      struct module *owner)
+		      struct module *owner, int *adapter_nums)
 {
 	int ret = 0;
 	struct budget_info *bi = info->ext_priv;
@@ -472,7 +472,7 @@ int ttpci_budget_init(struct budget *bud
 		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) {
+	if ((ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, owner, &budget->dev->pci->dev, adapter_nums)) < 0) {
 		return ret;
 	}
 
Index: v4l-dvb/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ v4l-dvb/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -64,6 +64,8 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 #define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0)
 
 #define ISO_BUF_COUNT      4
@@ -1682,7 +1684,7 @@ static int ttusb_probe(struct usb_interf
 
 	mutex_unlock(&ttusb->semi2c);
 
-	if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE, &udev->dev)) < 0) {
+	if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE, &udev->dev, adapter_nr)) < 0) {
 		ttusb_free_iso_urbs(ttusb);
 		kfree(ttusb);
 		return result;
Index: v4l-dvb/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ v4l-dvb/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -56,6 +56,8 @@ MODULE_PARM_DESC(output_pva, "Output PVA
 module_param(enable_rc, int, 0644);
 MODULE_PARM_DESC(enable_rc, "Turn on/off IR remote control(default: off)");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 #define dprintk	if (debug) printk
 
 #define DRIVER_NAME		"TechnoTrend/Hauppauge DEC USB"
@@ -1457,7 +1459,7 @@ static int ttusb_dec_init_dvb(struct ttu
 	dprintk("%s\n", __FUNCTION__);
 
 	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",
 		       __FUNCTION__, result);
 
Index: v4l-dvb/linux/drivers/media/video/video-buf-dvb.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/video/video-buf-dvb.c
+++ v4l-dvb/linux/drivers/media/video/video-buf-dvb.c
@@ -143,14 +143,15 @@ static int videobuf_dvb_stop_feed(struct
 int videobuf_dvb_register(struct videobuf_dvb *dvb,
 			  struct module *module,
 			  void *adapter_priv,
-			  struct device *device)
+			  struct device *device,
+			  int *adapter_nums)
 {
 	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_nums);
 	if (result < 0) {
 		printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n",
 		       dvb->name, result);
Index: v4l-dvb/linux/drivers/media/dvb/ttpci/budget-av.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttpci/budget-av.c
+++ v4l-dvb/linux/drivers/media/dvb/ttpci/budget-av.c
@@ -57,6 +57,8 @@
 #define SLOTSTATUS_READY        8
 #define SLOTSTATUS_OCCUPIED     (SLOTSTATUS_PRESENT|SLOTSTATUS_RESET|SLOTSTATUS_READY)
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 struct budget_av {
 	struct budget budget;
 	struct video_device *vd;
@@ -1111,7 +1113,7 @@ static int budget_av_attach(struct saa71
 
 	dev->ext_priv = budget_av;
 
-	if ((err = ttpci_budget_init(&budget_av->budget, dev, info, THIS_MODULE))) {
+	if ((err = ttpci_budget_init(&budget_av->budget, dev, info, THIS_MODULE, adapter_nr))) {
 		kfree(budget_av);
 		return err;
 	}
Index: v4l-dvb/linux/drivers/media/dvb/ttpci/budget-ci.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttpci/budget-ci.c
+++ v4l-dvb/linux/drivers/media/dvb/ttpci/budget-ci.c
@@ -90,6 +90,8 @@ static int ir_debug = 0;
 module_param(ir_debug, int, 0644);
 MODULE_PARM_DESC(ir_debug, "enable debugging information for IR decoding");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 struct budget_ci_ir {
 	struct input_dev *dev;
 	struct tasklet_struct msp430_irq_tasklet;
@@ -1171,7 +1173,7 @@ static int budget_ci_attach(struct saa71
 
 	dev->ext_priv = budget_ci;
 
-	err = ttpci_budget_init(&budget_ci->budget, dev, info, THIS_MODULE);
+	err = ttpci_budget_init(&budget_ci->budget, dev, info, THIS_MODULE, adapter_nr);
 	if (err)
 		goto out2;
 
Index: v4l-dvb/linux/drivers/media/dvb/ttpci/budget-patch.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttpci/budget-patch.c
+++ v4l-dvb/linux/drivers/media/dvb/ttpci/budget-patch.c
@@ -41,6 +41,8 @@
 
 #define budget_patch budget
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 static struct saa7146_extension budget_extension;
 
 MAKE_BUDGET_INFO(ttbp, "TT-Budget/Patch DVB-S 1.x PCI", BUDGET_PATCH);
@@ -591,7 +593,7 @@ static int budget_patch_attach (struct s
 
 	dprintk(2, "budget: %p\n", budget);
 
-	if ((err = ttpci_budget_init (budget, dev, info, THIS_MODULE))) {
+	if ((err = ttpci_budget_init (budget, dev, info, THIS_MODULE, adapter_nr))) {
 		kfree (budget);
 		return err;
 	}
Index: v4l-dvb/linux/drivers/media/dvb/ttpci/budget.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttpci/budget.c
+++ v4l-dvb/linux/drivers/media/dvb/ttpci/budget.c
@@ -50,6 +50,8 @@ static int diseqc_method;
 module_param(diseqc_method, int, 0444);
 MODULE_PARM_DESC(diseqc_method, "Select DiSEqC method for subsystem id 13c2:1003, 0: default, 1: more reliable (for newer revisions only)");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 static void Set22K (struct budget *budget, int state)
 {
 	struct saa7146_dev *dev=budget->dev;
@@ -495,7 +497,7 @@ static int budget_attach (struct saa7146
 
 	dev->ext_priv = budget;
 
-	if ((err = ttpci_budget_init (budget, dev, info, THIS_MODULE))) {
+	if ((err = ttpci_budget_init (budget, dev, info, THIS_MODULE, adapter_nr))) {
 		printk("==> failed\n");
 		kfree (budget);
 		return err;
Index: v4l-dvb/linux/drivers/media/dvb/ttpci/budget.h
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/ttpci/budget.h
+++ v4l-dvb/linux/drivers/media/dvb/ttpci/budget.h
@@ -116,7 +116,7 @@ static struct saa7146_pci_extension_data
 
 extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
 			     struct saa7146_pci_extension_data *info,
-			     struct module *owner);
+			     struct module *owner, int *adapter_nums);
 extern void ttpci_budget_init_hooks(struct budget *budget);
 extern int ttpci_budget_deinit(struct budget *budget);
 extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr);
Index: v4l-dvb/linux/drivers/media/video/cx88/cx88-dvb.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/video/cx88/cx88-dvb.c
+++ v4l-dvb/linux/drivers/media/video/cx88/cx88-dvb.c
@@ -54,6 +54,8 @@ static unsigned int debug = 0;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug,"enable debug messages [dvb]");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 #define dprintk(level,fmt, arg...)	if (debug >= level) \
 	printk(KERN_DEBUG "%s/2-dvb: " fmt, core->name, ## arg)
 
@@ -642,7 +644,7 @@ static int dvb_register(struct cx8802_de
 	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: v4l-dvb/linux/drivers/media/video/saa7134/saa7134-dvb.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/video/saa7134/saa7134-dvb.c
+++ v4l-dvb/linux/drivers/media/video/saa7134/saa7134-dvb.c
@@ -60,6 +60,8 @@ static int debug = 0;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off module debugging (default:off).");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 #define dprintk(fmt, arg...)	do { if (debug) \
 	printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg); } while(0)
 
@@ -1033,7 +1035,7 @@ static int dvb_init(struct saa7134_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: v4l-dvb/linux/include/media/video-buf-dvb.h
===================================================================
--- v4l-dvb.orig/linux/include/media/video-buf-dvb.h
+++ v4l-dvb/linux/include/media/video-buf-dvb.h
@@ -35,7 +35,8 @@ struct videobuf_dvb {
 int videobuf_dvb_register(struct videobuf_dvb *dvb,
 			  struct module *module,
 			  void *adapter_priv,
-			  struct device *device);
+			  struct device *device,
+			  int *adapter_nums);
 void videobuf_dvb_unregister(struct videobuf_dvb *dvb);
 
 /*
Index: v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop-common.h
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/b2c2/flexcop-common.h
+++ v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop-common.h
@@ -111,7 +111,7 @@ void flexcop_pass_dmx_packets(struct fle
 struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len);
 void flexcop_device_kfree(struct flexcop_device*);
 
-int  flexcop_device_initialize(struct flexcop_device*);
+int  flexcop_device_initialize(struct flexcop_device*, int *adapter_nums);
 void flexcop_device_exit(struct flexcop_device *fc);
 
 void flexcop_reset_block_300(struct flexcop_device *fc);
Index: v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop-pci.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/b2c2/flexcop-pci.c
+++ v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop-pci.c
@@ -17,6 +17,8 @@ static int irq_chk_intv;
 module_param(irq_chk_intv, int, 0644);
 MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ watchdog (currently just debugging).");
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 #ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG
 #define dprintk(level,args...) \
 	do { if ((debug & level)) printk(args); } while (0)
@@ -382,7 +384,7 @@ static int flexcop_pci_probe(struct pci_
 		goto err_kfree;
 
 /* init flexcop */
-	if ((ret = flexcop_device_initialize(fc)) != 0)
+	if ((ret = flexcop_device_initialize(fc, adapter_nr)) != 0)
 		goto err_pci_exit;
 
 /* init dma */
Index: v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop-usb.c
===================================================================
--- v4l-dvb.orig/linux/drivers/media/dvb/b2c2/flexcop-usb.c
+++ v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop-usb.c
@@ -37,6 +37,8 @@ module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=info,ts=2,ctrl=4,i2c=8,v8mem=16 (or-able))." DEBSTATUS);
 #undef DEBSTATUS
 
+DVB_ADAPTER_NR_MODULE_PARAM
+
 #define deb_info(args...) dprintk(0x01,args)
 #define deb_ts(args...)   dprintk(0x02,args)
 #define deb_ctrl(args...) dprintk(0x04,args)
@@ -510,7 +512,7 @@ static int flexcop_usb_probe(struct usb_
 		goto err_kfree;
 
 /* init flexcop */
-	if ((ret = flexcop_device_initialize(fc)) != 0)
+	if ((ret = flexcop_device_initialize(fc, adapter_nr)) != 0)
 		goto err_usb_exit;
 
 /* xfer init */
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux