History log of /drivers/media/video/pvrusb2/pvrusb2-context.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
64723b301846636accbfb1539ebda0835f683a72 25-May-2008 Mike Isely <isely@pobox.com> V4L/DVB (7936): pvrusb2: Remove svn Id keyword from all sources

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
a6a3a17b7fdaf824e6d73e8e4a94c9d149302f74 29-Apr-2008 Harvey Harrison <harvey.harrison@gmail.com> media: fix integer as NULL pointer warnings

drivers/media/video/v4l2-common.c:719:16: warning: Using plain integer as NULL pointer
drivers/media/video/au0828/au0828-dvb.c:122:19: warning: Using plain integer as NULL pointer
drivers/media/video/ivtv/ivtv-yuv.c:1101:22: warning: Using plain integer as NULL pointer
drivers/media/video/ivtv/ivtv-yuv.c:1102:23: warning: Using plain integer as NULL pointer
drivers/media/video/pvrusb2/pvrusb2-audio.c:78:39: warning: Using plain integer as NULL pointer
drivers/media/video/pvrusb2/pvrusb2-video-v4l.c:84:39: warning: Using plain integer as NULL pointer
drivers/media/video/pvrusb2/pvrusb2-v4l2.c:1264:9: warning: Using plain integer as NULL pointer
drivers/media/video/pvrusb2/pvrusb2-context.c:197:28: warning: Using plain integer as NULL pointer
drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c:126:39: warning: Using plain integer as NULL pointer
drivers/media/video/pvrusb2/pvrusb2-dvb.c:133:32: warning: Using plain integer as NULL pointer
drivers/media/video/pvrusb2/pvrusb2-dvb.c:145:31: warning: Using plain integer as NULL pointer
drivers/media/video/pvrusb2/pvrusb2-dvb.c:177:55: warning: Using plain integer as NULL pointer
drivers/media/video/videobuf-core.c:100:9: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
1cb03b76d09d20accfa5c1664c16ba6566f539a0 21-Apr-2008 Mike Isely <isely@pobox.com> V4L/DVB (7719): pvrusb2: Implement input selection enforcement

In the pvrusb2 driver, different interfaces (e.g. V4L, DVB) have

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
18ecbb4771eb0ecf297e996966b3c42f69cd6c02 09-Apr-2008 Mike Isely <isely@pobox.com> V4L/DVB (7714): pvrusb2: Fix hang on module removal

The pvrusb2 driver was getting had by this scenario:

1. Task A calls kthread_stop() for task B.
2. Before exiting, then Task B calls kthread_stop() for task C.

The problem is, kthread_stop() wants to allocate an internal resource
to itself (i.e. acquire a lock), which won't be released until
kthread_stop() returns. But kthread_stop() won't return until task B
is dead. But task B won't die until it finishes its call to
kthread_stop() for task C, and that will block waiting on the resource
already allocated inside task A. Deadlock.

With the pvrusb2 driver, task A is the caller to pvr_exit(), task B is
the control thread run inside of pvrusb2-context.c, and task C is any
worker thread run inside of pvrusb2-hdw.c.

This problem got introduced by the previous threading setup change,
which was itself an attempt to fix a module tear-down race (which it
actually did fix). The lesson here is that a task being waited on as
part of a kthread_stop() simply cannot be allow to also issue a
kthread_stop() - or we make sure not to issue the enclosing
kthread_stop() until we know that the inner kthread_stop() has
completed first. The solution for the pvrusb2 driver is some hackish
code which changes the main control thread tear down into a two step
process. This then makes it possible to delay issuing the
kthread_stop() on the control thread until after we know that
everything has been torn down first. (And yes, we really need that
kthread_stop() because it's the only way to safely guarantee that a
module-referencing kernel thread has safely returned back out of the
module before we finally remove the module.)

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
e5be15c63804e05b5a94197524023702a259e308 07-Apr-2008 Mike Isely <isely@pobox.com> 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>
/drivers/media/video/pvrusb2/pvrusb2-context.c
794b16072e00d0a40a8c773dd4319fb1e460a632 22-Apr-2008 Mike Isely <isely@pobox.com> V4L/DVB (7321): pvrusb2: Rework context handling and initialization

This change significantly rearranges pvr2_context level initialization
and operation:

1. A new kernel thread is set up for management of the context.

2. Destruction of the pvr2_context instance is moved into the kernel
thread. No other context is able to remove the instance; doing
this simplifies lock handling.

3. The callback into pvrusb2-main, which is used to trigger
initialization of each interface, is now issued from this kernel
thread. Previously it had been indirectly issued out of the work
queue thread in pvr2_hdw, which led to deadlock issues if the
interface needed to change a control setting (which in turn
requires dispatch of another work queue entry).

4. Callbacks into the interfaces (via the pvr2_channel structure) are
now issued strictly from this thread. The net result of this is
that such callback functions can now also safely operate driver
controls without deadlocking the work queue. (At the moment this
is not actually a problem, but I'm anticipating issues with this in
the future).

5. There is no longer any need for anyone to enter / exit the
pvr2_context structure. Implementation of the kernel thread here
allows this all to be internal now, simplifying other logic.

