From nobody Thu Apr 9 10:30:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B9B6C28D13 for ; Thu, 25 Aug 2022 08:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236760AbiHYI6b (ORCPT ); Thu, 25 Aug 2022 04:58:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236094AbiHYI60 (ORCPT ); Thu, 25 Aug 2022 04:58:26 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A152A895E; Thu, 25 Aug 2022 01:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661417905; x=1692953905; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/0WWmiRPF3uFY9MzfKxoOf7bMrDf+HChU7RPdgkXq9c=; b=VhCPI65E2tTUr1DMvkpSgUZXfJoVDbFqvK9y/neg/5RsKRbjyIUbiRYP naKtQiv874kQ0NhrN/EUCCR8JZpViTrp53A26CSt8gO929ZHCzufEauA2 NkCE3GDILiRTMUQs6bCBauzsge+A/lYqbiTIlHB//ZaJO/p4nivSZ5kui j7dMlHvZjrSE1yY1LTfUHauJHFGH0/B0D5oX517GoAK20eUjgtCNz1MuP H3R+zi+gQ4VLjP584qHwZRa9Jft2jRld9VXOY5J5NqwWq7jFmFZ90Sg8v LCQtBMBMTKBGTM5BpKV3yrNGGWZJveEsxko0g8bu/GGUK4GFVJE0St4Pm g==; X-IronPort-AV: E=McAfee;i="6500,9779,10449"; a="273941384" X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="273941384" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:24 -0700 X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="670893909" Received: from mblazque-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.249.44.101]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:22 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, Timur Tabi , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 1/5] serial: ucc_uart: Remove custom frame size calculation Date: Thu, 25 Aug 2022 11:58:06 +0300 Message-Id: <20220825085810.7290-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> References: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The number of bits can be calculated using tty_get_frame_size(), no need for the driver to do it on its own. Also remove a comment on number of bits that doesn't match the code nor the comment on ucc_uart_pram's rx_length ("minus 1" part differs). That comment seems a verbatim copy of that in cpm_uart/cpm_uart_core.c anyway so perhaps it was just copied over w/o much thinking. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Andy Shevchenko --- drivers/tty/serial/ucc_uart.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index 3cc9ef08455c..7331964163c5 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c @@ -853,13 +853,6 @@ static void qe_uart_set_termios(struct uart_port *port, u16 upsmr =3D ioread16be(&uccp->upsmr); struct ucc_uart_pram __iomem *uccup =3D qe_port->uccup; u16 supsmr =3D ioread16be(&uccup->supsmr); - u8 char_length =3D 2; /* 1 + CL + PEN + 1 + SL */ - - /* Character length programmed into the mode register is the - * sum of: 1 start bit, number of data bits, 0 or 1 parity bit, - * 1 or 2 stop bits, minus 1. - * The value 'bits' counts this for us. - */ =20 /* byte size */ upsmr &=3D UCC_UART_UPSMR_CL_MASK; @@ -869,22 +862,18 @@ static void qe_uart_set_termios(struct uart_port *por= t, case CS5: upsmr |=3D UCC_UART_UPSMR_CL_5; supsmr |=3D UCC_UART_SUPSMR_CL_5; - char_length +=3D 5; break; case CS6: upsmr |=3D UCC_UART_UPSMR_CL_6; supsmr |=3D UCC_UART_SUPSMR_CL_6; - char_length +=3D 6; break; case CS7: upsmr |=3D UCC_UART_UPSMR_CL_7; supsmr |=3D UCC_UART_SUPSMR_CL_7; - char_length +=3D 7; break; default: /* case CS8 */ upsmr |=3D UCC_UART_UPSMR_CL_8; supsmr |=3D UCC_UART_SUPSMR_CL_8; - char_length +=3D 8; break; } =20 @@ -892,13 +881,11 @@ static void qe_uart_set_termios(struct uart_port *por= t, if (termios->c_cflag & CSTOPB) { upsmr |=3D UCC_UART_UPSMR_SL; supsmr |=3D UCC_UART_SUPSMR_SL; - char_length++; /* + SL */ } =20 if (termios->c_cflag & PARENB) { upsmr |=3D UCC_UART_UPSMR_PEN; supsmr |=3D UCC_UART_SUPSMR_PEN; - char_length++; /* + PEN */ =20 if (!(termios->c_cflag & PARODD)) { upsmr &=3D ~(UCC_UART_UPSMR_RPM_MASK | @@ -953,7 +940,7 @@ static void qe_uart_set_termios(struct uart_port *port, iowrite16be(upsmr, &uccp->upsmr); if (soft_uart) { iowrite16be(supsmr, &uccup->supsmr); - iowrite8(char_length, &uccup->rx_length); + iowrite8(tty_get_frame_size(termios->c_cflag), &uccup->rx_length); =20 /* Soft-UART requires a 1X multiplier for TX */ qe_setbrg(qe_port->us_info.rx_clock, baud, 16); --=20 2.30.2 From nobody Thu Apr 9 10:30:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79708C04AA5 for ; Thu, 25 Aug 2022 08:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237365AbiHYI6m (ORCPT ); Thu, 25 Aug 2022 04:58:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236540AbiHYI62 (ORCPT ); Thu, 25 Aug 2022 04:58:28 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C928A895E; Thu, 25 Aug 2022 01:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661417907; x=1692953907; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PyKfNVg9kX6GwGqHuc+KZ4p4tdSz9WytUz5q38WWqy0=; b=lJho7PdkpJzIywNxNOo+MTb91okXtrnLLO+0Os5ICzcqbvIHTipp4loE dkCyFSeAxvNPhsvexOx9bWYFUnjdlNc3aXNG5hWqSdxy3T6W1fp1b0jTK rOTILvt4gW+CEBqLls5B/090FXDHGx3UtLyv6gGqFwcyT0pZHY6KbCgvT +jgxDg8TZa6MathJUloyrXDi3OT5uqtVs82li1QJQP+6d4TOWCKZciBlI kpqw4URVkrMe6kBkPHTPH8O55rOOvlUOPgMNj+wWJLl9duSAeU4yRKvxl AKRU+AXDQKdU2xmD8LfC+WHkJMDSXuLlCaS67Q1TVWpRpx2RH8PGWPC/R g==; X-IronPort-AV: E=McAfee;i="6500,9779,10449"; a="273941395" X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="273941395" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:27 -0700 X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="670893918" Received: from mblazque-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.249.44.101]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:25 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 2/5] serial: cpm_uart: Remove custom frame size calculation Date: Thu, 25 Aug 2022 11:58:07 +0300 Message-Id: <20220825085810.7290-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> References: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The number of bits can be calculated using helpers in core, no need for the driver to do it on its own. The mode register is programmed with frame bits minus 1, rearrange the comments related to that "feature" closer to the actual write. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Andy Shevchenko --- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 28 ++++++--------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/seri= al/cpm_uart/cpm_uart_core.c index db07d6a5d764..96c6ee379c03 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -489,7 +489,6 @@ static void cpm_uart_set_termios(struct uart_port *port, int baud; unsigned long flags; u16 cval, scval, prev_mode; - int bits, sbits; struct uart_cpm_port *pinfo =3D container_of(port, struct uart_cpm_port, port); smc_t __iomem *smcp =3D pinfo->smcp; @@ -515,28 +514,17 @@ static void cpm_uart_set_termios(struct uart_port *po= rt, if (maxidl > 0x10) maxidl =3D 0x10; =20 - /* Character length programmed into the mode register is the - * sum of: 1 start bit, number of data bits, 0 or 1 parity bit, - * 1 or 2 stop bits, minus 1. - * The value 'bits' counts this for us. - */ cval =3D 0; scval =3D 0; =20 - /* byte size */ - bits =3D tty_get_char_size(termios->c_cflag); - sbits =3D bits - 5; - if (termios->c_cflag & CSTOPB) { cval |=3D SMCMR_SL; /* Two stops */ scval |=3D SCU_PSMR_SL; - bits++; } =20 if (termios->c_cflag & PARENB) { cval |=3D SMCMR_PEN; scval |=3D SCU_PSMR_PEN; - bits++; if (!(termios->c_cflag & PARODD)) { cval |=3D SMCMR_PM_EVEN; scval |=3D (SCU_PSMR_REVP | SCU_PSMR_TEVP); @@ -580,11 +568,6 @@ static void cpm_uart_set_termios(struct uart_port *por= t, =20 spin_lock_irqsave(&port->lock, flags); =20 - /* Start bit has not been added (so don't, because we would just - * subtract it later), and we need to add one for the number of - * stops bits (there is always at least one). - */ - bits++; if (IS_SMC(pinfo)) { /* * MRBLR can be changed while an SMC/SCC is operating only @@ -604,13 +587,16 @@ static void cpm_uart_set_termios(struct uart_port *po= rt, */ prev_mode =3D in_be16(&smcp->smc_smcmr) & (SMCMR_REN | SMCMR_TEN); /* Output in *one* operation, so we don't interrupt RX/TX if they - * were already enabled. */ - out_be16(&smcp->smc_smcmr, smcr_mk_clen(bits) | cval | - SMCMR_SM_UART | prev_mode); + * were already enabled. + * Character length programmed into the register is frame bits minus 1. + */ + out_be16(&smcp->smc_smcmr, smcr_mk_clen(tty_get_frame_size(termios->c_cf= lag) - 1) | + cval | SMCMR_SM_UART | prev_mode); } else { out_be16(&pinfo->sccup->scc_genscc.scc_mrblr, pinfo->rx_fifosize); out_be16(&pinfo->sccup->scc_maxidl, maxidl); - out_be16(&sccp->scc_psmr, (sbits << 12) | scval); + out_be16(&sccp->scc_psmr, (UART_LCR_WLEN(tty_get_char_size(termios->c_cf= lag)) + << 12) | scval); } =20 if (pinfo->clk) --=20 2.30.2 From nobody Thu Apr 9 10:30:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44C3EC3F6B0 for ; Thu, 25 Aug 2022 08:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237642AbiHYI6r (ORCPT ); Thu, 25 Aug 2022 04:58:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236838AbiHYI6d (ORCPT ); Thu, 25 Aug 2022 04:58:33 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C77A897D; Thu, 25 Aug 2022 01:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661417910; x=1692953910; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mo3+Z0Et9XVBfR5W8mmg0CVqSKWWShtgU39BQYehL8Y=; b=kRUXDG8TqwxdBtN2dzH1lrTTF4C2m0T4NiICaoStS9n+AdfXyFnz6xPn JqiXOjJUoG10GAW/lY1mMLm9p92REtdTxFmkaI5ZK9IYHsdkf7545FeEf MynM3aVLNDdtn0R1gjVj+NnbIamf9rFnWJ3Kv6shNC/XfKhNPa0K667Kl I4NoIeuNeUVbJro3s9Roh7NW0qI2lxpQY+K60TecpaVvkdmg3h0BBgMqr dhDQ+FZLl0JsqSJpd8NqbiGhL03VDcdYCMFHTlopOl4IKSjitXgQY2aKh fchEnMA0PedeeZtxojHuk17d+VTH2dPX/rNh0GkWOYP7YHg3CowDxt5L6 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10449"; a="273941407" X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="273941407" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:30 -0700 X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="670893930" Received: from mblazque-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.249.44.101]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:28 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 3/5] serial: fsl_lpuart: Remove custom frame size calculation Date: Thu, 25 Aug 2022 11:58:08 +0300 Message-Id: <20220825085810.7290-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> References: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The number of bits can be calculated using tty_get_frame_size(), no need for the driver to do it on its own. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Andy Shevchenko --- drivers/tty/serial/fsl_lpuart.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuar= t.c index f6c33cd228c8..926460f1dc08 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1284,23 +1284,19 @@ static inline int lpuart_start_rx_dma(struct lpuart= _port *sport) struct dma_slave_config dma_rx_sconfig =3D {}; struct circ_buf *ring =3D &sport->rx_ring; int ret, nent; - int bits, baud; + int baud; struct tty_port *port =3D &sport->port.state->port; struct tty_struct *tty =3D port->tty; struct ktermios *termios =3D &tty->termios; struct dma_chan *chan =3D sport->dma_rx_chan; =20 baud =3D tty_get_baud_rate(tty); - - bits =3D (termios->c_cflag & CSIZE) =3D=3D CS7 ? 9 : 10; - if (termios->c_cflag & PARENB) - bits++; - /* * Calculate length of one DMA buffer size to keep latency below * 10ms at any baud rate. */ - sport->rx_dma_rng_buf_len =3D (DMA_RX_TIMEOUT * baud / bits / 1000) * 2; + sport->rx_dma_rng_buf_len =3D (DMA_RX_TIMEOUT * baud / tty_get_frame_size= (termios->c_cflag) / + 1000) * 2; sport->rx_dma_rng_buf_len =3D (1 << (fls(sport->rx_dma_rng_buf_len) - 1)); if (sport->rx_dma_rng_buf_len < 16) sport->rx_dma_rng_buf_len =3D 16; --=20 2.30.2 From nobody Thu Apr 9 10:30:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09FB3C04AA5 for ; Thu, 25 Aug 2022 08:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237975AbiHYI6w (ORCPT ); Thu, 25 Aug 2022 04:58:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237255AbiHYI6h (ORCPT ); Thu, 25 Aug 2022 04:58:37 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B2DEA8CD2; Thu, 25 Aug 2022 01:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661417913; x=1692953913; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YcSvNB23AhSi5EswqOVHYUWtaN9VoCvzviSsnzaVGZo=; b=Vz3tdMAVMZJYa4sCxqp/mHg1yX+4SBT1g5I52dNaEtHuwa4K4p2/00sz CqLjnPHQfjhJmmvQ0/HN2DXBLu3432y+wlHv1ZvasrcJR6ED8V8Q7oiYF FZczXvN5Zz1s3LM98+VtcOJWezoEVJ6QUEQH5eTkxtv2SiIhUHce2Ccyz 9ehUqtTjSuTBTOuoB3AG78xVfHyXOESSLnViv0XKJsFIcwyHWsBweEdDk 0lTio3BoJ3fPiBnNKuIP+4TpQnkXLik9qZUPZ3/IpL2YitITQSM9rfjuy msj2v98/qeC1jTVH4QCPo1p6WHMbgZ8fX72QQbxspzpIt2rNxyAkrMBNL Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10449"; a="273941431" X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="273941431" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:33 -0700 X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="670893942" Received: from mblazque-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.249.44.101]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:31 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 4/5] serial: sunsab: Remove frame size calculation dead-code Date: Thu, 25 Aug 2022 11:58:09 +0300 Message-Id: <20220825085810.7290-5-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> References: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver features a custom frame length calculation but the result is never used. Remove it. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Andy Shevchenko --- drivers/tty/serial/sunsab.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index 6ea52293d9f3..f7968f73753d 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c @@ -681,27 +681,23 @@ static void sunsab_convert_to_sab(struct uart_sunsab_= port *up, unsigned int cfla unsigned int quot) { unsigned char dafo; - int bits, n, m; + int n, m; =20 /* Byte size and parity */ switch (cflag & CSIZE) { - case CS5: dafo =3D SAB82532_DAFO_CHL5; bits =3D 7; break; - case CS6: dafo =3D SAB82532_DAFO_CHL6; bits =3D 8; break; - case CS7: dafo =3D SAB82532_DAFO_CHL7; bits =3D 9; break; - case CS8: dafo =3D SAB82532_DAFO_CHL8; bits =3D 10; break; + case CS5: dafo =3D SAB82532_DAFO_CHL5; break; + case CS6: dafo =3D SAB82532_DAFO_CHL6; break; + case CS7: dafo =3D SAB82532_DAFO_CHL7; break; + case CS8: dafo =3D SAB82532_DAFO_CHL8; break; /* Never happens, but GCC is too dumb to figure it out */ - default: dafo =3D SAB82532_DAFO_CHL5; bits =3D 7; break; + default: dafo =3D SAB82532_DAFO_CHL5; break; } =20 - if (cflag & CSTOPB) { + if (cflag & CSTOPB) dafo |=3D SAB82532_DAFO_STOP; - bits++; - } =20 - if (cflag & PARENB) { + if (cflag & PARENB) dafo |=3D SAB82532_DAFO_PARE; - bits++; - } =20 if (cflag & PARODD) { dafo |=3D SAB82532_DAFO_PAR_ODD; --=20 2.30.2 From nobody Thu Apr 9 10:30:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28E4DC3F6B0 for ; Thu, 25 Aug 2022 08:58:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238045AbiHYI65 (ORCPT ); Thu, 25 Aug 2022 04:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237510AbiHYI6q (ORCPT ); Thu, 25 Aug 2022 04:58:46 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D9CBA896F; Thu, 25 Aug 2022 01:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661417917; x=1692953917; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xWcqRqK9GSZt9NznWIFPcoPcb1DvRs46teeJkfDwcKk=; b=BH9+8xdaFNVEJwYngzSF0QvALLrV34bK68anUupewcQyt+0afe3tW7uq Fi8iwBU2s88gQ9J6XPEqPebIn81iDOT5XjrkdKPdmWEcMdQQI17tVjzrV VHu6Rsm0WvtMYym/d3/zMGuIRb+U3JK7/pvovbEx+nej5NtEn7fOZn7jL Z1LWZSvTkFQ/Vjg2bHFF6QBHOX+ucWIgkw726BHtTB7em+/wiThLDfMyn J6062YIYL6Ng4mTHhXMPj9qaS0U0x9oq4fhved3QQUuIoX3h14Zug4YOZ inMVEin6H09B6DUyXYo5RU+jOFJEdoBEnpMwGMPHYgLCZeI9gc9vE1zil w==; X-IronPort-AV: E=McAfee;i="6500,9779,10449"; a="273941445" X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="273941445" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:37 -0700 X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="670893955" Received: from mblazque-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.249.44.101]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 01:58:34 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, Laxman Dewangan , Thierry Reding , Jonathan Hunter , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5/5] serial: tegra: Remove custom frame size calculation Date: Thu, 25 Aug 2022 11:58:10 +0300 Message-Id: <20220825085810.7290-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> References: <20220825085810.7290-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The number of bits can be calculated using tty_get_frame_size(), no need for the driver to do it on its own. Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Andy Shevchenko --- drivers/tty/serial/serial-tegra.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-= tegra.c index ad4f3567ff90..5a56bd20abcd 100644 --- a/drivers/tty/serial/serial-tegra.c +++ b/drivers/tty/serial/serial-tegra.c @@ -1278,7 +1278,6 @@ static void tegra_uart_set_termios(struct uart_port *= u, unsigned long flags; unsigned int lcr; unsigned char char_bits; - int symb_bit =3D 1; struct clk *parent_clk =3D clk_get_parent(tup->uart_clk); unsigned long parent_clk_rate =3D clk_get_rate(parent_clk); int max_divider =3D (tup->cdata->support_clk_src_div) ? 0x7FFF : 0xFFFF; @@ -1305,7 +1304,6 @@ static void tegra_uart_set_termios(struct uart_port *= u, termios->c_cflag &=3D ~CMSPAR; =20 if ((termios->c_cflag & PARENB) =3D=3D PARENB) { - symb_bit++; if (termios->c_cflag & PARODD) { lcr |=3D UART_LCR_PARITY; lcr &=3D ~UART_LCR_EPAR; @@ -1318,22 +1316,18 @@ static void tegra_uart_set_termios(struct uart_port= *u, } =20 char_bits =3D tty_get_char_size(termios->c_cflag); - symb_bit +=3D char_bits; lcr &=3D ~UART_LCR_WLEN8; lcr |=3D UART_LCR_WLEN(char_bits); =20 /* Stop bits */ - if (termios->c_cflag & CSTOPB) { + if (termios->c_cflag & CSTOPB) lcr |=3D UART_LCR_STOP; - symb_bit +=3D 2; - } else { + else lcr &=3D ~UART_LCR_STOP; - symb_bit++; - } =20 tegra_uart_write(tup, lcr, UART_LCR); tup->lcr_shadow =3D lcr; - tup->symb_bit =3D symb_bit; + tup->symb_bit =3D tty_get_frame_size(termios->c_cflag); =20 /* Baud rate. */ baud =3D uart_get_baud_rate(u, termios, oldtermios, --=20 2.30.2