Commit:     99cfdf5cc6dbe0bd748d810953874d4e08051a9f
Parent:     2fdf3d9c94f7f752dacbebb75bbecda3c1b082a0
Author:     Pantelis Koukousoulas <[EMAIL PROTECTED]>
AuthorDate: Wed Dec 27 23:08:55 2006 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Wed Feb 21 13:34:23 2007 -0200

    V4L/DVB (5038): Pvrusb2: Implement stream claim checking function
    Add (and expose) a new function, pvr2_channel_check_stream_no_lock(), in
    pvrusb2-context.c. This is hopefully the last V4L2 interface related patch
    to change anything outside pvrusb2-v4l2.c.
    We need this to implement the open() for the radio device. The reason is
    that within the *enter_context() section of open() we need to ensure nobody
    is streaming and if we cannot, we should cleanup after ourselves and return
     -EBUSY. We cannot just use claim_stream() because:
       1) That would cause a deadlock trying to re-acquire the context lock
       2) We only need to ensure that nobody is streaming. We don't need to
          actually acquire the stream.
    Again, this is a kinda ugly patch. Feel free to improve.
    Signed-off-by: Pantelis Koukousoulas <[EMAIL PROTECTED]>
    Signed-off-by: Mike Isely <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
 drivers/media/video/pvrusb2/pvrusb2-context.c |   11 +++++++++++
 drivers/media/video/pvrusb2/pvrusb2-context.h |    2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/pvrusb2/pvrusb2-context.c 
index cf12974..69786cd 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-context.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-context.c
@@ -188,6 +188,17 @@ void pvr2_channel_done(struct pvr2_channel *cp)
+int pvr2_channel_check_stream_no_lock(struct pvr2_channel *cp,
+                             struct pvr2_context_stream *sp)
+       if (sp == cp->stream) return 0;
+       if (sp->user) {
+               return -EBUSY;
+       }
+       return 0;
 int pvr2_channel_claim_stream(struct pvr2_channel *cp,
                              struct pvr2_context_stream *sp)
diff --git a/drivers/media/video/pvrusb2/pvrusb2-context.h 
index 6327fa1..4d0f4ad 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-context.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-context.h
@@ -76,6 +76,8 @@ void pvr2_channel_init(struct pvr2_channel *,struct 
pvr2_context *);
 void pvr2_channel_done(struct pvr2_channel *);
 int pvr2_channel_claim_stream(struct pvr2_channel *,
                              struct pvr2_context_stream *);
+int pvr2_channel_check_stream_no_lock(struct pvr2_channel *,
+                             struct pvr2_context_stream *);
 struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
        struct pvr2_context_stream *);
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to