--- local_tree.orig/drivers/usb/core/devio.c 2004-07-25 14:38:38.768837204 +0200
+++ local_tree/drivers/usb/core/devio.c 2004-07-25 14:40:17.687826010 +0200
@@ -677,22 +677,31 @@
static int proc_clearhalt(struct dev_state *ps, void __user *arg)
{
+ struct usb_device *dev = ps->dev;
unsigned int ep;
int pipe;
int ret;
if (get_user(ep, (unsigned int __user *)arg))
return -EFAULT;
- if ((ret = findintfep(ps->dev, ep)) < 0)
- return ret;
+ down(&dev->serialize);
+ if (!connected(dev)) {
+ ret = -ENODEV;
+ goto out;
+ }
+ if ((ret = findintfep(dev, ep)) < 0)
+ goto out;
if ((ret = checkintf(ps, ret)))
- return ret;
+ goto out;
if (ep & USB_DIR_IN)
- pipe = usb_rcvbulkpipe(ps->dev, ep & 0x7f);
+ pipe = usb_rcvbulkpipe(dev, ep & 0x7f);
else
- pipe = usb_sndbulkpipe(ps->dev, ep & 0x7f);
+ pipe = usb_sndbulkpipe(dev, ep & 0x7f);
- return usb_clear_halt(ps->dev, pipe);
+ ret = usb_clear_halt(dev, pipe);
+out:
+ up(&dev->serialize);
+ return ret;
}
@@ -1235,16 +1244,10 @@
break;
case USBDEVFS_CLEAR_HALT:
- down(&dev->serialize);
- if (!connected(dev)) {
- up(&dev->serialize);
- return -ENODEV;
- }
snoop(&dev->dev, "%s: CLEAR_HALT\n", __FUNCTION__);
ret = proc_clearhalt(ps, p);
if (ret >= 0)
inode->i_mtime = CURRENT_TIME;
- up(&dev->serialize);
break;
case USBDEVFS_GETDRIVER:
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel