summaryrefslogtreecommitdiff
path: root/v4l_experimental/pvrusb2/pvrusb2-context.c
diff options
context:
space:
mode:
Diffstat (limited to 'v4l_experimental/pvrusb2/pvrusb2-context.c')
-rw-r--r--v4l_experimental/pvrusb2/pvrusb2-context.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/v4l_experimental/pvrusb2/pvrusb2-context.c b/v4l_experimental/pvrusb2/pvrusb2-context.c
index b0faa9a44..483aba179 100644
--- a/v4l_experimental/pvrusb2/pvrusb2-context.c
+++ b/v4l_experimental/pvrusb2/pvrusb2-context.c
@@ -1,5 +1,5 @@
/*
- * $Id: pvrusb2-context.c,v 1.1 2005/11/14 13:31:24 mchehab Exp $
+ * $Id: pvrusb2-context.c,v 1.2 2006/01/01 08:26:03 mcisely Exp $
*
* Copyright (C) 2005 Mike Isely <isely@pobox.com>
*
@@ -38,12 +38,31 @@ static void pvr2_context_destroy(struct pvr2_context *mp)
}
+static void pvr2_context_trigger_poll(struct pvr2_context *mp)
+{
+ queue_work(mp->workqueue,&mp->workpoll);
+}
+
+
+static void pvr2_context_poll(struct pvr2_context *mp)
+{
+ pvr2_trace(PVR2_TRACE_DEBUG,"pvr2_context_poll BEGIN");
+ pvr2_context_enter(mp); do {
+ pvr2_hdw_poll(mp->hdw);
+ } while (0); pvr2_context_exit(mp);
+ pvr2_trace(PVR2_TRACE_DEBUG,"pvr2_context_poll END");
+}
+
+
static void pvr2_context_setup(struct pvr2_context *mp)
{
pvr2_context_enter(mp); do {
- (mp->kthread_ref_count)--;
if (!pvr2_hdw_dev_ok(mp->hdw)) break;
pvr2_hdw_setup(mp->hdw);
+ pvr2_hdw_setup_poll_trigger(
+ mp->hdw,
+ (void (*)(void *))pvr2_context_trigger_poll,
+ mp);
if (!pvr2_hdw_dev_ok(mp->hdw)) break;
if (!pvr2_hdw_init_ok(mp->hdw)) break;
mp->video_stream.stream = pvr2_hdw_get_video_stream(mp->hdw);
@@ -72,8 +91,8 @@ struct pvr2_context *pvr2_context_create(
}
mp->workqueue = create_singlethread_workqueue("pvrusb2");
- (mp->kthread_ref_count)++;
INIT_WORK(&mp->workinit,(void (*)(void*))pvr2_context_setup,mp);
+ INIT_WORK(&mp->workpoll,(void (*)(void*))pvr2_context_poll,mp);
queue_work(mp->workqueue,&mp->workinit);
done:
return mp;
@@ -90,9 +109,7 @@ void pvr2_context_enter(struct pvr2_context *mp)
void pvr2_context_exit(struct pvr2_context *mp)
{
int destroy_flag = 0;
- if (!(mp->mc_first ||
- (!mp->disconnect_flag) ||
- mp->kthread_ref_count)) {
+ if (!(mp->mc_first || !mp->disconnect_flag)) {
destroy_flag = !0;
}
pvr2_trace(PVR2_TRACE_CREG,"pvr2_context_exit(id=%p) outside",mp);