Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82234
b: refs/heads/master
c: 1cfab02
h: refs/heads/master
v: v3
  • Loading branch information
Matthias Kaehlcke authored and Greg Kroah-Hartman committed Feb 1, 2008
1 parent e9ff84b commit b711b77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 041509db390cf97b09df0f51024f5d40407938db
refs/heads/master: 1cfab028afe5827433195c57b6f36d61a79beb50
17 changes: 9 additions & 8 deletions trunk/drivers/usb/misc/usbtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/scatterlist.h>
#include <linux/mutex.h>

#include <linux/usb.h>

Expand Down Expand Up @@ -64,7 +65,7 @@ struct usbtest_dev {
int in_iso_pipe;
int out_iso_pipe;
struct usb_endpoint_descriptor *iso_in, *iso_out;
struct semaphore sem;
struct mutex lock;

#define TBUF_SIZE 256
u8 *buf;
Expand Down Expand Up @@ -1559,11 +1560,11 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
|| param->sglen < 0 || param->vary < 0)
return -EINVAL;

if (down_interruptible (&dev->sem))
if (mutex_lock_interruptible(&dev->lock))
return -ERESTARTSYS;

if (intf->dev.power.power_state.event != PM_EVENT_ON) {
up (&dev->sem);
mutex_unlock(&dev->lock);
return -EHOSTUNREACH;
}

Expand All @@ -1575,15 +1576,15 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
int res;

if (intf->altsetting->desc.bInterfaceNumber) {
up (&dev->sem);
mutex_unlock(&dev->lock);
return -ENODEV;
}
res = set_altsetting (dev, dev->info->alt);
if (res) {
dev_err (&intf->dev,
"set altsetting to %d failed, %d\n",
dev->info->alt, res);
up (&dev->sem);
mutex_unlock(&dev->lock);
return res;
}
}
Expand Down Expand Up @@ -1856,7 +1857,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
param->duration.tv_usec += 1000 * 1000;
param->duration.tv_sec -= 1;
}
up (&dev->sem);
mutex_unlock(&dev->lock);
return retval;
}

Expand Down Expand Up @@ -1906,7 +1907,7 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
return -ENOMEM;
info = (struct usbtest_info *) id->driver_info;
dev->info = info;
init_MUTEX (&dev->sem);
mutex_init(&dev->lock);

dev->intf = intf;

Expand Down Expand Up @@ -1991,7 +1992,7 @@ static void usbtest_disconnect (struct usb_interface *intf)
{
struct usbtest_dev *dev = usb_get_intfdata (intf);

down (&dev->sem);
mutex_lock(&dev->lock);

usb_set_intfdata (intf, NULL);
dev_dbg (&intf->dev, "disconnect\n");
Expand Down

0 comments on commit b711b77

Please sign in to comment.