summaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/legousbtower.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-02-02 14:28:57 +1100
committerLinus Torvalds <torvalds@linux-foundation.org>2008-02-02 14:28:57 +1100
commitb6cf160c4b788a31f6a4017a469b956ca77febf4 (patch)
treed4d525000e283fe08905385d91dd0170454eae9a /drivers/usb/misc/legousbtower.c
parented50d6cbc394cd0966469d3e249353c9dd1d38b9 (diff)
parent2c044a4803804708984931bcbd03314732e995d5 (diff)
downloadblackbird-op-linux-b6cf160c4b788a31f6a4017a469b956ca77febf4.tar.gz
blackbird-op-linux-b6cf160c4b788a31f6a4017a469b956ca77febf4.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (128 commits) USB: fix codingstyle issues in drivers/usb/core/*.c USB: fix codingstyle issues in drivers/usb/core/message.c USB: fix codingstyle issues in drivers/usb/core/hcd-pci.c USB: fix codingstyle issues in drivers/usb/core/devio.c USB: fix codingstyle issues in drivers/usb/core/devices.c USB: fix codingstyle issues in drivers/usb/core/*.h USB: fix codingstyle issues in include/linux/usb/ USB: fix codingstyle issues in include/linux/usb.h USB: mark USB drivers as being GPL only USB: use a real vendor and product id for root hubs USB: mount options: fix usbfs USB: Fix usb_serial_driver structure for Kobil cardreader driver. usb: ehci should use u16 for isochronous intervals usb: ehci, remove false clear-reset path USB: Use menuconfig objects usb: ohci-sm501 driver usb: dma bounce buffer support USB: last abuses of intfdata in close for usb-serial drivers USB: kl5kusb105 don't flush to logically disconnected devices USB: oti6858: cleanup ...
Diffstat (limited to 'drivers/usb/misc/legousbtower.c')
-rw-r--r--drivers/usb/misc/legousbtower.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index aab320085ebf..6664043f4645 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -205,7 +205,7 @@ static DEFINE_MUTEX(open_disc_mutex);
/* Structure to hold all of our device specific stuff */
struct lego_usb_tower {
- struct semaphore sem; /* locks this structure */
+ struct mutex lock; /* locks this structure */
struct usb_device* udev; /* save off the usb device pointer */
unsigned char minor; /* the starting minor number for this device */
@@ -361,7 +361,7 @@ static int tower_open (struct inode *inode, struct file *file)
}
/* lock this device */
- if (down_interruptible (&dev->sem)) {
+ if (mutex_lock_interruptible(&dev->lock)) {
mutex_unlock(&open_disc_mutex);
retval = -ERESTARTSYS;
goto exit;
@@ -421,7 +421,7 @@ static int tower_open (struct inode *inode, struct file *file)
file->private_data = dev;
unlock_exit:
- up (&dev->sem);
+ mutex_unlock(&dev->lock);
exit:
dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval);
@@ -448,7 +448,7 @@ static int tower_release (struct inode *inode, struct file *file)
}
mutex_lock(&open_disc_mutex);
- if (down_interruptible (&dev->sem)) {
+ if (mutex_lock_interruptible(&dev->lock)) {
retval = -ERESTARTSYS;
goto exit;
}
@@ -460,7 +460,9 @@ static int tower_release (struct inode *inode, struct file *file)
}
if (dev->udev == NULL) {
/* the device was unplugged before the file was released */
- up (&dev->sem); /* unlock here as tower_delete frees dev */
+
+ /* unlock here as tower_delete frees dev */
+ mutex_unlock(&dev->lock);
tower_delete (dev);
goto exit;
}
@@ -473,7 +475,7 @@ static int tower_release (struct inode *inode, struct file *file)
dev->open_count = 0;
unlock_exit:
- up (&dev->sem);
+ mutex_unlock(&dev->lock);
exit:
mutex_unlock(&open_disc_mutex);
@@ -586,7 +588,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count,
dev = (struct lego_usb_tower *)file->private_data;
/* lock this object */
- if (down_interruptible (&dev->sem)) {
+ if (mutex_lock_interruptible(&dev->lock)) {
retval = -ERESTARTSYS;
goto exit;
}
@@ -653,7 +655,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count,
unlock_exit:
/* unlock the device */
- up (&dev->sem);
+ mutex_unlock(&dev->lock);
exit:
dbg(2, "%s: leave, return value %d", __FUNCTION__, retval);
@@ -675,7 +677,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t
dev = (struct lego_usb_tower *)file->private_data;
/* lock this object */
- if (down_interruptible (&dev->sem)) {
+ if (mutex_lock_interruptible(&dev->lock)) {
retval = -ERESTARTSYS;
goto exit;
}
@@ -737,7 +739,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t
unlock_exit:
/* unlock the device */
- up (&dev->sem);
+ mutex_unlock(&dev->lock);
exit:
dbg(2, "%s: leave, return value %d", __FUNCTION__, retval);
@@ -862,7 +864,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
goto exit;
}
- init_MUTEX (&dev->sem);
+ mutex_init(&dev->lock);
dev->udev = udev;
dev->open_count = 0;
@@ -1007,16 +1009,16 @@ static void tower_disconnect (struct usb_interface *interface)
/* give back our minor */
usb_deregister_dev (interface, &tower_class);
- down (&dev->sem);
+ mutex_lock(&dev->lock);
mutex_unlock(&open_disc_mutex);
/* if the device is not opened, then we clean up right now */
if (!dev->open_count) {
- up (&dev->sem);
+ mutex_unlock(&dev->lock);
tower_delete (dev);
} else {
dev->udev = NULL;
- up (&dev->sem);
+ mutex_unlock(&dev->lock);
}
info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE));
OpenPOWER on IntegriCloud