Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752281Ab3EESeB (ORCPT ); Sun, 5 May 2013 14:34:01 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:54036 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751984Ab3EESdM (ORCPT ); Sun, 5 May 2013 14:33:12 -0400 From: Johan Hovold To: Greg Kroah-Hartman Cc: Peter Hurley , Stas Sergeev , Jarkko Huijts , Alan Cox , linux-usb@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Caylan Van Larson , "Rafael J. Wysocki" , Johan Hovold Subject: [PATCH 7/7] USB: serial: clean up chars_in_buffer Date: Sun, 5 May 2013 20:32:33 +0200 Message-Id: <1367778753-22297-8-git-send-email-jhovold@gmail.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1367778753-22297-1-git-send-email-jhovold@gmail.com> References: <20130505182913.GE16818@localhost> <1367778753-22297-1-git-send-email-jhovold@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1417 Lines: 44 No need to grab disconnect mutex in chars_in_buffer now that no sub-driver is or should be querying hardware buffers anymore. (They should use wait_until_sent.) Signed-off-by: Johan Hovold --- drivers/usb/serial/usb-serial.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 60caf9c..4753c00 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -359,20 +359,13 @@ static int serial_chars_in_buffer(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct usb_serial *serial = port->serial; - int count = 0; dev_dbg(tty->dev, "%s\n", __func__); - mutex_lock(&serial->disc_mutex); - /* if the device was unplugged then any remaining characters - fell out of the connector ;) */ if (serial->disconnected) - count = 0; - else - count = serial->type->chars_in_buffer(tty); - mutex_unlock(&serial->disc_mutex); + return 0; - return count; + return serial->type->chars_in_buffer(tty); } static void serial_wait_until_sent(struct tty_struct *tty, int timeout) -- 1.8.2.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/