From ae59dad4fef271222d65ac6afe2889eb12ea6ca9 Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Sun, 7 Nov 2010 20:09:19 +0000 Subject: staging/easycap: Eliminate BKL 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/easycap/easycap.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'drivers/staging/easycap/easycap.h') diff --git a/drivers/staging/easycap/easycap.h b/drivers/staging/easycap/easycap.h index e9410b74ffc4..762c6cea54c3 100644 --- a/drivers/staging/easycap/easycap.h +++ b/drivers/staging/easycap/easycap.h @@ -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; @@ -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) @@ -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 *); -- cgit v1.2.3-55-g7522