6. A very very longstanding issue involving a mutex deadlock between
the pvrusb2 driver and v4l should now be solved. The deadlock
involved the pvr2_context mutex and a globals-protecting mutex in
v4l. During initialization the driver would take the pvr2_context
mutex first then the v4l2 interface would register with v4l and
implicitly take the v4l mutex. Later when v4l would call back into
the driver, the two mutexes could possibly be taken in the opposite
order, a situation that can lead to deadlock. In practice this
really wasn't an issue unless a v4l app tried to start VERY early
after the driver appeared. However it still needed to be solved,
and with the use of the kernel thread relieving need for
pvr2_context mutex, the problem should be finally solved.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
c4a8828ddbf5fb445d2679ab006d5743540fc41a 22-Apr-2008 Mike Isely <isely@pobox.com> V4L/DVB (7319): pvrusb2: Close potential race condition during initialization

There is a callback that is issued to into pvr2_context from pvr2_hdw
after initialization is done. There was a probability that this
callback could get missed. Fixed.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
99a6acf9a7a80da49e85be964b15ffed9ab7643e 22-Apr-2008 Mike Isely <isely@pobox.com> V4L/DVB (7306): pvrusb2: Fix oops possible when claiming a NULL stream

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
d3135846f6c1858dbad6ccb780a42e6c98953e6d 19-Apr-2008 Matthew Wilcox <matthew@wil.cx> drivers: Remove unnecessary inclusions of asm/semaphore.h

None of these files use any of the functionality promised by
asm/semaphore.h. It's possible that they rely on it dragging in some
unrelated header file, but I can't build all these files, so we'll have
fix any build failures as they come up.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
/drivers/media/video/pvrusb2/pvrusb2-context.c
681c739944018d80dbcf7f19997eba97676c7116 26-Nov-2007 Mike Isely <isely@pobox.com> V4L/DVB (6691): pvrusb2: Rework pipeline state control

This is a new implementation for video pipeline control within the
pvrusb2 driver. Actual start/stop of the pipeline is moved to the
driver's kernel thread. Pipeline stages are controlled autonomously
based on surrounding pipeline or application control state. Kernel
thread management is also cleaned up and moved into the internal
control structure of the driver, solving a set up / tear down race
along the way. Better failure recovery is implemented with this new
control strategy. Also with this change comes better control of the
cx23416 encoder, building on additional information learned about the
peculiarities of controlling this part (this information was the
original trigger for this rework). With this change, overall encoder
stability should be considerably improved. Yes, this is a large
change for this driver, but due to the nature of the feature being
worked on, the changes are fairly pervasive and would be difficult to
break into smaller pieces with any semblence of step-wise stability.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
747f07961e9450058522840129cd7bb994f05fb9 09-Sep-2007 Mike Isely <isely@pobox.com> V4L/DVB (6205): pvrusb2: Fix oops in error leg cleanup

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
ca545f7c39476c6c4c6e639452180a2b38342669 20-Jan-2007 Mike Isely <isely@pobox.com> V4L/DVB (5091): Pvrusb2: Use kzalloc in place of kmalloc/memset pairs

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
62f5fdace7774a45e75e4d651237e7e1e8f05327 28-Dec-2006 Mike Isely <isely@pobox.com> V4L/DVB (5052): Pvrusb2: Remove stream claiming hack from /dev/radio

Trying to temporarily check that the stream is not claimed during open
of the radio device is at best a race condition. What's to stop
another app from claiming the stream anyway the instant after the
check is done? The implementation for this was dicey anyway. So it's
removed. The only "price" for this is that if /dev/radioX is opened
while streaming video, then the video stream is just going to switch
to radio mode anyway. If a user does this, he gets what he expects...

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
99cfdf5cc6dbe0bd748d810953874d4e08051a9f 28-Dec-2006 Pantelis Koukousoulas <pakt223@freemail.gr> 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 <pakt223@freemail.gr>
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
c4028958b6ecad064b1a6303a6a5906d4fe48d73 22-Nov-2006 David Howells <dhowells@redhat.com> WorkStruct: make allyesconfig

Fix up for make allyesconfig.

Signed-Off-By: David Howells <dhowells@redhat.com>
/drivers/media/video/pvrusb2/pvrusb2-context.c
a0fd1cb171e8b17339a9a18ae7cf09c50022010f 30-Jun-2006 Mike Isely <isely@pobox.com> V4L/DVB (4288): Clean out a zillion sparse warnings in pvrusb2

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c
d855497edbfbf9e19a17f4a1154bca69cb4bd9ba 27-Jun-2006 Mike Isely <isely@isely.net> V4L/DVB (4228a): pvrusb2 to kernel 2.6.18

Implement V4L2 driver for the Hauppauge PVR USB2 TV tuner.

The Hauppauge PVR USB2 is a USB connected TV tuner with an embedded
cx23416 hardware MPEG2 encoder. There are two major variants of this
device; this driver handles both. Any V4L2 application which
understands MPEG2 video stream data should be able to work with this
device.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
/drivers/media/video/pvrusb2/pvrusb2-context.c