From patchwork Sun Apr 21 12:21:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10910491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC4B1161F for ; Sun, 21 Apr 2019 12:22:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D7FF284E8 for ; Sun, 21 Apr 2019 12:22:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91D9B2866C; Sun, 21 Apr 2019 12:22:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4727E284E8 for ; Sun, 21 Apr 2019 12:22:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727385AbfDUMV7 (ORCPT ); Sun, 21 Apr 2019 08:21:59 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34370 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725963AbfDUMV6 (ORCPT ); Sun, 21 Apr 2019 08:21:58 -0400 Received: by mail-lj1-f193.google.com with SMTP id j89so8212080ljb.1 for ; Sun, 21 Apr 2019 05:21:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YCHlwVEU1pAZwr42+V6C5g/JtxQTErLwhv+ymt5pxTk=; b=QFsGDSKYGfRXhAwDFAdIjvG/gkH3LG/bxyUE9WLsjRcATS3oUvPhVbhaE8swszwIrq DL6X+VqDYkBDfqYUhvvEmAeS1SRlR74tCocmpU5Vy8nQUpW32/uKMjRtH6l09lvec9I3 R4na4da8EQyubW0ORO02r+r4OgJBMIaLSHlVEum5rBQ7AsBUS45CiJCbNRuxFpuqTK+j 81d/YV6joppXl6s2d6E159e7WUjXKUaYFz4XOenIy4N+xWwgm/31riTGTYN1NiXH+Y8J Rau3Oj3KH2qZLGt3JGcqa82QeCZZAocTYkyrABZbd2riyetNCQRpulcDz5xXbcIM/16P xwLg== X-Gm-Message-State: APjAAAWpVMrLnABZombTTyRB5clef4OCSdeDP4ZUZ7hrJcKsyrT2DtGh ydwLMbypVQ/ul0BoAzJp+++rV76W X-Google-Smtp-Source: APXvYqyhsOINS1Waexhrz6q+rJZhtQkowycTJcUp93rvz8hdSrCLE6EL22N8FlhuBc8ZyMwToaC+1Q== X-Received: by 2002:a2e:974d:: with SMTP id f13mr7445591ljj.140.1555849316325; Sun, 21 Apr 2019 05:21:56 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id r2sm2235210ljd.16.2019.04.21.05.21.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Apr 2019 05:21:55 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hIBTs-0006tk-7A; Sun, 21 Apr 2019 14:22:00 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 1/9] USB: serial: fix initial-termios handling Date: Sun, 21 Apr 2019 14:21:46 +0200 Message-Id: <20190421122154.26465-2-johan@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190421122154.26465-1-johan@kernel.org> References: <20190421122154.26465-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The USB-serial driver init_termios callback is used to override the default initial terminal settings provided by USB-serial core. After a bug was fixed in the original implementation introduced by commit fe1ae7fdd2ee ("tty: USB serial termios bits"), the init_termios callback was no longer called just once on first use as intended but rather on every (first) open. This specifically meant that the terminal settings saved on (final) close were ignored when reopening a port for drivers overriding the initial settings. Also update the outdated function header referring to the creation of termios objects. Fixes: 7e29bb4b779f ("usb-serial: fix termios initialization logic") Signed-off-by: Johan Hovold --- drivers/usb/serial/usb-serial.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 7e89efbf2c28..676c296103a2 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -164,9 +164,9 @@ void usb_serial_put(struct usb_serial *serial) * @driver: the driver (USB in our case) * @tty: the tty being created * - * Create the termios objects for this tty. We use the default + * Initialise the termios structure for this tty. We use the default * USB serial settings but permit them to be overridden by - * serial->type->init_termios. + * serial->type->init_termios on first open. * * This is the first place a new tty gets used. Hence this is where we * acquire references to the usb_serial structure and the driver module, @@ -178,6 +178,7 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty) int idx = tty->index; struct usb_serial *serial; struct usb_serial_port *port; + bool init_termios; int retval = -ENODEV; port = usb_serial_port_get_by_minor(idx); @@ -192,14 +193,16 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty) if (retval) goto error_get_interface; + init_termios = (driver->termios[idx] == NULL); + retval = tty_standard_install(driver, tty); if (retval) goto error_init_termios; mutex_unlock(&serial->disc_mutex); - /* allow the driver to update the settings */ - if (serial->type->init_termios) + /* allow the driver to update the initial settings */ + if (init_termios && serial->type->init_termios) serial->type->init_termios(tty); tty->driver_data = port; From patchwork Sun Apr 21 12:21:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10910495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BBBE14DB for ; Sun, 21 Apr 2019 12:22:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49451284E8 for ; Sun, 21 Apr 2019 12:22:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DA902864E; Sun, 21 Apr 2019 12:22:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4D82284E8 for ; Sun, 21 Apr 2019 12:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727512AbfDUMWD (ORCPT ); Sun, 21 Apr 2019 08:22:03 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:36018 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725963AbfDUMWC (ORCPT ); Sun, 21 Apr 2019 08:22:02 -0400 Received: by mail-lf1-f68.google.com with SMTP id u17so7139767lfi.3 for ; Sun, 21 Apr 2019 05:22:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cR4oDQjCgqBi5JCazU5MJ8A8IH0Qnc6AMKYJ6RQ6BpY=; b=FUu1xAtLAa8Gjs5dnONSL0vJlkqVxQR+Jdy8L60pfVZxQbqfze1jMMv7lghMv4kGq3 pod2dP2LNmUuRoVoVs9ry2FzX0mKJtfdfcQWPbNwom6Ih3KwLxPR9ZLXUO0ER0/HLDKN 5ddWA9wuFfUBiTFuro185a2du5Q9JMq7oTy9+e9RHKKK7h23pYSRo9adcSUHpzyCYyGT J48HYTMDRhKThCqatf0w/lRPeljZg+F89n1FWh4oXeRX0eF8rQCbJ9XGv33p0Fmkq113 H7V2yX/zCn2r9DMHGHFkuYA9VJKjsru4W+NPI7TLClXPBNPTYdIRmc58azZAi1J3f49T S42Q== X-Gm-Message-State: APjAAAWDY+qPJYtoe4EZQPFYkbczgri74O3NMEVKo9P735ZnwC2vqaRu oZis2P3qm/c9he3Xy63h+Urzu2wT X-Google-Smtp-Source: APXvYqxIi4S0fuvp8QDZQ/+C8jQGetRggkVyvlZOVZdJDDsrN+33ZbI+C02TGeviRlRasBGQb0peXw== X-Received: by 2002:ac2:5501:: with SMTP id j1mr7380117lfk.89.1555849320155; Sun, 21 Apr 2019 05:22:00 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id m23sm2245702ljh.93.2019.04.21.05.21.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Apr 2019 05:21:55 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hIBTs-0006tp-9i; Sun, 21 Apr 2019 14:22:00 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 2/9] USB: serial: ark3116: drop redundant init_termios Date: Sun, 21 Apr 2019 14:21:47 +0200 Message-Id: <20190421122154.26465-3-johan@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190421122154.26465-1-johan@kernel.org> References: <20190421122154.26465-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The initial terminal settings set by the driver matches the default settings provided by core so drop the redundant init_termios callback. Signed-off-by: Johan Hovold --- drivers/usb/serial/ark3116.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index ff38aa8963cf..71a9206ea1e2 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -189,16 +189,6 @@ static int ark3116_port_remove(struct usb_serial_port *port) return 0; } -static void ark3116_init_termios(struct tty_struct *tty) -{ - struct ktermios *termios = &tty->termios; - *termios = tty_std_termios; - termios->c_cflag = B9600 | CS8 - | CREAD | HUPCL | CLOCAL; - termios->c_ispeed = 9600; - termios->c_ospeed = 9600; -} - static void ark3116_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios) @@ -645,7 +635,6 @@ static struct usb_serial_driver ark3116_device = { .port_probe = ark3116_port_probe, .port_remove = ark3116_port_remove, .set_termios = ark3116_set_termios, - .init_termios = ark3116_init_termios, .get_serial = ark3116_get_serial_info, .tiocmget = ark3116_tiocmget, .tiocmset = ark3116_tiocmset, From patchwork Sun Apr 21 12:21:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10910493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FD8117E0 for ; Sun, 21 Apr 2019 12:22:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1118F2864A for ; Sun, 21 Apr 2019 12:22:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0571328817; Sun, 21 Apr 2019 12:22:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88EDC2864A for ; Sun, 21 Apr 2019 12:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727485AbfDUMWC (ORCPT ); Sun, 21 Apr 2019 08:22:02 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:46473 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727370AbfDUMWB (ORCPT ); Sun, 21 Apr 2019 08:22:01 -0400 Received: by mail-lf1-f67.google.com with SMTP id k18so7107387lfj.13 for ; Sun, 21 Apr 2019 05:22:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lf72Lcsc5rS1b8VBp3IVzGKMM1jvFZhGq00X7s0X05g=; b=fNwW5wd3Q9Tz1Jj6vBeRfzIC+4MhCSA5dgoM+9W85HJOsE8gYrWxK9OWPzbfUWS/mS UU00Kmwmj0dNnLVm6g9h1v4nhlJN7J/ac/glxB2S9d410DfM1HndRhUR2oKbCIY5UoMQ VaMfJ4gccswpOYS0iYOEqhtBTk285IKmUKVd2MDd5WB4IIn9AMft29b9I0sSku42ln4f X4LUGr/W3gzgi0LM/Gs+5XMkaxBZqm2q+UxcFVkKk06SE3GpAaKWaT1OxZypQODQFUVn BsxpEOhHQ0L0etngRkRGtW4gErKts58LDK/t+tRcsVrpAOiNRmfU13v3h1YSu7BjOL8V CtIw== X-Gm-Message-State: APjAAAWzeXA4VWHx9eypj8ijSj4hhwuw0CJGouYT5TPXy1DXw8dSV0l7 icQEZUFln1naVACRPXX95EHaqa0m X-Google-Smtp-Source: APXvYqyI1UR6K5EfpjEHgHczeD1H3fqdecqbq/BMFbTbf4nECJh/VFY1r8Qd/bvy24/BRT9nMbf/VA== X-Received: by 2002:ac2:48bb:: with SMTP id u27mr7482852lfg.17.1555849319597; Sun, 21 Apr 2019 05:21:59 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id m18sm2200730ljb.35.2019.04.21.05.21.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Apr 2019 05:21:55 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hIBTs-0006u4-Gt; Sun, 21 Apr 2019 14:22:00 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 5/9] USB: serial: cypress_m8: clean up initial-termios handling Date: Sun, 21 Apr 2019 14:21:50 +0200 Message-Id: <20190421122154.26465-6-johan@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190421122154.26465-1-johan@kernel.org> References: <20190421122154.26465-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that init_termios() is only called on first use, we can clean up the cypress_m8 initial-termios handling. Note that only the earthmate chip type used settings different from the defaults provided by USB serial core, and that the chip type is indeed known when init_termios is called at tty-install time. Signed-off-by: Johan Hovold --- drivers/usb/serial/cypress_m8.c | 36 +++++++-------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index f9bbbdd1a148..72d3ae1ebc64 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -98,7 +98,6 @@ struct cypress_private { int write_urb_interval; /* interval to use for write urb */ int read_urb_interval; /* interval to use for read urb */ int comm_is_ok; /* true if communication is (still) ok */ - int termios_initialized; __u8 line_control; /* holds dtr / rts value */ __u8 current_status; /* received from last read - info on dsr,cts,cd,ri,etc */ __u8 current_config; /* stores the current configuration byte */ @@ -122,6 +121,7 @@ static int cypress_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count); static void cypress_send(struct usb_serial_port *port); static int cypress_write_room(struct tty_struct *tty); +static void cypress_earthmate_init_termios(struct tty_struct *tty); static void cypress_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old); static int cypress_tiocmget(struct tty_struct *tty); @@ -149,6 +149,7 @@ static struct usb_serial_driver cypress_earthmate_device = { .dtr_rts = cypress_dtr_rts, .write = cypress_write, .write_room = cypress_write_room, + .init_termios = cypress_earthmate_init_termios, .set_termios = cypress_set_termios, .tiocmget = cypress_tiocmget, .tiocmset = cypress_tiocmset, @@ -463,7 +464,6 @@ static int cypress_generic_port_probe(struct usb_serial_port *port) priv->cmd_ctrl = 0; priv->line_control = 0; - priv->termios_initialized = 0; priv->rx_flags = 0; /* Default packet format setting is determined by packet size. Anything with a size larger then 9 must have a separate @@ -853,6 +853,11 @@ static int cypress_tiocmset(struct tty_struct *tty, return cypress_write(tty, port, NULL, 0); } +static void cypress_earthmate_init_termios(struct tty_struct *tty) +{ + tty_encode_baud_rate(tty, 4800, 4800); +} + static void cypress_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios) { @@ -864,33 +869,6 @@ static void cypress_set_termios(struct tty_struct *tty, __u8 oldlines; int linechange = 0; - spin_lock_irqsave(&priv->lock, flags); - /* We can't clean this one up as we don't know the device type - early enough */ - if (!priv->termios_initialized) { - if (priv->chiptype == CT_EARTHMATE) { - tty->termios = tty_std_termios; - tty->termios.c_cflag = B4800 | CS8 | CREAD | HUPCL | - CLOCAL; - tty->termios.c_ispeed = 4800; - tty->termios.c_ospeed = 4800; - } else if (priv->chiptype == CT_CYPHIDCOM) { - tty->termios = tty_std_termios; - tty->termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | - CLOCAL; - tty->termios.c_ispeed = 9600; - tty->termios.c_ospeed = 9600; - } else if (priv->chiptype == CT_CA42V2) { - tty->termios = tty_std_termios; - tty->termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | - CLOCAL; - tty->termios.c_ispeed = 9600; - tty->termios.c_ospeed = 9600; - } - priv->termios_initialized = 1; - } - spin_unlock_irqrestore(&priv->lock, flags); - /* Unsupported features need clearing */ tty->termios.c_cflag &= ~(CMSPAR|CRTSCTS); From patchwork Sun Apr 21 12:21:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10910487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8FD917E0 for ; Sun, 21 Apr 2019 12:22:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5F892864A for ; Sun, 21 Apr 2019 12:22:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A88602864E; Sun, 21 Apr 2019 12:22:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A04D2864E for ; Sun, 21 Apr 2019 12:22:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727415AbfDUMWA (ORCPT ); Sun, 21 Apr 2019 08:22:00 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:40420 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727370AbfDUMWA (ORCPT ); Sun, 21 Apr 2019 08:22:00 -0400 Received: by mail-lf1-f67.google.com with SMTP id a28so7119957lfo.7 for ; Sun, 21 Apr 2019 05:21:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wTrJkArsFkFtMLGY1Fb7H8Jbb2cACDNX6phiIfCNxdo=; b=gGrcMggmOEDKaVwbPrwGfKhLwPwxKONqejoxxt086Iq37eoD+m5eR3lG1WpqAyRbzD uFclD/BNotqSJx2p/LE3HEwTyIBU0EuiBxjmJkGJrlSfgvUD6wQkm69W/J+EjiohyFYD RcYRIAgCvPgoTglIMZupb51MCC9TjDOQm6Bdb6M6vLCz+cRk4ZMNTSy6goNBsft+DJvE TUEq3QtPJSH3ncRplxKVCs+KmH5aC4IydNbIU3SdNwlqQV8GP+YABYDcFHc9R+dZPjTT /bMx4ZsU0x8+O1T+arTk9jOyP01kQZPCnEc7bTEwxuU5Pj33RciZ/8WMY0y6ITmitB6R Yqkg== X-Gm-Message-State: APjAAAW8STb9RsWXF85dU2w+gMdRd3smF61Ht8PJl1TDwn7NBMXWtHEl DzbKwN5BO9QRWxDRQalGV8ir8mXb X-Google-Smtp-Source: APXvYqy/rOVLHQMDWuDWa2Hkm+kAB++RB8ml/Z82Y1kPIBkWCoCT4Hs/+a998t31FR91Yog+ku+c+w== X-Received: by 2002:ac2:4566:: with SMTP id k6mr7688967lfm.22.1555849317425; Sun, 21 Apr 2019 05:21:57 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id s3sm2447730lfc.25.2019.04.21.05.21.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Apr 2019 05:21:55 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hIBTs-0006u9-JP; Sun, 21 Apr 2019 14:22:00 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 6/9] USB: serial: iuu_phoenix: drop bogus initial cflag Date: Sun, 21 Apr 2019 14:21:51 +0200 Message-Id: <20190421122154.26465-7-johan@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190421122154.26465-1-johan@kernel.org> References: <20190421122154.26465-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Drop bogus TIOCM_CTS, which is not a cflag, from the initial terminal settings. Note that the corresponding bit is already set by CS8. Signed-off-by: Johan Hovold --- drivers/usb/serial/iuu_phoenix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 449e89db9cea..93763d3d5e56 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -943,8 +943,7 @@ static void iuu_close(struct usb_serial_port *port) static void iuu_init_termios(struct tty_struct *tty) { tty->termios = tty_std_termios; - tty->termios.c_cflag = CLOCAL | CREAD | CS8 | B9600 - | TIOCM_CTS | CSTOPB | PARENB; + tty->termios.c_cflag = CLOCAL | CREAD | CS8 | B9600 | CSTOPB | PARENB; tty->termios.c_ispeed = 9600; tty->termios.c_ospeed = 9600; tty->termios.c_lflag = 0; From patchwork Sun Apr 21 12:21:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10910497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 886ED14DB for ; Sun, 21 Apr 2019 12:22:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 791C2284E8 for ; Sun, 21 Apr 2019 12:22:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D59728724; Sun, 21 Apr 2019 12:22:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05DD7284E8 for ; Sun, 21 Apr 2019 12:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727502AbfDUMWD (ORCPT ); Sun, 21 Apr 2019 08:22:03 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:34993 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727394AbfDUMWA (ORCPT ); Sun, 21 Apr 2019 08:22:00 -0400 Received: by mail-lj1-f194.google.com with SMTP id t4so8185471ljc.2 for ; Sun, 21 Apr 2019 05:21:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p5bWSJsEz+ddv2Q+fw+xPBri0Ahm6avFqe4fG8KjMJU=; b=TJtQVoyQSI7SHAqkiXeYF0GovAOXp6aDjlRZJlGGnvj0Kq33mW+yTT+HwWvu0U9x4C SVja1OAeS2rK7MxLu5NyFCFTPhqYIqhBeaACVGpBn1VbPmR/i4YIKfMOD1vgGmLRGNZE 8sBpKNqc7Bf0D/aESD4+8s3BmYa3n134yI7nwNLHoZIULGl7cRpzFjnnbtCYfqvSWoW0 n3kTH2Vwmaq+ylGywRJCF0SmN3qaxAawi9TkVB5fZ1o+FPE7PzGd6uFHXERcwHQRmrz/ npE8ssljYLXvHtUXN41WaAqtiSiy8xipJ2bSm0NWd8JfJE71FCFlfhHpL3DtBZolXYvd ypmA== X-Gm-Message-State: APjAAAV9+rzSL8c0mDLXZg09u4UGMqA+x6BD/xox5+g8VjHK+tZnbouH SXFC2P/4RE3dp4HgMw/uCrYA8dge X-Google-Smtp-Source: APXvYqxpKDSAAZJdbZ1hr79s9rrUcgPSTXkpmVQIMbPThcsRwTjhVmekJeVUH0svGbU7pTTnDjNsBw== X-Received: by 2002:a2e:8050:: with SMTP id p16mr7406683ljg.160.1555849318548; Sun, 21 Apr 2019 05:21:58 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id f21sm2233538ljk.94.2019.04.21.05.21.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Apr 2019 05:21:55 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hIBTs-0006uE-MI; Sun, 21 Apr 2019 14:22:00 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 7/9] USB: serial: iuu_phoenix: simplify init_termios Date: Sun, 21 Apr 2019 14:21:52 +0200 Message-Id: <20190421122154.26465-8-johan@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190421122154.26465-1-johan@kernel.org> References: <20190421122154.26465-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Override the initial terminal settings provided by core directly instead of first resetting them to tty_std_termios. Also reorder the cflags as they are usually seen (in bit order). Signed-off-by: Johan Hovold --- drivers/usb/serial/iuu_phoenix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 93763d3d5e56..d5bff69b1769 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -942,8 +942,7 @@ static void iuu_close(struct usb_serial_port *port) static void iuu_init_termios(struct tty_struct *tty) { - tty->termios = tty_std_termios; - tty->termios.c_cflag = CLOCAL | CREAD | CS8 | B9600 | CSTOPB | PARENB; + tty->termios.c_cflag = B9600 | CS8 | CSTOPB | CREAD | PARENB | CLOCAL; tty->termios.c_ispeed = 9600; tty->termios.c_ospeed = 9600; tty->termios.c_lflag = 0; From patchwork Sun Apr 21 12:21:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10910501 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F85C14DB for ; Sun, 21 Apr 2019 12:22:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F1162864A for ; Sun, 21 Apr 2019 12:22:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80FC5287B5; Sun, 21 Apr 2019 12:22:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 387F32864A for ; Sun, 21 Apr 2019 12:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727514AbfDUMWF (ORCPT ); Sun, 21 Apr 2019 08:22:05 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:33405 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727495AbfDUMWE (ORCPT ); Sun, 21 Apr 2019 08:22:04 -0400 Received: by mail-lf1-f65.google.com with SMTP id j11so7136771lfm.0 for ; Sun, 21 Apr 2019 05:22:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lEsJXvjwb/PGf4av9Kna2ZrjEm18j4+1PhbIO6niJ8o=; b=muKhPTJkfQ4BvjPF8QFm3lj8Dh3MA0RL127PPmYxkUEX3qUVm64087aCzMc8DeUC+F yojmedf/3Sc5fw7Lnjre8qAa7TP5aDa1FEANCvzyTfPDKKSJ2KBg5b72DMYM/GC+MPZW gPrR2o3+f1tnQMwI1e84IrY3kBQL/ntZ32ANUXAZfpjFhe1G8WEB5L51DLI4ip8AE31P TqNMnUFnuPCobuQAr4g83GE/HUoWFoEr9d6e4uCHAAOtxDpPgU/7r2pdPeVF3DE7nbq9 xsqsvw/8FYfl7Ab9T64GjFAaXSB0PofjH24vSfJ3luRxmG/JMmoMiZn9L+aSA59iUoI2 MbIg== X-Gm-Message-State: APjAAAV3iBhdbOCb+VRCZGDMC2acciZn4M1nNmQKrL6NfDvNCWDZKojN Vlv98bdlUsanpEjtRcAMK2NvOUN0 X-Google-Smtp-Source: APXvYqxbV2gy/SI7rV1Tpzm2vmiye0w2jrTo0CVWo+Pgtk5G31JtIxcQCVrAKn5tDZYKpY8udpqmeA== X-Received: by 2002:a19:1dc7:: with SMTP id d190mr7569632lfd.48.1555849321660; Sun, 21 Apr 2019 05:22:01 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id k25sm2221230ljc.14.2019.04.21.05.21.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Apr 2019 05:21:55 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hIBTs-0006uJ-PB; Sun, 21 Apr 2019 14:22:00 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 8/9] USB: serial: oti6858: simplify init_termios Date: Sun, 21 Apr 2019 14:21:53 +0200 Message-Id: <20190421122154.26465-9-johan@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190421122154.26465-1-johan@kernel.org> References: <20190421122154.26465-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify init_termios which is only used to override the initial baudrate. Signed-off-by: Johan Hovold --- drivers/usb/serial/oti6858.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index ae9cb15ee02d..38ae0fc826cc 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -393,10 +393,7 @@ static int oti6858_chars_in_buffer(struct tty_struct *tty) static void oti6858_init_termios(struct tty_struct *tty) { - tty->termios = tty_std_termios; - tty->termios.c_cflag = B38400 | CS8 | CREAD | HUPCL | CLOCAL; - tty->termios.c_ispeed = 38400; - tty->termios.c_ospeed = 38400; + tty_encode_baud_rate(tty, 38400, 38400); } static void oti6858_set_termios(struct tty_struct *tty, From patchwork Sun Apr 21 12:21:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10910503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F8EA17E0 for ; Sun, 21 Apr 2019 12:22:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BA4D2866C for ; Sun, 21 Apr 2019 12:22:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 104A9287B5; Sun, 21 Apr 2019 12:22:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF8762866C for ; Sun, 21 Apr 2019 12:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727527AbfDUMWG (ORCPT ); Sun, 21 Apr 2019 08:22:06 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46632 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727493AbfDUMWD (ORCPT ); Sun, 21 Apr 2019 08:22:03 -0400 Received: by mail-lj1-f193.google.com with SMTP id h21so8159900ljk.13 for ; Sun, 21 Apr 2019 05:22:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/ScZUliEh9FnHx45z8707jRm5oj6HJmrw+aT4INikS0=; b=sIv+PDttqvPfmR3VTLQPfHlQqQjwCkQO0vZxHhWBHOHYcMPpY/JK0KpMVTrNnnboUW j4hDJDoohGwLAloHqBtGGbvYxLWyVn0CFJe1QBBYhCmwj90pxgrTe9jgj2g9T6kHod16 lbJdt91/oIxYw/AIZlsci1dUWJCBDw8s5EDW96KolfpagjKbhzOILSUw+n9iP8D8FUV6 SK+aWzSxj4JbrdABY0YM0sCSZk54HYwgPr/51KGtddMWkK6swChdQEkmp8upktLdAP8R 3HEfnfWnvWR5P+WlxqDAwfNedja3Ho3rVh7GwFaaQLdKdHjErqDfN0/8yLXKT2xpAGO6 hEiA== X-Gm-Message-State: APjAAAVWm2zXETqpLqtLKG9gxJx9QxZ4HyE1Ie208PJe7jyBsAZqLUQE IXyyIqUl14LYte48rQ89vOB9Lt7y X-Google-Smtp-Source: APXvYqw5ug0DLNLbpBzXz94g6DMNk2yhF5w0L7H9zGJwkNjDr9vATtqgqYM/0ybrclIZYesWnocDWQ== X-Received: by 2002:a2e:844a:: with SMTP id u10mr7418183ljh.41.1555849321144; Sun, 21 Apr 2019 05:22:01 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id w2sm2854341lfa.63.2019.04.21.05.21.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Apr 2019 05:21:55 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hIBTs-0006uO-RL; Sun, 21 Apr 2019 14:22:00 +0200 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 9/9] USB: serial: spcp8x5: simplify init_termios Date: Sun, 21 Apr 2019 14:21:54 +0200 Message-Id: <20190421122154.26465-10-johan@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190421122154.26465-1-johan@kernel.org> References: <20190421122154.26465-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify init_termios which is only used to override the initial baudrate. Signed-off-by: Johan Hovold --- drivers/usb/serial/spcp8x5.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index b42714855364..3bac55bd9bd9 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c @@ -281,10 +281,7 @@ static void spcp8x5_dtr_rts(struct usb_serial_port *port, int on) static void spcp8x5_init_termios(struct tty_struct *tty) { - tty->termios = tty_std_termios; - tty->termios.c_cflag = B115200 | CS8 | CREAD | HUPCL | CLOCAL; - tty->termios.c_ispeed = 115200; - tty->termios.c_ospeed = 115200; + tty_encode_baud_rate(tty, 115200, 115200); } static void spcp8x5_set_termios(struct tty_struct *tty,