From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385783; b=bUH5tLjHl+qOIHxKB09QMJQN2z87/AUDJ0tC0WikGr++bmJAfge5CtJibsap7LTjZn3v eqd0+2omnMbJWW0kkGK2gI8Yxa2Z521T6r66d0ettYl6ftKzPMld66FEaRIfjJGvODB7O GSeo4MOThYLGL0MvufGwbtB/tJ4m3YpdcRgL2Uwkw/INA3zIBf4yFvQVsPifljUb/iytI pxSFBk0LKPGMUqcg5PYsYR11Q7TR/l8B7EJejVcImrZqLH+I30/S3FvwiBKpb8e9UC2Je 8vtf1TymlGNiEnvyMW7zrOwKWRZxqZM/jQWe+3Mrpdhy4YADvHDyasEb2VEdCKLxjOw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385783; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=U0hm8vWynMRLR/Jetufy8SER/4MvgBwtAsFp5xf8hMg=; b=RIPNhBTAtVRizM5osKrrVWOXeUatY3PzscMeCG0mxgWLIJzMw8ldlgxvot3mFcseKT4g V+Bwt++XiJM8bA+1i9cM4Xoy4nEx/x3B1ZYt8muCx2a/573QWLS0YlclgNZQ4sKqDf8sc AlaujDmc3TUzDLXKZ55hbtGofs5uAg2ukZacnzamakyTNND6/nYau+MlF1Uh/ymFcnty2 EHV65Mw6X8thf6VZcyGVxqqPBKIKJEkBuGktwC2/XjnPn8avZgposQfk80FvJh9HdJhjE X64QzIqzmgBVMkRbJrlr9OxXgKs0dOCY/OFIySqPOL10/cLXQHA1QjEtsRDdkchb15w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kJHTN8Gl; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B298606A33A; Fri, 4 Dec 2026 12:03:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kJHTN8Gl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 718AF1F000C2; Fri, 4 Dec 2026 12:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385782; bh=U0hm8vWynMRLR/Jetufy8SER/4MvgBwtAsFp5xf8hMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kJHTN8GlG6/Iun8SIMCIDZvnqHDEfJbVICs/M+vKHiHUDjgcHrVWJ/Nlkw0f1D8VC ndSzPVu8H9XjK1yqGGGCRAaXoPYP/GvION6zoehrkiDiwCXrije47T+JZEKfFeQUG3 kYIY7QppkazVFZXBcfCeXt8PWr8a6xHV0TUZpDJ8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johan Hovold Subject: [PATCH 6.6 0675/1167] USB: serial: io_edgeport: move initial termios update to open() Date: Fri, 4 Dec 2026 19:01:42 +0900 Message-ID: <20261204100719.640947176@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit febadc65a4ef8d08a12e76d6ec50834d72cc0e59 upstream. Explicitly update the terminal settings on open() instead of doing so from the interrupt completion handler when receiving an open command response, which in theory can be received after a failed open attempt. Note that this will be used to fix a FIFO corruption issue and also allows for switching to synchronous commands. Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/io_edgeport.c | 64 ++++++--------------------------------- 1 file changed, 10 insertions(+), 54 deletions(-) --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -281,8 +281,7 @@ static void handle_new_lsr(struct edgepo static int send_iosp_ext_cmd(struct edgeport_port *edge_port, __u8 command, __u8 param); static int calc_baud_rate_divisor(struct device *dev, int baud_rate, int *divisor); -static void change_port_settings(struct tty_struct *tty, - struct edgeport_port *edge_port, +static void edge_set_termios(struct tty_struct *tty, struct usb_serial_port *port, const struct ktermios *old_termios); static int send_cmd_write_uart_register(struct edgeport_port *edge_port, __u8 regNum, __u8 regValue); @@ -923,6 +922,9 @@ static int edge_open(struct tty_struct * return -ENOMEM; } + if (tty) + edge_set_termios(tty, port, NULL); + spin_lock_irq(&edge_port->ep_lock); edge_port->open = true; spin_unlock_irq(&edge_port->ep_lock); @@ -1444,30 +1446,6 @@ static void edge_unthrottle(struct tty_s /***************************************************************************** - * SerialSetTermios - * this function is called by the tty driver when it wants to change - * the termios structure - *****************************************************************************/ -static void edge_set_termios(struct tty_struct *tty, - struct usb_serial_port *port, - const struct ktermios *old_termios) -{ - struct edgeport_port *edge_port = usb_get_serial_port_data(port); - - if (edge_port == NULL) - return; - - if (!edge_port->open) { - dev_dbg(&port->dev, "%s - port not opened\n", __func__); - return; - } - - /* change the port settings to the new ones specified */ - change_port_settings(tty, edge_port, old_termios); -} - - -/***************************************************************************** * get_lsr_info - get line status register info * * Purpose: Let user call ioctl() to get info when the UART physically @@ -1756,7 +1734,6 @@ static void process_rcvd_status(struct e { struct usb_serial_port *port; struct edgeport_port *edge_port; - struct tty_struct *tty; struct device *dev; __u8 code = edge_serial->rxStatusCode; @@ -1808,15 +1785,6 @@ static void process_rcvd_status(struct e __func__, edge_serial->rxPort, byte2, edge_port->txCredits); handle_new_msr(edge_port, byte2); - /* send the current line settings to the port so we are - in sync with any further termios calls */ - tty = tty_port_tty_get(&edge_port->port->port); - if (tty) { - change_port_settings(tty, - edge_port, &tty->termios); - tty_kref_put(tty); - } - /* we have completed the open */ edge_port->openPending = false; wake_up(&edge_port->wait_open); @@ -2328,18 +2296,12 @@ static int send_cmd_write_uart_register( } -/***************************************************************************** - * change_port_settings - * This routine is called to set the UART on the device to match the - * specified new settings. - *****************************************************************************/ - -static void change_port_settings(struct tty_struct *tty, - struct edgeport_port *edge_port, const struct ktermios *old_termios) +static void edge_set_termios(struct tty_struct *tty, struct usb_serial_port *port, + const struct ktermios *old_termios) { - struct device *dev = &edge_port->port->dev; - struct edgeport_serial *edge_serial = - usb_get_serial_data(edge_port->port->serial); + struct edgeport_serial *edge_serial = usb_get_serial_data(port->serial); + struct edgeport_port *edge_port = usb_get_serial_port_data(port); + struct device *dev = &port->dev; int baud; unsigned cflag; __u8 mask = 0xff; @@ -2350,12 +2312,6 @@ static void change_port_settings(struct __u8 txFlow; int status; - if (!edge_port->open && - !edge_port->openPending) { - dev_dbg(dev, "%s - port not opened\n", __func__); - return; - } - cflag = tty->termios.c_cflag; switch (cflag & CSIZE) { @@ -2489,7 +2445,7 @@ static void change_port_settings(struct dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud); status = send_cmd_write_baud_rate(edge_port, baud); - if (status == -1) { + if (status == -1 && old_termios) { /* Speed change was not possible - put back the old speed */ baud = tty_termios_baud_rate(old_termios); tty_encode_baud_rate(tty, baud, baud);