Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 92753
b: refs/heads/master
c: d8abe97
h: refs/heads/master
i:
  92751: afdcc26
v: v3
  • Loading branch information
Michael Krufky authored and Mauro Carvalho Chehab committed Apr 24, 2008
1 parent 5b27713 commit 26b9f33
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 99443ae04f7002530f666ba0747f7b1ecafb3002
refs/heads/master: d8abe97d0063cf77e9bbbee076181e4657c7e09c
44 changes: 42 additions & 2 deletions trunk/drivers/media/video/pvrusb2/pvrusb2-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,64 @@
*
*/

#include <linux/kthread.h>
#include "dvbdev.h"
#include "pvrusb2-hdw-internal.h"
#include "pvrusb2-hdw.h"
#include "pvrusb2-dvb.h"

DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);

static int pvr2_dvb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
{
struct pvr2_dvb_adapter *adap = dvbdmxfeed->demux->priv;
int newfeedcount, ret = 0;

if (adap == NULL)
return -ENODEV;

mutex_lock(&adap->lock);
newfeedcount = adap->feedcount + (onoff ? 1 : -1);

if (newfeedcount == 0) {
printk(KERN_DEBUG "stop feeding\n");

ret = kthread_stop(adap->thread);
adap->thread = NULL;
}

adap->feedcount = newfeedcount;

if (adap->feedcount == onoff && adap->feedcount > 0) {
if (NULL != adap->thread)
goto fail;

printk(KERN_DEBUG "start feeding\n");

if (IS_ERR(adap->thread)) {
ret = PTR_ERR(adap->thread);
adap->thread = NULL;
}
//ret = newfeedcount;
}
fail:
mutex_unlock(&adap->lock);

return ret;
}

static int pvr2_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
{
printk(KERN_DEBUG "start pid: 0x%04x, feedtype: %d\n",
dvbdmxfeed->pid, dvbdmxfeed->type);
return 0; /* FIXME: pvr2_dvb_ctrl_feed(dvbdmxfeed, 1); */
return pvr2_dvb_ctrl_feed(dvbdmxfeed, 1);
}

static int pvr2_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
{
printk(KERN_DEBUG "stop pid: 0x%04x, feedtype: %d\n",
dvbdmxfeed->pid, dvbdmxfeed->type);
return 0; /* FIXME: pvr2_dvb_ctrl_feed(dvbdmxfeed, 0); */
return pvr2_dvb_ctrl_feed(dvbdmxfeed, 0);
}

static int pvr2_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire)
Expand Down Expand Up @@ -172,6 +211,7 @@ int pvr2_dvb_init(struct pvr2_context *pvr)
int ret = 0;

pvr->hdw->dvb.pvr = pvr;
mutex_init(&pvr->hdw->dvb.lock);

ret = pvr2_dvb_adapter_init(&pvr->hdw->dvb);
if (ret < 0)
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/media/video/pvrusb2/pvrusb2-dvb.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ struct pvr2_dvb_adapter {
int feedcount;
int max_feed_count;

struct task_struct *thread;
struct mutex lock;

unsigned int digital_up:1;
};

Expand Down

0 comments on commit 26b9f33

Please sign in to comment.