Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104611
b: refs/heads/master
c: 830f402
h: refs/heads/master
i:
  104609: dc3c05c
  104607: ca77c0e
v: v3
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Jul 21, 2008
1 parent ccfe8ba commit 8d38b2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 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: 62ad296b6ca78bd123864c138814c0a597873693
refs/heads/master: 830f4021a8d5ce97c6bed267132e5e90fb166192
28 changes: 15 additions & 13 deletions trunk/drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ static void acm_tty_set_termios(struct tty_struct *tty, struct ktermios *termios
* USB probe and disconnect routines.
*/

/* Little helper: write buffers free */
/* Little helpers: write/read buffers free */
static void acm_write_buffers_free(struct acm *acm)
{
int i;
Expand All @@ -849,6 +849,15 @@ static void acm_write_buffers_free(struct acm *acm)
}
}

static void acm_read_buffers_free(struct acm *acm)
{
struct usb_device *usb_dev = interface_to_usbdev(acm->control);
int i, n = acm->rx_buflimit;

for (i = 0; i < n; i++)
usb_buffer_free(usb_dev, acm->readsize, acm->rb[i].base, acm->rb[i].dma);
}

/* Little helper: write buffers allocate */
static int acm_write_buffers_alloc(struct acm *acm)
{
Expand Down Expand Up @@ -1171,8 +1180,7 @@ static int acm_probe (struct usb_interface *intf,
for (i = 0; i < ACM_NW; i++)
usb_free_urb(acm->wb[i].urb);
alloc_fail7:
for (i = 0; i < num_rx_buf; i++)
usb_buffer_free(usb_dev, acm->readsize, acm->rb[i].base, acm->rb[i].dma);
acm_read_buffers_free(acm);
for (i = 0; i < num_rx_buf; i++)
usb_free_urb(acm->ru[i].urb);
usb_free_urb(acm->ctrlurb);
Expand Down Expand Up @@ -1209,15 +1217,9 @@ static void acm_disconnect(struct usb_interface *intf)
{
struct acm *acm = usb_get_intfdata(intf);
struct usb_device *usb_dev = interface_to_usbdev(intf);
int i;

if (!acm || !acm->dev) {
dbg("disconnect on nonexisting interface");
return;
}

mutex_lock(&open_mutex);
if (!usb_get_intfdata(intf)) {
if (!acm || !acm->dev) {
mutex_unlock(&open_mutex);
return;
}
Expand All @@ -1236,10 +1238,10 @@ static void acm_disconnect(struct usb_interface *intf)

acm_write_buffers_free(acm);
usb_buffer_free(usb_dev, acm->ctrlsize, acm->ctrl_buffer, acm->ctrl_dma);
for (i = 0; i < acm->rx_buflimit; i++)
usb_buffer_free(usb_dev, acm->readsize, acm->rb[i].base, acm->rb[i].dma);
acm_read_buffers_free(acm);

usb_driver_release_interface(&acm_driver, intf == acm->control ? acm->data : intf);
usb_driver_release_interface(&acm_driver, intf == acm->control ?
acm->data : acm->control);

if (!acm->used) {
acm_tty_unregister(acm);
Expand Down

0 comments on commit 8d38b2e

Please sign in to comment.