summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMatthias Benesch <twoof7@freenet.de>2009-12-23 05:55:02 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 15:10:54 -0300
commitcf1b12f2b355a29c44dad426f545db8fa26bd81c (patch)
treeba96908a51c907b1a6a9d5ef4cf33c047bacf781 /drivers/media/dvb
parent126cd4bc5fa9cdbedb89bbe7e568140c94900ca7 (diff)
downloadlinux-stable-cf1b12f2b355a29c44dad426f545db8fa26bd81c.tar.gz
linux-stable-cf1b12f2b355a29c44dad426f545db8fa26bd81c.tar.bz2
linux-stable-cf1b12f2b355a29c44dad426f545db8fa26bd81c.zip
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: Matthias Benesch <twoof7@freenet.de> Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/ngene/ngene-core.c45
-rw-r--r--drivers/media/dvb/ngene/ngene.h9
2 files changed, 22 insertions, 32 deletions
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c
index 7d9feba71e11..907a5032784e 100644
--- a/drivers/media/dvb/ngene/ngene-core.c
+++ b/drivers/media/dvb/ngene/ngene-core.c
@@ -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",
- THIS_MODULE,
- &chan->dev->pci_dev->dev,
- adapter_nr);
- if (ret < 0)
- return ret;
- adapter = &chan->dvb_adapter;
-#endif
+ 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;
+ } 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;
diff --git a/drivers/media/dvb/ngene/ngene.h b/drivers/media/dvb/ngene/ngene.h
index 243f86c85897..15505c2b2534 100644
--- a/drivers/media/dvb/ngene/ngene.h
+++ b/drivers/media/dvb/ngene/ngene.h
@@ -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;