aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 @@
52#include "ngene-ioctls.h" 52#include "ngene-ioctls.h"
53#endif 53#endif
54 54
55static int one_adapter = 1;
56module_param(one_adapter, int, 0444);
57MODULE_PARM_DESC(one_adapter, "Use only one adapter.");
58
55static int copy_eeprom; 59static int copy_eeprom;
56module_param(copy_eeprom, int, 0444); 60module_param(copy_eeprom, int, 0444);
57MODULE_PARM_DESC(copy_eeprom, "Copy eeprom."); 61MODULE_PARM_DESC(copy_eeprom, "Copy eeprom.");
@@ -2444,9 +2448,9 @@ static void release_channel(struct ngene_channel *chan)
2444 &chan->mem_frontend); 2448 &chan->mem_frontend);
2445 dvb_dmxdev_release(&chan->dmxdev); 2449 dvb_dmxdev_release(&chan->dmxdev);
2446 dvb_dmx_release(&chan->demux); 2450 dvb_dmx_release(&chan->demux);
2447#ifndef ONE_ADAPTER 2451
2448 dvb_unregister_adapter(&chan->dvb_adapter); 2452 if (chan->number == 0 || !one_adapter)
2449#endif 2453 dvb_unregister_adapter(&dev->adapter[chan->number]);
2450 } 2454 }
2451 2455
2452} 2456}
@@ -2472,17 +2476,18 @@ static int init_channel(struct ngene_channel *chan)
2472 if (io & NGENE_IO_TSOUT) 2476 if (io & NGENE_IO_TSOUT)
2473 dec_fw_boot(dev); 2477 dec_fw_boot(dev);
2474 2478
2475#ifdef ONE_ADAPTER 2479 if (nr == 0 || !one_adapter) {
2476 adapter = &chan->dev->dvb_adapter; 2480 adapter = &dev->adapter[nr];
2477#else 2481 ret = dvb_register_adapter(adapter, "nGene",
2478 ret = dvb_register_adapter(&chan->dvb_adapter, "nGene", 2482 THIS_MODULE,
2479 THIS_MODULE, 2483 &chan->dev->pci_dev->dev,
2480 &chan->dev->pci_dev->dev, 2484 adapter_nr);
2481 adapter_nr); 2485 if (ret < 0)
2482 if (ret < 0) 2486 return ret;
2483 return ret; 2487 } else {
2484 adapter = &chan->dvb_adapter; 2488 adapter = &dev->adapter[0];
2485#endif 2489 }
2490
2486 ret = my_dvb_dmx_ts_card_init(dvbdemux, "SW demux", 2491 ret = my_dvb_dmx_ts_card_init(dvbdemux, "SW demux",
2487 ngene_start_feed, 2492 ngene_start_feed,
2488 ngene_stop_feed, chan); 2493 ngene_stop_feed, chan);
@@ -2527,7 +2532,7 @@ static int init_channels(struct ngene *dev)
2527 2532
2528 for (i = 0; i < MAX_STREAM; i++) { 2533 for (i = 0; i < MAX_STREAM; i++) {
2529 if (init_channel(&dev->channel[i]) < 0) { 2534 if (init_channel(&dev->channel[i]) < 0) {
2530 for (j = 0; j < i; j++) 2535 for (j = i - 1; j >= 0; j--)
2531 release_channel(&dev->channel[j]); 2536 release_channel(&dev->channel[j]);
2532 return -1; 2537 return -1;
2533 } 2538 }
@@ -2545,11 +2550,8 @@ static void __devexit ngene_remove(struct pci_dev *pdev)
2545 int i; 2550 int i;
2546 2551
2547 tasklet_kill(&dev->event_tasklet); 2552 tasklet_kill(&dev->event_tasklet);
2548 for (i = 0; i < MAX_STREAM; i++) 2553 for (i = MAX_STREAM - 1; i >= 0; i--)
2549 release_channel(&dev->channel[i]); 2554 release_channel(&dev->channel[i]);
2550#ifdef ONE_ADAPTER
2551 dvb_unregister_adapter(&dev->dvb_adapter);
2552#endif
2553 ngene_stop(dev); 2555 ngene_stop(dev);
2554 ngene_release_buffers(dev); 2556 ngene_release_buffers(dev);
2555 pci_set_drvdata(pdev, 0); 2557 pci_set_drvdata(pdev, 0);
@@ -2595,11 +2597,6 @@ static int __devinit ngene_probe(struct pci_dev *pci_dev,
2595 /*i2c_check_eeprom(&dev->i2c_adapter);*/ 2597 /*i2c_check_eeprom(&dev->i2c_adapter);*/
2596 2598
2597 /* Register DVB adapters and devices for both channels */ 2599 /* Register DVB adapters and devices for both channels */
2598#ifdef ONE_ADAPTER
2599 if (dvb_register_adapter(&dev->dvb_adapter, "nGene", THIS_MODULE,
2600 &dev->pci_dev->dev, adapter_nr) < 0)
2601 goto fail2;
2602#endif
2603 if (init_channels(dev) < 0) 2600 if (init_channels(dev) < 0)
2604 goto fail2; 2601 goto fail2;
2605 2602
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 @@
24#ifndef _NGENE_H_ 24#ifndef _NGENE_H_
25#define _NGENE_H_ 25#define _NGENE_H_
26 26
27/*#define ONE_ADAPTER*/
28
29#include <linux/types.h> 27#include <linux/types.h>
30#include <linux/sched.h> 28#include <linux/sched.h>
31#include <linux/interrupt.h> 29#include <linux/interrupt.h>
@@ -649,9 +647,6 @@ struct ngene_channel {
649 struct dmx_frontend mem_frontend; 647 struct dmx_frontend mem_frontend;
650 int users; 648 int users;
651 struct video_device *v4l_dev; 649 struct video_device *v4l_dev;
652#ifndef ONE_ADAPTER
653 struct dvb_adapter dvb_adapter;
654#endif
655 struct tasklet_struct demux_tasklet; 650 struct tasklet_struct demux_tasklet;
656 651
657 struct SBufferHeader *nextBuffer; 652 struct SBufferHeader *nextBuffer;
@@ -728,9 +723,6 @@ struct ngene {
728 struct pci_dev *pci_dev; 723 struct pci_dev *pci_dev;
729 unsigned char *iomem; 724 unsigned char *iomem;
730 725
731#ifdef ONE_ADAPTER
732 struct dvb_adapter dvb_adapter;
733#endif
734 /*struct i2c_adapter i2c_adapter;*/ 726 /*struct i2c_adapter i2c_adapter;*/
735 727
736 u32 device_version; 728 u32 device_version;
@@ -764,6 +756,7 @@ struct ngene {
764 int i2c_current_bus; 756 int i2c_current_bus;
765 spinlock_t cmd_lock; 757 spinlock_t cmd_lock;
766 758
759 struct dvb_adapter adapter[MAX_STREAM];
767 struct ngene_channel channel[MAX_STREAM]; 760 struct ngene_channel channel[MAX_STREAM];
768 761
769 struct ngene_info *card_info; 762 struct ngene_info *card_info;