You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
9950c1b5b4
commit
78e92006f4
@@ -49,6 +49,8 @@ module_param_named(debug, b2c2_flexcop_debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))." DEBSTATUS);
|
||||
#undef DEBSTATUS
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
/* global zero for ibi values */
|
||||
flexcop_ibi_value ibi_zero;
|
||||
|
||||
@@ -66,8 +68,10 @@ static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
|
||||
|
||||
static int flexcop_dvb_init(struct flexcop_device *fc)
|
||||
{
|
||||
int ret;
|
||||
if ((ret = dvb_register_adapter(&fc->dvb_adapter,"FlexCop Digital TV device",fc->owner,fc->dev)) < 0) {
|
||||
int ret = dvb_register_adapter(&fc->dvb_adapter,
|
||||
"FlexCop Digital TV device", fc->owner,
|
||||
fc->dev, adapter_nr);
|
||||
if (ret < 0) {
|
||||
err("error registering DVB adapter");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
#define dprintk( args... ) \
|
||||
do { \
|
||||
if (debug) printk(KERN_DEBUG args); \
|
||||
@@ -717,7 +719,10 @@ static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
|
||||
{
|
||||
int result;
|
||||
|
||||
if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE, &card->bt->dev->dev)) < 0) {
|
||||
result = dvb_register_adapter(&card->dvb_adapter, card->card_name,
|
||||
THIS_MODULE, &card->bt->dev->dev,
|
||||
adapter_nr);
|
||||
if (result < 0) {
|
||||
printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ static int debug;
|
||||
module_param_named(debug, debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
#define dprintk(level, args...) \
|
||||
do { \
|
||||
if ((debug & level)) { \
|
||||
@@ -938,7 +940,10 @@ static int cinergyt2_probe (struct usb_interface *intf,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE, &cinergyt2->udev->dev)) < 0) {
|
||||
err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME,
|
||||
THIS_MODULE, &cinergyt2->udev->dev,
|
||||
adapter_nr);
|
||||
if (err < 0) {
|
||||
kfree(cinergyt2);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ static const char * const dnames[] = {
|
||||
"net", "osd"
|
||||
};
|
||||
|
||||
#define DVB_MAX_ADAPTERS 8
|
||||
#define DVB_MAX_IDS 4
|
||||
#define nums2minor(num,type,id) ((num << 6) | (id << 4) | type)
|
||||
#define MAX_DVB_MINORS (DVB_MAX_ADAPTERS*64)
|
||||
@@ -262,18 +261,25 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
|
||||
}
|
||||
EXPORT_SYMBOL(dvb_unregister_device);
|
||||
|
||||
static int dvbdev_check_free_adapter_num(int num)
|
||||
{
|
||||
struct list_head *entry;
|
||||
list_for_each(entry, &dvb_adapter_list) {
|
||||
struct dvb_adapter *adap;
|
||||
adap = list_entry(entry, struct dvb_adapter, list_head);
|
||||
if (adap->num == num)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int dvbdev_get_free_adapter_num (void)
|
||||
{
|
||||
int num = 0;
|
||||
|
||||
while (num < DVB_MAX_ADAPTERS) {
|
||||
struct dvb_adapter *adap;
|
||||
list_for_each_entry(adap, &dvb_adapter_list, list_head)
|
||||
if (adap->num == num)
|
||||
goto skip;
|
||||
return num;
|
||||
skip:
|
||||
if (dvbdev_check_free_adapter_num(num))
|
||||
return num;
|
||||
num++;
|
||||
}
|
||||
|
||||
@@ -281,13 +287,28 @@ skip:
|
||||
}
|
||||
|
||||
|
||||
int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct module *module, struct device *device)
|
||||
int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
|
||||
struct module *module, struct device *device,
|
||||
short *adapter_nums)
|
||||
{
|
||||
int num;
|
||||
int i, num;
|
||||
|
||||
mutex_lock(&dvbdev_register_lock);
|
||||
|
||||
if ((num = dvbdev_get_free_adapter_num ()) < 0) {
|
||||
for (i = 0; i < DVB_MAX_ADAPTERS; ++i) {
|
||||
num = adapter_nums[i];
|
||||
if (num >= 0 && num < DVB_MAX_ADAPTERS) {
|
||||
/* use the one the driver asked for */
|
||||
if (dvbdev_check_free_adapter_num(num))
|
||||
break;
|
||||
} else {
|
||||
num = dvbdev_get_free_adapter_num();
|
||||
break;
|
||||
}
|
||||
num = -1;
|
||||
}
|
||||
|
||||
if (num < 0) {
|
||||
mutex_unlock(&dvbdev_register_lock);
|
||||
return -ENFILE;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
|
||||
#define DVB_MAJOR 212
|
||||
|
||||
#define DVB_MAX_ADAPTERS 8
|
||||
|
||||
#define DVB_UNSET (-1)
|
||||
|
||||
#define DVB_DEVICE_VIDEO 0
|
||||
#define DVB_DEVICE_AUDIO 1
|
||||
#define DVB_DEVICE_SEC 2
|
||||
@@ -41,6 +45,11 @@
|
||||
#define DVB_DEVICE_NET 7
|
||||
#define DVB_DEVICE_OSD 8
|
||||
|
||||
#define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
|
||||
static short adapter_nr[] = \
|
||||
{[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
|
||||
module_param_array(adapter_nr, short, NULL, 0444); \
|
||||
MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
|
||||
|
||||
struct dvb_adapter {
|
||||
int num;
|
||||
@@ -78,7 +87,9 @@ struct dvb_device {
|
||||
};
|
||||
|
||||
|
||||
extern int dvb_register_adapter (struct dvb_adapter *adap, const char *name, struct module *module, struct device *device);
|
||||
extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
|
||||
struct module *module, struct device *device,
|
||||
short *adapter_nums);
|
||||
extern int dvb_unregister_adapter (struct dvb_adapter *adap);
|
||||
|
||||
extern int dvb_register_device (struct dvb_adapter *adap,
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debugging level (rc=1 (or-able))." DVB_USB_DEBUG_STATUS);
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
#define deb_rc(args...) dprintk(debug,0x01,args)
|
||||
|
||||
static int a800_power_ctrl(struct dvb_usb_device *d, int onoff)
|
||||
@@ -94,7 +97,8 @@ static struct dvb_usb_device_properties a800_properties;
|
||||
static int a800_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
return dvb_usb_device_init(intf,&a800_properties,THIS_MODULE,NULL);
|
||||
return dvb_usb_device_init(intf, &a800_properties,
|
||||
THIS_MODULE, NULL, adapter_nr);
|
||||
}
|
||||
|
||||
/* do not change the order of the ID table */
|
||||
|
||||
@@ -39,6 +39,8 @@ int dvb_usb_af9005_dump_eeprom = 0;
|
||||
module_param_named(dump_eeprom, dvb_usb_af9005_dump_eeprom, int, 0);
|
||||
MODULE_PARM_DESC(dump_eeprom, "dump contents of the eeprom.");
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
/* remote control decoder */
|
||||
int (*rc_decode) (struct dvb_usb_device * d, u8 * data, int len, u32 * event,
|
||||
int *state);
|
||||
@@ -1020,7 +1022,8 @@ static struct dvb_usb_device_properties af9005_properties;
|
||||
static int af9005_usb_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
return dvb_usb_device_init(intf, &af9005_properties, THIS_MODULE, NULL);
|
||||
return dvb_usb_device_init(intf, &af9005_properties,
|
||||
THIS_MODULE, NULL, adapter_nr);
|
||||
}
|
||||
|
||||
static struct usb_device_id af9005_usb_table[] = {
|
||||
|
||||
@@ -19,6 +19,8 @@ static int dvb_usb_au6610_debug;
|
||||
module_param_named(debug, dvb_usb_au6610_debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
|
||||
u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
|
||||
{
|
||||
@@ -163,7 +165,9 @@ static int au6610_probe(struct usb_interface *intf,
|
||||
if (intf->num_altsetting < AU6610_ALTSETTING_COUNT)
|
||||
return -ENODEV;
|
||||
|
||||
if ((ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d)) == 0) {
|
||||
ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d,
|
||||
adapter_nr);
|
||||
if (ret == 0) {
|
||||
alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING);
|
||||
|
||||
if (alt == NULL) {
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
static int dvb_usb_cxusb_debug;
|
||||
module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
#define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args)
|
||||
#define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \
|
||||
dprintk(dvb_usb_cxusb_debug,0x01,args)
|
||||
@@ -723,16 +726,24 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
|
||||
static int cxusb_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&cxusb_bluebird_dualdig4_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&cxusb_bluebird_nano2_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&cxusb_bluebird_nano2_needsfirmware_properties,THIS_MODULE,NULL) == 0) {
|
||||
if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf,
|
||||
&cxusb_bluebird_nano2_needsfirmware_properties,
|
||||
THIS_MODULE, NULL, adapter_nr))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ int dvb_usb_dib0700_ir_proto = 1;
|
||||
module_param(dvb_usb_dib0700_ir_proto, int, 0644);
|
||||
MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, "set ir protocol (0=NEC, 1=RC5 (default), 2=RC6).");
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
/* expecting rx buffer: request data[0] data[1] ... data[2] */
|
||||
static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
|
||||
{
|
||||
@@ -279,7 +281,8 @@ static int dib0700_probe(struct usb_interface *intf,
|
||||
struct dvb_usb_device *dev;
|
||||
|
||||
for (i = 0; i < dib0700_device_count; i++)
|
||||
if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE, &dev) == 0)
|
||||
if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE,
|
||||
&dev, adapter_nr) == 0)
|
||||
{
|
||||
dib0700_rc_setup(dev);
|
||||
return 0;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
#include "dibusb.h"
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
static int dib3000mb_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
|
||||
{
|
||||
struct dvb_usb_adapter *adap = fe->dvb->priv;
|
||||
@@ -107,10 +109,14 @@ static struct dvb_usb_device_properties artec_t1_usb2_properties;
|
||||
static int dibusb_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&artec_t1_usb2_properties,THIS_MODULE,NULL) == 0)
|
||||
if (0 == dvb_usb_device_init(intf, &dibusb1_1_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &dibusb1_1_an2235_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &dibusb2_0b_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &artec_t1_usb2_properties,
|
||||
THIS_MODULE, NULL, adapter_nr))
|
||||
return 0;
|
||||
|
||||
return -EINVAL;
|
||||
|
||||
@@ -14,13 +14,16 @@
|
||||
*/
|
||||
#include "dibusb.h"
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
/* USB Driver stuff */
|
||||
static struct dvb_usb_device_properties dibusb_mc_properties;
|
||||
|
||||
static int dibusb_mc_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
return dvb_usb_device_init(intf,&dibusb_mc_properties,THIS_MODULE,NULL);
|
||||
return dvb_usb_device_init(intf, &dibusb_mc_properties, THIS_MODULE,
|
||||
NULL, adapter_nr);
|
||||
}
|
||||
|
||||
/* do not change the order of the ID table */
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
static int dvb_usb_digitv_debug;
|
||||
module_param_named(debug,dvb_usb_digitv_debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
#define deb_rc(args...) dprintk(dvb_usb_digitv_debug,0x01,args)
|
||||
|
||||
static int digitv_ctrl_msg(struct dvb_usb_device *d,
|
||||
@@ -256,8 +259,9 @@ static int digitv_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct dvb_usb_device *d;
|
||||
int ret;
|
||||
if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) {
|
||||
int ret = dvb_usb_device_init(intf, &digitv_properties, THIS_MODULE, &d,
|
||||
adapter_nr);
|
||||
if (ret == 0) {
|
||||
u8 b[4] = { 0 };
|
||||
|
||||
if (d != NULL) { /* do that only when the firmware is loaded */
|
||||
|
||||
@@ -18,6 +18,8 @@ int dvb_usb_dtt200u_debug;
|
||||
module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS);
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
|
||||
{
|
||||
u8 b = SET_INIT;
|
||||
@@ -101,11 +103,16 @@ static struct dvb_usb_device_properties wt220u_miglia_properties;
|
||||
static int dtt200u_usb_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&wt220u_fc_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&wt220u_zl0353_properties,THIS_MODULE,NULL) == 0 ||
|
||||
dvb_usb_device_init(intf,&wt220u_miglia_properties,THIS_MODULE,NULL) == 0)
|
||||
if (0 == dvb_usb_device_init(intf, &dtt200u_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &wt220u_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &wt220u_fc_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &wt220u_zl0353_properties,
|
||||
THIS_MODULE, NULL, adapter_nr) ||
|
||||
0 == dvb_usb_device_init(intf, &wt220u_miglia_properties,
|
||||
THIS_MODULE, NULL, adapter_nr))
|
||||
return 0;
|
||||
|
||||
return -ENODEV;
|
||||
|
||||
@@ -40,7 +40,8 @@ extern int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap);
|
||||
extern int dvb_usb_i2c_init(struct dvb_usb_device *);
|
||||
extern int dvb_usb_i2c_exit(struct dvb_usb_device *);
|
||||
|
||||
extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap);
|
||||
extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap,
|
||||
short *adapter_nums);
|
||||
extern int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap);
|
||||
extern int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap);
|
||||
extern int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap);
|
||||
|
||||
@@ -77,12 +77,13 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
|
||||
return dvb_usb_ctrl_feed(dvbdmxfeed,0);
|
||||
}
|
||||
|
||||
int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap)
|
||||
int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums)
|
||||
{
|
||||
int ret;
|
||||
int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name,
|
||||
adap->dev->owner, &adap->dev->udev->dev,
|
||||
adapter_nums);
|
||||
|
||||
if ((ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name,
|
||||
adap->dev->owner, &adap->dev->udev->dev)) < 0) {
|
||||
if (ret < 0) {
|
||||
deb_info("dvb_register_adapter failed: error %d", ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ static int dvb_usb_force_pid_filter_usage;
|
||||
module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444);
|
||||
MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0).");
|
||||
|
||||
static int dvb_usb_adapter_init(struct dvb_usb_device *d)
|
||||
static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
|
||||
{
|
||||
struct dvb_usb_adapter *adap;
|
||||
int ret,n;
|
||||
@@ -72,7 +72,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d)
|
||||
}
|
||||
|
||||
if ((ret = dvb_usb_adapter_stream_init(adap)) ||
|
||||
(ret = dvb_usb_adapter_dvb_init(adap)) ||
|
||||
(ret = dvb_usb_adapter_dvb_init(adap, adapter_nrs)) ||
|
||||
(ret = dvb_usb_adapter_frontend_init(adap))) {
|
||||
return ret;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ static int dvb_usb_exit(struct dvb_usb_device *d)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dvb_usb_init(struct dvb_usb_device *d)
|
||||
static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -143,7 +143,7 @@ static int dvb_usb_init(struct dvb_usb_device *d)
|
||||
dvb_usb_device_power_ctrl(d, 1);
|
||||
|
||||
if ((ret = dvb_usb_i2c_init(d)) ||
|
||||
(ret = dvb_usb_adapter_init(d))) {
|
||||
(ret = dvb_usb_adapter_init(d, adapter_nums))) {
|
||||
dvb_usb_exit(d);
|
||||
return ret;
|
||||
}
|
||||
@@ -213,8 +213,10 @@ int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff)
|
||||
/*
|
||||
* USB
|
||||
*/
|
||||
int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_properties
|
||||
*props, struct module *owner,struct dvb_usb_device **du)
|
||||
int dvb_usb_device_init(struct usb_interface *intf,
|
||||
struct dvb_usb_device_properties *props,
|
||||
struct module *owner, struct dvb_usb_device **du,
|
||||
short *adapter_nums)
|
||||
{
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
struct dvb_usb_device *d = NULL;
|
||||
@@ -254,7 +256,7 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_proper
|
||||
if (du != NULL)
|
||||
*du = d;
|
||||
|
||||
ret = dvb_usb_init(d);
|
||||
ret = dvb_usb_init(d, adapter_nums);
|
||||
|
||||
if (ret == 0)
|
||||
info("%s successfully initialized and connected.",desc->name);
|
||||
|
||||
@@ -372,7 +372,10 @@ struct dvb_usb_device {
|
||||
void *priv;
|
||||
};
|
||||
|
||||
extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_device_properties *, struct module *, struct dvb_usb_device **);
|
||||
extern int dvb_usb_device_init(struct usb_interface *,
|
||||
struct dvb_usb_device_properties *,
|
||||
struct module *, struct dvb_usb_device **,
|
||||
short *adapter_nums);
|
||||
extern void dvb_usb_device_exit(struct usb_interface *);
|
||||
|
||||
/* the generic read/write method for device control */
|
||||
|
||||
@@ -16,6 +16,8 @@ static int dvb_usb_gl861_debug;
|
||||
module_param_named(debug,dvb_usb_gl861_debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
|
||||
u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
|
||||
{
|
||||
@@ -140,7 +142,9 @@ static int gl861_probe(struct usb_interface *intf,
|
||||
if (intf->num_altsetting < 2)
|
||||
return -ENODEV;
|
||||
|
||||
if ((ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d)) == 0) {
|
||||
ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d,
|
||||
adapter_nr);
|
||||
if (ret == 0) {
|
||||
alt = usb_altnum_to_altsetting(intf, 0);
|
||||
|
||||
if (alt == NULL) {
|
||||
|
||||
@@ -22,6 +22,8 @@ int dvb_usb_gp8psk_debug;
|
||||
module_param_named(debug,dvb_usb_gp8psk_debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
|
||||
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen)
|
||||
{
|
||||
int ret = 0,try = 0;
|
||||
@@ -190,7 +192,8 @@ static int gp8psk_usb_probe(struct usb_interface *intf,
|
||||
{
|
||||
int ret;
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
ret = dvb_usb_device_init(intf,&gp8psk_properties,THIS_MODULE,NULL);
|
||||
ret = dvb_usb_device_init(intf, &gp8psk_properties,
|
||||
THIS_MODULE, NULL, adapter_nr);
|
||||
if (ret == 0) {
|
||||
info("found Genpix USB device pID = %x (hex)",
|
||||
le16_to_cpu(udev->descriptor.idProduct));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user