aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class/cdc-acm.c
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2010-08-20 07:53:08 -0400
committerMichal Marek <mmarek@suse.cz>2010-08-20 07:53:08 -0400
commite981b060767b3c4ac9393ad8d2558d648e35dfcb (patch)
tree9c05eaec3072be3645dda61d35085d152b9d5954 /drivers/usb/class/cdc-acm.c
parent3c955b407a084810f57260d61548cc92c14bc627 (diff)
parentda5cabf80e2433131bf0ed8993abc0f7ea618c73 (diff)
Merge commit 'v2.6.36-rc1' into kbuild/rc-fixes
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r--drivers/usb/class/cdc-acm.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 162c95a088ed..1833b3a71515 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -2,7 +2,7 @@
2 * cdc-acm.c 2 * cdc-acm.c
3 * 3 *
4 * Copyright (c) 1999 Armin Fuerst <fuerst@in.tum.de> 4 * Copyright (c) 1999 Armin Fuerst <fuerst@in.tum.de>
5 * Copyright (c) 1999 Pavel Machek <pavel@suse.cz> 5 * Copyright (c) 1999 Pavel Machek <pavel@ucw.cz>
6 * Copyright (c) 1999 Johannes Erdfelt <johannes@erdfelt.com> 6 * Copyright (c) 1999 Johannes Erdfelt <johannes@erdfelt.com>
7 * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> 7 * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz>
8 * Copyright (c) 2004 Oliver Neukum <oliver@neukum.name> 8 * Copyright (c) 2004 Oliver Neukum <oliver@neukum.name>
@@ -636,19 +636,13 @@ static void acm_tty_unregister(struct acm *acm)
636 636
637static int acm_tty_chars_in_buffer(struct tty_struct *tty); 637static int acm_tty_chars_in_buffer(struct tty_struct *tty);
638 638
639static void acm_port_down(struct acm *acm, int drain) 639static void acm_port_down(struct acm *acm)
640{ 640{
641 int i, nr = acm->rx_buflimit; 641 int i, nr = acm->rx_buflimit;
642 mutex_lock(&open_mutex); 642 mutex_lock(&open_mutex);
643 if (acm->dev) { 643 if (acm->dev) {
644 usb_autopm_get_interface(acm->control); 644 usb_autopm_get_interface(acm->control);
645 acm_set_control(acm, acm->ctrlout = 0); 645 acm_set_control(acm, acm->ctrlout = 0);
646 /* try letting the last writes drain naturally */
647 if (drain) {
648 wait_event_interruptible_timeout(acm->drain_wait,
649 (ACM_NW == acm_wb_is_avail(acm)) || !acm->dev,
650 ACM_CLOSE_TIMEOUT * HZ);
651 }
652 usb_kill_urb(acm->ctrlurb); 646 usb_kill_urb(acm->ctrlurb);
653 for (i = 0; i < ACM_NW; i++) 647 for (i = 0; i < ACM_NW; i++)
654 usb_kill_urb(acm->wb[i].urb); 648 usb_kill_urb(acm->wb[i].urb);
@@ -664,7 +658,7 @@ static void acm_tty_hangup(struct tty_struct *tty)
664{ 658{
665 struct acm *acm = tty->driver_data; 659 struct acm *acm = tty->driver_data;
666 tty_port_hangup(&acm->port); 660 tty_port_hangup(&acm->port);
667 acm_port_down(acm, 0); 661 acm_port_down(acm);
668} 662}
669 663
670static void acm_tty_close(struct tty_struct *tty, struct file *filp) 664static void acm_tty_close(struct tty_struct *tty, struct file *filp)
@@ -685,7 +679,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
685 mutex_unlock(&open_mutex); 679 mutex_unlock(&open_mutex);
686 return; 680 return;
687 } 681 }
688 acm_port_down(acm, 0); 682 acm_port_down(acm);
689 tty_port_close_end(&acm->port, tty); 683 tty_port_close_end(&acm->port, tty);
690 tty_port_tty_set(&acm->port, NULL); 684 tty_port_tty_set(&acm->port, NULL);
691} 685}