Skip to content

Commit

Permalink
staging/easycap: Eliminate BKL
Browse files Browse the repository at this point in the history
No locking is required for normal operation of the driver, but locking
is needed to prevent an Oops during some hot-unplugging scenarios.  The
BKL is replaced here by mutex locks together with traps to detect null
pointers following asynchronous device disconnection.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Mike Thomas authored and Greg Kroah-Hartman committed Nov 10, 2010
1 parent 2a87a0b commit ae59dad
Show file tree
Hide file tree
Showing 8 changed files with 695 additions and 192 deletions.
1 change: 0 additions & 1 deletion drivers/staging/easycap/Kconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
config EASYCAP
tristate "EasyCAP USB ID 05e1:0408 support"
depends on USB && VIDEO_DEV
depends on BKL # please fix

---help---
This is an integrated audio/video driver for EasyCAP cards with
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/easycap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ ccflags-y := -Wall
ccflags-y += -DEASYCAP_IS_VIDEODEV_CLIENT
ccflags-y += -DEASYCAP_NEEDS_V4L2_DEVICE_H
ccflags-y += -DEASYCAP_NEEDS_V4L2_FOPS
ccflags-y += -DEASYCAP_NEEDS_UNLOCKED_IOCTL

16 changes: 14 additions & 2 deletions drivers/staging/easycap/easycap.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ INTERLACE_MANY
* STRUCTURE DEFINITIONS
*/
/*---------------------------------------------------------------------------*/
struct easycap_dongle {
struct easycap *peasycap;
struct mutex mutex_video;
struct mutex mutex_audio;
};
/*---------------------------------------------------------------------------*/
struct data_buffer {
struct list_head list_head;
void *pgo;
Expand Down Expand Up @@ -491,7 +497,10 @@ struct data_buffer audio_buffer[];
void easycap_complete(struct urb *);
int easycap_open(struct inode *, struct file *);
int easycap_release(struct inode *, struct file *);
long easycap_ioctl(struct file *, unsigned int, unsigned long);
long easycap_ioctl_noinode(struct file *, unsigned int, \
unsigned long);
int easycap_ioctl(struct inode *, struct file *, unsigned int, \
unsigned long);

/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#if defined(EASYCAP_IS_VIDEODEV_CLIENT)
Expand Down Expand Up @@ -538,7 +547,10 @@ void easysnd_complete(struct urb *);
ssize_t easysnd_read(struct file *, char __user *, size_t, loff_t *);
int easysnd_open(struct inode *, struct file *);
int easysnd_release(struct inode *, struct file *);
long easysnd_ioctl(struct file *, unsigned int, unsigned long);
long easysnd_ioctl_noinode(struct file *, unsigned int, \
unsigned long);
int easysnd_ioctl(struct inode *, struct file *, unsigned int, \
unsigned long);
unsigned int easysnd_poll(struct file *, poll_table *);
void easysnd_delete(struct kref *);
int submit_audio_urbs(struct easycap *);
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/easycap/easycap_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@
/*****************************************************************************/
extern int debug;
extern int gain;
extern struct easycap_dongle easycap_dongle[];
Loading

0 comments on commit ae59dad

Please sign in to comment.