Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 36369
b: refs/heads/master
c: 349710c
h: refs/heads/master
i:
  36367: 12a71e9
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Sep 27, 2006
1 parent 09183dc commit a48396d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 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: 4a2a8a2cce86b9d001378cc25acb5c61e6ca7d63
refs/heads/master: 349710c3a79c0405911b8b604953f0c665e17756
13 changes: 7 additions & 6 deletions trunk/drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ MODULE_PARM_DESC (usbfs_snoop, "true to log all usbfs traffic");

#define MAX_USBFS_BUFFER_SIZE 16384

static inline int connected (struct usb_device *dev)
static inline int connected (struct dev_state *ps)
{
return dev->state != USB_STATE_NOTATTACHED;
return (!list_empty(&ps->list) &&
ps->dev->state != USB_STATE_NOTATTACHED);
}

static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig)
Expand Down Expand Up @@ -130,7 +131,7 @@ static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes, l

pos = *ppos;
usb_lock_device(dev);
if (!connected(dev)) {
if (!connected(ps)) {
ret = -ENODEV;
goto err;
} else if (pos < 0) {
Expand Down Expand Up @@ -1326,7 +1327,7 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
}
}

if (!connected(ps->dev)) {
if (!connected(ps)) {
kfree(buf);
return -ENODEV;
}
Expand Down Expand Up @@ -1425,7 +1426,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
if (!(file->f_mode & FMODE_WRITE))
return -EPERM;
usb_lock_device(dev);
if (!connected(dev)) {
if (!connected(ps)) {
usb_unlock_device(dev);
return -ENODEV;
}
Expand Down Expand Up @@ -1566,7 +1567,7 @@ static unsigned int usbdev_poll(struct file *file, struct poll_table_struct *wai
poll_wait(file, &ps->wait, wait);
if (file->f_mode & FMODE_WRITE && !list_empty(&ps->async_completed))
mask |= POLLOUT | POLLWRNORM;
if (!connected(ps->dev))
if (!connected(ps))
mask |= POLLERR | POLLHUP;
return mask;
}
Expand Down

0 comments on commit a48396d

Please sign in to comment.