Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280955
b: refs/heads/master
c: e28dbb0
h: refs/heads/master
i:
  280953: 188a9c9
  280951: 029b46d
v: v3
  • Loading branch information
Ming Lei authored and Greg Kroah-Hartman committed Jan 4, 2012
1 parent f24ecb2 commit 4fbe26b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 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: 26c71a79cade5ccad80e0752cd82f3518df48fb3
refs/heads/master: e28dbb0661ca49ada2d6a307a1ec93dd75d515e0
22 changes: 4 additions & 18 deletions trunk/drivers/usb/usb-skeleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ struct usb_skel {
__u8 bulk_in_endpointAddr; /* the address of the bulk in endpoint */
__u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */
int errors; /* the last request tanked */
int open_count; /* count the number of openers */
bool ongoing_read; /* a read is going on */
bool processed_urb; /* indicates we haven't processed the urb */
spinlock_t err_lock; /* lock for errors */
Expand Down Expand Up @@ -122,22 +121,9 @@ static int skel_open(struct inode *inode, struct file *file)
goto out_err;
}

if (!dev->open_count++) {
retval = usb_autopm_get_interface(interface);
if (retval) {
dev->open_count--;
mutex_unlock(&dev->io_mutex);
kref_put(&dev->kref, skel_delete);
goto exit;
}
} /* else { //uncomment this block if you want exclusive open
retval = -EBUSY;
dev->open_count--;
mutex_unlock(&dev->io_mutex);
kref_put(&dev->kref, skel_delete);
goto exit;
} */
/* prevent the device from being autosuspended */
retval = usb_autopm_get_interface(interface);
if (retval)
goto out_err;

/* save our object in the file's private structure */
file->private_data = dev;
Expand All @@ -161,7 +147,7 @@ static int skel_release(struct inode *inode, struct file *file)

/* allow the device to be autosuspended */
mutex_lock(&dev->io_mutex);
if (!--dev->open_count && dev->interface)
if (dev->interface)
usb_autopm_put_interface(dev->interface);
mutex_unlock(&dev->io_mutex);

Expand Down

0 comments on commit 4fbe26b

Please sign in to comment.