From patchwork Thu Mar 9 08:09:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 662050 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 C5867C61DA4 for ; Thu, 9 Mar 2023 08:09:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230043AbjCIIJk (ORCPT ); Thu, 9 Mar 2023 03:09:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjCIIJg (ORCPT ); Thu, 9 Mar 2023 03:09:36 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07E7480922; Thu, 9 Mar 2023 00:09:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678349375; x=1709885375; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RK695QH/y82SbaTTSnPKZdcNJwX827c00O+m1L7g7qE=; b=S7iMbP/eCPROpH3jQZPd2/55QhgpBmv749/IHj7tszQuvRnvQa920H9c 0s4Lsp7v+bV9EcUSibBucP4BJvElyzfMfrT3BaqgFFsldNB8fIt8NdB3z RgDS40wAI//M/Uv6gX89F1dTjE8nfmZlW7Jb+lqrjmv99pK5AcYcXVT3H sgN1f4n+U829+20sN7rbCzyffnGS9ePHQhrOyRPIXGiH9sxNGrIMrugjS 90qU3jJ2lCqzdsY430FFKpUmntdBwzFvVCsEMI46fVjjGjUAM2NBcyUvj TN8M1fulrVeXJyvTUZiPdfdhBtOT3P46SzfJqfD/UQPKWkkNRuPgxX3xk A==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="333853545" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="333853545" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="746227955" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="746227955" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:34 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 1/8] serial: Use ARRAY_SIZE() with iso7816 reserved array Date: Thu, 9 Mar 2023 10:09:16 +0200 Message-Id: <20230309080923.11778-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> References: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Instead of a literal, size the for loop iteration based on the actual array using ARRAY_SIZE(). Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/serial_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 2bd32c8ece39..ee2aabcc8943 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1491,7 +1492,7 @@ static int uart_set_iso7816_config(struct uart_port *port, * There are 5 words reserved for future use. Check that userspace * doesn't put stuff in there to prevent breakages in the future. */ - for (i = 0; i < 5; i++) + for (i = 0; i < ARRAY_SIZE(iso7816.reserved); i++) if (iso7816.reserved[i]) return -EINVAL; From patchwork Thu Mar 9 08:09:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 662049 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 EFBBDC6FD1F for ; Thu, 9 Mar 2023 08:11:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbjCIILD (ORCPT ); Thu, 9 Mar 2023 03:11:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbjCIIKU (ORCPT ); Thu, 9 Mar 2023 03:10:20 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90F13DABBA; Thu, 9 Mar 2023 00:09:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678349397; x=1709885397; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XRfgPpxn85tLsP11RZ0ULRKBpwwTVjqUGvOxfTssIbI=; b=RSB1rN1wb/isOzoPegHlumSOcJarT846lTr6zQ8lkDs6Pi50pmbOrLxc 9DiSmOhI0Fruz41DwGnhiylMJ3PNm8J+KCY2cWUUf/jE2CN+DfCpe6Z3V 5KR1fAGgzN154d6kHNlSPX/DHahzTuy/TqyE8FlhALbO8FI+BIO2CfIXt BCx7vLy172GzlCjL2hRUZH/ThofzznTRdq6FAmcPQsOKxHL5U5UkFlWZK G0b5zILRT70FwPTpgsmUFkQnfC5hWaEGjuqrCS+KbF++AWrem4ptlHhzo fWlnfXkKeb5OD4T8r/3mM1xJCySVOUa5dehdPA6s0Q2E5xEOuzzA9xCL8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="333853575" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="333853575" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="746227972" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="746227972" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:39 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 3/8] serial: Remove extern from func prototypes in headers Date: Thu, 9 Mar 2023 10:09:18 +0200 Message-Id: <20230309080923.11778-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> References: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Remove unnecessary externs from function prototypes in serial_8250.h and serial_core.h. Suggested-by: Jiri Slaby Signed-off-by: Ilpo Järvinen --- include/linux/serial_8250.h | 41 ++++++++++++++++--------------------- include/linux/serial_core.h | 13 ++++++------ 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 19376bee9667..482ce4e66a6b 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -151,26 +151,22 @@ void serial8250_unregister_port(int line); void serial8250_suspend_port(int line); void serial8250_resume_port(int line); -extern int early_serial_setup(struct uart_port *port); - -extern int early_serial8250_setup(struct earlycon_device *device, - const char *options); -extern void serial8250_update_uartclk(struct uart_port *port, - unsigned int uartclk); -extern void serial8250_do_set_termios(struct uart_port *port, - struct ktermios *termios, const struct ktermios *old); -extern void serial8250_do_set_ldisc(struct uart_port *port, - struct ktermios *termios); -extern unsigned int serial8250_do_get_mctrl(struct uart_port *port); -extern int serial8250_do_startup(struct uart_port *port); -extern void serial8250_do_shutdown(struct uart_port *port); -extern void serial8250_do_pm(struct uart_port *port, unsigned int state, - unsigned int oldstate); -extern void serial8250_do_set_mctrl(struct uart_port *port, unsigned int mctrl); -extern void serial8250_do_set_divisor(struct uart_port *port, unsigned int baud, - unsigned int quot, - unsigned int quot_frac); -extern int fsl8250_handle_irq(struct uart_port *port); +int early_serial_setup(struct uart_port *port); +int early_serial8250_setup(struct earlycon_device *device, const char *options); + +void serial8250_update_uartclk(struct uart_port *port, unsigned int uartclk); +void serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, + const struct ktermios *old); +void serial8250_do_set_ldisc(struct uart_port *port, struct ktermios *termios); +unsigned int serial8250_do_get_mctrl(struct uart_port *port); +int serial8250_do_startup(struct uart_port *port); +void serial8250_do_shutdown(struct uart_port *port); +void serial8250_do_pm(struct uart_port *port, unsigned int state, + unsigned int oldstate); +void serial8250_do_set_mctrl(struct uart_port *port, unsigned int mctrl); +void serial8250_do_set_divisor(struct uart_port *port, unsigned int baud, + unsigned int quot, unsigned int quot_frac); +int fsl8250_handle_irq(struct uart_port *port); int serial8250_handle_irq(struct uart_port *port, unsigned int iir); u16 serial8250_rx_chars(struct uart_8250_port *up, u16 lsr); void serial8250_read_char(struct uart_8250_port *up, u16 lsr); @@ -183,9 +179,8 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, int serial8250_console_setup(struct uart_port *port, char *options, bool probe); int serial8250_console_exit(struct uart_port *port); -extern void serial8250_set_isa_configurator(void (*v) - (int port, struct uart_port *up, - u32 *capabilities)); +void serial8250_set_isa_configurator(void (*v)(int port, struct uart_port *up, + u32 *capabilities)); #ifdef CONFIG_SERIAL_8250_RT288X unsigned int au_serial_in(struct uart_port *p, int offset); diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 9e3e5e0d11b2..05d18a145b3a 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -812,9 +812,8 @@ extern const struct earlycon_id __earlycon_table_end[]; #define EARLYCON_DECLARE(_name, fn) OF_EARLYCON_DECLARE(_name, "", fn) -extern int of_setup_earlycon(const struct earlycon_id *match, - unsigned long node, - const char *options); +int of_setup_earlycon(const struct earlycon_id *match, unsigned long node, + const char *options); #ifdef CONFIG_SERIAL_EARLYCON extern bool earlycon_acpi_spcr_enable __initdata; @@ -897,11 +896,11 @@ static inline bool uart_softcts_mode(struct uart_port *uport) * The following are helper functions for the low level drivers. */ -extern void uart_handle_dcd_change(struct uart_port *uport, bool active); -extern void uart_handle_cts_change(struct uart_port *uport, bool active); +void uart_handle_dcd_change(struct uart_port *uport, bool active); +void uart_handle_cts_change(struct uart_port *uport, bool active); -extern void uart_insert_char(struct uart_port *port, unsigned int status, - unsigned int overrun, unsigned int ch, unsigned int flag); +void uart_insert_char(struct uart_port *port, unsigned int status, + unsigned int overrun, unsigned int ch, unsigned int flag); void uart_xchar_out(struct uart_port *uport, int offset); From patchwork Thu Mar 9 08:09:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 662048 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 11B2CC61DA4 for ; Thu, 9 Mar 2023 08:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230251AbjCIIMC (ORCPT ); Thu, 9 Mar 2023 03:12:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbjCIILM (ORCPT ); Thu, 9 Mar 2023 03:11:12 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED3B0E1914; Thu, 9 Mar 2023 00:10:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678349411; x=1709885411; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UCn20Az7GPv1MH+6Zp/KBKOW/X6nkW75ErD/GRcZlfk=; b=IWy6OjSKLC1Q68vXcaZ55FVYEU85aRgQ9pMlR5wkdbeFtJhl2eHjW+At 7SFmvdW8D0qoln3GMxm9Ay2L4ejqqhKCGworHjvALGK+1xOzAWiPVFTuK XzQ3S8jQYnLWeFhxFXDzkg5qnEBXosBF61gQ1Z7BzMxm79TsrKZDzLLp0 /fido2WLMCbtB3Wdb15gcEEtoWxBKOGX+clOAiojtPqfV11ShuxXMS/OR +Cvv7x7JW4C9ZTWcER7uckxnO9Yu+Cshk13A5j9Lav2q+U6G+gjWjKgME N/6z4NThjZDrN//VJtYo7vCDpn2e69MtsXYV37gnb6aCwMp4QJ/+ng1+Q Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="333853601" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="333853601" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="746228001" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="746228001" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:44 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 5/8] serial: Rename uart_change_speed() to uart_change_line_settings() Date: Thu, 9 Mar 2023 10:09:20 +0200 Message-Id: <20230309080923.11778-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> References: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org uart_change_speed() changes more than just speed so rename it to more generic uart_change_line_settings(). Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/serial_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 7201bbc44fa7..ecdc5d9cdb53 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -177,8 +177,8 @@ static void uart_port_dtr_rts(struct uart_port *uport, bool active) } /* Caller holds port mutex */ -static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, - const struct ktermios *old_termios) +static void uart_change_line_settings(struct tty_struct *tty, struct uart_state *state, + const struct ktermios *old_termios) { struct uart_port *uport = uart_port_check(state); struct ktermios *termios; @@ -277,7 +277,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, /* * Initialise the hardware port settings. */ - uart_change_speed(tty, state, NULL); + uart_change_line_settings(tty, state, NULL); /* * Setup the RTS and DTR signals once the @@ -993,7 +993,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port, current->comm, tty_name(port->tty)); } - uart_change_speed(tty, state, NULL); + uart_change_line_settings(tty, state, NULL); } } else { retval = uart_startup(tty, state, true); @@ -1655,7 +1655,7 @@ static void uart_set_termios(struct tty_struct *tty, goto out; } - uart_change_speed(tty, state, old_termios); + uart_change_line_settings(tty, state, old_termios); /* reload cflag from termios; port driver may have overridden flags */ cflag = tty->termios.c_cflag; @@ -2451,7 +2451,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) ret = ops->startup(uport); if (ret == 0) { if (tty) - uart_change_speed(tty, state, NULL); + uart_change_line_settings(tty, state, NULL); spin_lock_irq(&uport->lock); if (!(uport->rs485.flags & SER_RS485_ENABLED)) ops->set_mctrl(uport, uport->mctrl); From patchwork Thu Mar 9 08:09:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 662047 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 DE354C61DA4 for ; Thu, 9 Mar 2023 08:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229523AbjCIIMZ (ORCPT ); Thu, 9 Mar 2023 03:12:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230296AbjCIILn (ORCPT ); Thu, 9 Mar 2023 03:11:43 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30029DE1E2; Thu, 9 Mar 2023 00:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678349416; x=1709885416; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N198pABiElaUVsS/ZpKV5b88vjIcEWFXshSTja0nvU4=; b=ZOTuLXnOM6fVra1tv4fxyQAXXG+4gVtXtmNxqhpQ+KJbeN/gZGtHStKf 2KgTmrDTY4akrm614cVN77RXRFfc8c3QohBFbIX4k3pO+5YM5Q7KUWyPM t+Lbi0/cLfIJm8ngxnvLhX7Kib7QBbO/7o26C/dQBLlstV7UANUUnGzfw 7BmPgrOpgo6mcqTMlHmklucGZKoiePKiQV5g8t3hleoUmbk70Nb4tUrlX bcWaISb2OqYjtGltm7KC5FKAnpPX8mvCPk5Nuja8iLRoRItGEyrQ1Bqsy FGFUPc717dnO9gw05mkM3X/4dEcheYjr0BQVMTJMbhsJeCnlNw0bboXFP g==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="333853624" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="333853624" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="746228016" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="746228016" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:09:49 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 7/8] serial: Rename hw_stopped to old_hw_stopped & improve logic Date: Thu, 9 Mar 2023 10:09:22 +0200 Message-Id: <20230309080923.11778-8-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> References: <20230309080923.11778-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org hw_stopped in uart_change_line_settings() stores old hw_stopped, thus rename it appropriately. Alter logic to check first if the hw_stopped was changed, and then pick which function to call if it was because the logic is more obvious that way. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/serial_core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 31b69e61e71d..c494cb39394b 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -182,7 +182,7 @@ static void uart_change_line_settings(struct tty_struct *tty, struct uart_state { struct uart_port *uport = uart_port_check(state); struct ktermios *termios; - bool hw_stopped; + bool old_hw_stopped; /* * If we have no tty, termios, or the port does not exist, @@ -209,14 +209,13 @@ static void uart_change_line_settings(struct tty_struct *tty, struct uart_state uport->status |= UPSTAT_DCD_ENABLE; /* reset sw-assisted CTS flow control based on (possibly) new mode */ - hw_stopped = uport->hw_stopped; + old_hw_stopped = uport->hw_stopped; uport->hw_stopped = uart_softcts_mode(uport) && !(uport->ops->get_mctrl(uport) & TIOCM_CTS); - if (uport->hw_stopped) { - if (!hw_stopped) + if (uport->hw_stopped != old_hw_stopped) { + if (!old_hw_stopped) uport->ops->stop_tx(uport); - } else { - if (hw_stopped) + else __uart_start(tty); } spin_unlock_irq(&uport->lock);