From patchwork Tue Mar 30 14:37:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12172721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 381B6C433C1 for ; Tue, 30 Mar 2021 14:38:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F063A619CB for ; Tue, 30 Mar 2021 14:38:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231979AbhC3Ohk (ORCPT ); Tue, 30 Mar 2021 10:37:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:50402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231951AbhC3OhH (ORCPT ); Tue, 30 Mar 2021 10:37:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD8C6619BD; Tue, 30 Mar 2021 14:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617115027; bh=7N5l3ZIfotiyDGJq6YGwcyxdCzpYtn6rXpIa367Go3Y=; h=From:To:Cc:Subject:Date:From; b=HcRRgjIrquW58c+zFBT5gMK5xmgyroMz/BfLYDySSGooyppWHSNR7k68zRsPYl8Pb 5YHAyAjg90bz1JejMDBtkEJEJgzxjpvW5SQu2HNp3j8iG5+dTAABbNiciBtCbNHZeQ LtoJ1+sH7gyZ2SoqTowP+pYWzn+zzVATzALAqw6vqk/JRa0ydki/Mc6ISAKvd3uVY2 ZEr4XLeJbWCFDSbyEVMEws4XxdKTlLaB6UA6XZdG9JR3mFRRE4HXmUiGKy06HFKZ03 iSRekWgQb4ovMvyBtwR2iKr5VghQigyfflTB8qxj2t8oBO7ceIoHHsGiCx+XT9b8ch 8j7eapmBL+YCw== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lRFUm-0002Ma-CH; Tue, 30 Mar 2021 16:37:28 +0200 From: Johan Hovold To: Johan Hovold Cc: Mauro Carvalho Chehab , Manivannan Sadhasivam , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] USB: serial: xr: fix CSIZE handling Date: Tue, 30 Mar 2021 16:37:16 +0200 Message-Id: <20210330143716.9042-1-johan@kernel.org> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The XR21V141X does not have a 5- or 6-bit mode, but the current implementation failed to properly restore the old setting when CS5 or CS6 was requested. Instead an invalid request would be sent to the device. Fixes: c2d405aa86b4 ("USB: serial: add MaxLinear/Exar USB to Serial driver") Signed-off-by: Johan Hovold Reviewed-by: Manivannan Sadhasivam --- drivers/usb/serial/xr_serial.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c index 0ca04906da4b..c59c8b47a120 100644 --- a/drivers/usb/serial/xr_serial.c +++ b/drivers/usb/serial/xr_serial.c @@ -467,6 +467,11 @@ static void xr_set_termios(struct tty_struct *tty, termios->c_cflag &= ~CSIZE; if (old_termios) termios->c_cflag |= old_termios->c_cflag & CSIZE; + else + termios->c_cflag |= CS8; + + if (C_CSIZE(tty) == CS7) + bits |= XR21V141X_UART_DATA_7; else bits |= XR21V141X_UART_DATA_8; break;