Commit cf1b12f2 authored by Matthias Benesch's avatar Matthias Benesch Committed by Mauro Carvalho Chehab

V4L/DVB: ngene: Added module parameter "one_adapter"

If parameter "one_adapter" is set, only one adapter per device will be attached.
Otherwise an adapter for every frontend will be attached.
Signed-off-by: default avatarMatthias Benesch <twoof7@freenet.de>
Signed-off-by: default avatarOliver Endriss <o.endriss@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 126cd4bc
......@@ -52,6 +52,10 @@
#include "ngene-ioctls.h"
#endif
static int one_adapter = 1;
module_param(one_adapter, int, 0444);
MODULE_PARM_DESC(one_adapter, "Use only one adapter.");
static int copy_eeprom;
module_param(copy_eeprom, int, 0444);
MODULE_PARM_DESC(copy_eeprom, "Copy eeprom.");
......@@ -2444,9 +2448,9 @@ static void release_channel(struct ngene_channel *chan)
&chan->mem_frontend);
dvb_dmxdev_release(&chan->dmxdev);
dvb_dmx_release(&chan->demux);
#ifndef ONE_ADAPTER
dvb_unregister_adapter(&chan->dvb_adapter);
#endif
if (chan->number == 0 || !one_adapter)
dvb_unregister_adapter(&dev->adapter[chan->number]);
}
}
......@@ -2472,17 +2476,18 @@ static int init_channel(struct ngene_channel *chan)
if (io & NGENE_IO_TSOUT)
dec_fw_boot(dev);
#ifdef ONE_ADAPTER
adapter = &chan->dev->dvb_adapter;
#else
ret = dvb_register_adapter(&chan->dvb_adapter, "nGene",
if (nr == 0 || !one_adapter) {
adapter = &dev->adapter[nr];
ret = dvb_register_adapter(adapter, "nGene",
THIS_MODULE,
&chan->dev->pci_dev->dev,
adapter_nr);
if (ret < 0)
return ret;
adapter = &chan->dvb_adapter;
#endif
} else {
adapter = &dev->adapter[0];
}
ret = my_dvb_dmx_ts_card_init(dvbdemux, "SW demux",
ngene_start_feed,
ngene_stop_feed, chan);
......@@ -2527,7 +2532,7 @@ static int init_channels(struct ngene *dev)
for (i = 0; i < MAX_STREAM; i++) {
if (init_channel(&dev->channel[i]) < 0) {
for (j = 0; j < i; j++)
for (j = i - 1; j >= 0; j--)
release_channel(&dev->channel[j]);
return -1;
}
......@@ -2545,11 +2550,8 @@ static void __devexit ngene_remove(struct pci_dev *pdev)
int i;
tasklet_kill(&dev->event_tasklet);
for (i = 0; i < MAX_STREAM; i++)
for (i = MAX_STREAM - 1; i >= 0; i--)
release_channel(&dev->channel[i]);
#ifdef ONE_ADAPTER
dvb_unregister_adapter(&dev->dvb_adapter);
#endif
ngene_stop(dev);
ngene_release_buffers(dev);
pci_set_drvdata(pdev, 0);
......@@ -2595,11 +2597,6 @@ static int __devinit ngene_probe(struct pci_dev *pci_dev,
/*i2c_check_eeprom(&dev->i2c_adapter);*/
/* Register DVB adapters and devices for both channels */
#ifdef ONE_ADAPTER
if (dvb_register_adapter(&dev->dvb_adapter, "nGene", THIS_MODULE,
&dev->pci_dev->dev, adapter_nr) < 0)
goto fail2;
#endif
if (init_channels(dev) < 0)
goto fail2;
......
......@@ -24,8 +24,6 @@
#ifndef _NGENE_H_
#define _NGENE_H_
/*#define ONE_ADAPTER*/
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
......@@ -649,9 +647,6 @@ struct ngene_channel {
struct dmx_frontend mem_frontend;
int users;
struct video_device *v4l_dev;
#ifndef ONE_ADAPTER
struct dvb_adapter dvb_adapter;
#endif
struct tasklet_struct demux_tasklet;
struct SBufferHeader *nextBuffer;
......@@ -728,9 +723,6 @@ struct ngene {
struct pci_dev *pci_dev;
unsigned char *iomem;
#ifdef ONE_ADAPTER
struct dvb_adapter dvb_adapter;
#endif
/*struct i2c_adapter i2c_adapter;*/
u32 device_version;
......@@ -764,6 +756,7 @@ struct ngene {
int i2c_current_bus;
spinlock_t cmd_lock;
struct dvb_adapter adapter[MAX_STREAM];
struct ngene_channel channel[MAX_STREAM];
struct ngene_info *card_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment