* - move reset into open to clean out spurious data
*/
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/smp_lock.h>
#include <linux/completion.h>
-#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#include <linux/poll.h>
/* prevent races between open() and disconnect */
-static DEFINE_MUTEX (disconnect_mutex);
+static DECLARE_MUTEX (disconnect_sem);
/* file operations needed when we register this driver */
static struct file_operations tower_fops = {
nonseekable_open(inode, file);
subminor = iminor(inode);
- mutex_lock (&disconnect_mutex);
+ down (&disconnect_sem);
interface = usb_find_interface (&tower_driver, subminor);
up (&dev->sem);
unlock_disconnect_exit:
- mutex_unlock (&disconnect_mutex);
+ up (&disconnect_sem);
dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval);
dbg(2, "%s: enter", __FUNCTION__);
- mutex_lock (&disconnect_mutex);
+ down (&disconnect_sem);
dev = usb_get_intfdata (interface);
usb_set_intfdata (interface, NULL);
up (&dev->sem);
}
- mutex_unlock (&disconnect_mutex);
+ up (&disconnect_sem);
info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE));