Commit 5a80415b authored by Sascha Sommer's avatar Sascha Sommer Committed by Mauro Carvalho Chehab

V4L/DVB (6538): em28xx: fix locking to allow accesses from 2 different threads at the same time

The attached patch modifies the em28xx driver so that there can be ioctls from
multiple different threads.

This is necessary for capture apps like MPlayer that use different threads for
capturing and channel tuning.

Now the locking is only done for the ioctls that change properties of the
device or access the i2c bus.

It also removes some locks that look unnecessary:

In em28xx_init_dev:
  the videodevice is not registered yet so nothing can access the hardware
 meanwhile, the device struct is not assigned to the interface yet so no race
 with disconnect is possible

In em28xx_release_resources:
  it gets only called when dev->lock is already held
Signed-off-by: default avatarSascha Sommer <saschasommer@freenet.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent ea4fd567
This diff is collapsed.
......@@ -265,7 +265,7 @@ struct em28xx {
enum em28xx_stream_state stream;
enum em28xx_io_method io;
/* locks */
struct mutex lock, fileop_lock;
struct mutex lock;
spinlock_t queue_lock;
struct list_head inqueue, outqueue;
wait_queue_head_t open, wait_frame, wait_stream;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment