aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/pvrusb2/pvrusb2-context.h
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-04-07 02:22:04 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 14:09:48 -0300
commite5be15c63804e05b5a94197524023702a259e308 (patch)
tree4223cab8016088a06d0423e1e41eacb646867c46 /drivers/media/video/pvrusb2/pvrusb2-context.h
parentd913d6303072ca194919d851e6743ad8c3a7563d (diff)
V4L/DVB (7711): pvrusb2: Fix race on module unload
The pvrusb2 driver - for basically forever - was not enforcing a proper module tear-down. Kernel threads are used inside the driver and all must be gone before the module can be safely removed. This changeset reimplements a chunk of pvrusb2-context.c to enforce this correctly. Unfortunately this is not a simple fix. The new implementation also cuts back on kernel thread usage; instead of there being 1 control thread per instance now it's just 1 control thread shared by all instances. (By dropping to a single thread then the module exit function can block on its shutdown and the thread itself can monitor and cleanly shut down all of the other instances first.) Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-context.h')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-context.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-context.h b/drivers/media/video/pvrusb2/pvrusb2-context.h
index 127ec53e091..6fb6ab02285 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-context.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-context.h
@@ -40,14 +40,17 @@ struct pvr2_context_stream {
struct pvr2_context {
struct pvr2_channel *mc_first;
struct pvr2_channel *mc_last;
+ struct pvr2_context *exist_next;
+ struct pvr2_context *exist_prev;
+ struct pvr2_context *notify_next;
+ struct pvr2_context *notify_prev;
struct pvr2_hdw *hdw;
struct pvr2_context_stream video_stream;
struct mutex mutex;
int notify_flag;
+ int initialized_flag;
int disconnect_flag;
- wait_queue_head_t wait_data;
-
/* Called after pvr2_context initialization is complete */
void (*setup_func)(struct pvr2_context *);
@@ -74,6 +77,8 @@ int pvr2_channel_claim_stream(struct pvr2_channel *,
struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
struct pvr2_context_stream *);
+int pvr2_context_global_init(void);
+void pvr2_context_global_done(void);
#endif /* __PVRUSB2_CONTEXT_H */
/*