[PATCH 38/67] cdc-acm: remove dead code

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg Kroah-Hartman
Date: Thursday, August 5, 2010 - 3:23 pm

From: Arnd Bergmann <arnd@arndb.de>

The wait_event_interruptible_timeout in acm_port_down is
never reached. Remove it to avoid possible deadlocks
with the big tty mutex if someone were to start using
the blocking version of acm_port_down.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/usb/class/cdc-acm.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 89d260d..1833b3a 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -636,19 +636,13 @@ static void acm_tty_unregister(struct acm *acm)
 
 static int acm_tty_chars_in_buffer(struct tty_struct *tty);
 
-static void acm_port_down(struct acm *acm, int drain)
+static void acm_port_down(struct acm *acm)
 {
 	int i, nr = acm->rx_buflimit;
 	mutex_lock(&open_mutex);
 	if (acm->dev) {
 		usb_autopm_get_interface(acm->control);
 		acm_set_control(acm, acm->ctrlout = 0);
-		/* try letting the last writes drain naturally */
-		if (drain) {
-			wait_event_interruptible_timeout(acm->drain_wait,
-				(ACM_NW == acm_wb_is_avail(acm)) || !acm->dev,
-					ACM_CLOSE_TIMEOUT * HZ);
-		}
 		usb_kill_urb(acm->ctrlurb);
 		for (i = 0; i < ACM_NW; i++)
 			usb_kill_urb(acm->wb[i].urb);
@@ -664,7 +658,7 @@ static void acm_tty_hangup(struct tty_struct *tty)
 {
 	struct acm *acm = tty->driver_data;
 	tty_port_hangup(&acm->port);
-	acm_port_down(acm, 0);
+	acm_port_down(acm);
 }
 
 static 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)
 		mutex_unlock(&open_mutex);
 		return;
 	}
-	acm_port_down(acm, 0);
+	acm_port_down(acm);
 	tty_port_close_end(&acm->port, tty);
 	tty_port_tty_set(&acm->port, NULL);
 }
-- 
1.7.2

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT PATCH] TTY patches for 2.6.36, Greg KH, (Thu Aug 5, 2:35 pm)
[PATCH 01/67] n_gsm.c: removed duplicated #includes, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 02/67] serial: There's no config CONSOLE, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 03/67] vt: clean up the code - use kernel library, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 04/67] serial: add UART_CAP_EFR and UART_CAP_SLEEP ..., Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 05/67] mrst_max3110: add UART driver for Max3110 on ..., Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 06/67] max3110 sanity check a register, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 07/67] serial: replace open coded mutex with a real ..., Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 08/67] serial: fix wakup races in the mrst_max3110 ..., Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 09/67] tty: Remove Hayes ESP ioctls, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 10/67] tty: remove remaining Hayes ESP ioctls, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 11/67] tty: Add EXTPROC support for LINEMODE, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 12/67] vt/console: try harder to print output when ..., Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 13/67] stallion: prune lock_kernel calls, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 14/67] istallion: use bit ops for the board flags, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 15/67] riscom8: kill use of lock_kernel, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 16/67] isicom: kill off the BKL, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 17/67] rocket: kill BKL, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 18/67] synclink: kill the big kernel lock, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 19/67] cyclades: Kill off BKL usage, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 20/67] epca: Kill the big kernel lock, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 21/67] specialix: Kill the BKL, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 22/67] tty: Fix the digi acceleport driver NULL checks, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 23/67] synclink: reworking locking a bit, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 24/67] tty: serial - fix various misuses/mishandlin ..., Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 25/67] tty: serial - fix tty back references in termios, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 26/67] tty: serial - fix tty referencing in set_ldisc, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 27/67] vc: Locking clean up, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 28/67] tty: Make vt's have a tty_port, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 29/67] tty: Move the vt_tty field from the vc_data ..., Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 30/67] serial: Change the wait for carrier locking, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 31/67] serial: add port helpers, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 32/67] serial: trim locking on the helpers, Greg Kroah-Hartman, (Thu Aug 5, 3:22 pm)
[PATCH 33/67] serial: Use block_til_ready helper, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 34/67] serial: fix termios settings in open, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 35/67] tty: replace BKL with a new tty_lock, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 36/67] tty: never hold BTM while getting tty_mutex, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 37/67] tty: fix console_sem lock order, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 38/67] cdc-acm: remove dead code, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 39/67] tty: introduce wait_event_interruptible_tty, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 40/67] tty: reorder ldisc locking, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 41/67] tty: untangle locking of wait_until_sent, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 42/67] tty: remove tty_lock_nested, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 43/67] tty: implement BTM as mutex instead of BKL, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 44/67] tty: release BTM while sleeping in block_til ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 45/67] 8250: fix set_ldisc operation, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 46/67] tty: avoid recursive BTM in pty_close, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 47/67] serial: max3107: introduce a max3107 driver, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 48/67] serial: max3107: Abstract out the platform s ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 49/67] tty_io: remove casts from void*, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 50/67] vt: Fix warning: statement with no effect du ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 51/67] serial: crisv10: formatting of pointers in p ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 53/67] serial: fix missing bit coverage of ASYNC_FLAGS, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 54/67] serial: general fixes in the serial_rs485 st ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 55/67] serial: mcf: don't take spinlocks in already ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 56/67] serial: MMIO32 support for 8250_early.c, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 57/67] timbuart: use __devinit and __devexit macros ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 58/67] serial: 68328serial.c: remove dead (ALMA_ANS ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 59/67] serial: add support for OX16PCI958 card, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 60/67] mxser: remove unnesesary NULL check, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 61/67] hsu: driver for Medfield High Speed UART device, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 62/67] hsu: add a periodic timer to check dma rx ch ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 63/67] hsu: some code cleanup, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 64/67] hsu: call PCI pm hooks in suspend/resume fun ..., Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
[PATCH 65/67] serial: max3107: Fix gpiolib support, Greg Kroah-Hartman, (Thu Aug 5, 3:23 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Linus Torvalds, (Fri Aug 6, 11:40 am)
Re: [GIT PATCH] TTY patches for 2.6.36, Greg KH, (Fri Aug 6, 11:51 am)
Re: [GIT PATCH] TTY patches for 2.6.36, Greg KH, (Fri Aug 6, 12:37 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Linus Torvalds, (Fri Aug 6, 12:38 pm)
[PATCH retry] tty: implement BTM as mutex instead of BKL, Arnd Bergmann, (Fri Aug 6, 12:40 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Arnd Bergmann, (Fri Aug 6, 12:40 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Alan Cox, (Fri Aug 6, 12:45 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Arnd Bergmann, (Fri Aug 6, 12:58 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Linus Torvalds, (Fri Aug 6, 1:11 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Arnd Bergmann, (Fri Aug 6, 1:19 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Greg KH, (Fri Aug 6, 1:22 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Andy Whitcroft, (Mon Aug 9, 9:06 am)
Re: [GIT PATCH] TTY patches for 2.6.36, Arnd Bergmann, (Mon Aug 9, 11:38 am)
Re: [GIT PATCH] TTY patches for 2.6.36, Alan Cox, (Mon Aug 9, 12:24 pm)
Re: [GIT PATCH] TTY patches for 2.6.36, Andy Whitcroft, (Tue Aug 10, 12:31 am)