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: 66656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp162709wrd; Thu, 9 Mar 2023 00:11:26 -0800 (PST) X-Google-Smtp-Source: AK7set/SdH/PX7WIN3UJcff1mLPUtZdZkfbiw030hvR8HcIiN7dAQh4l3Iip5Xv2Vxrbki6I8cDe X-Received: by 2002:a05:6a20:898f:b0:cc:fced:f700 with SMTP id h15-20020a056a20898f00b000ccfcedf700mr20770844pzg.30.1678349486352; Thu, 09 Mar 2023 00:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678349486; cv=none; d=google.com; s=arc-20160816; b=PulwQ2CJOSd8CnSbzLQfRJuEbMF/H6PR8uA2q7z1Xgtjqs/+lT3bSUx2MQdOEDvWjQ 249z0bR7HQTzZZYyLLQ0PJ+wNvpDHcIpS9ys2LuJ8GFgs/GMJDntu2Z3gAHocm11tGKP t/bD5sREabDnFnN1OjvjM41UfK/ukkPYYyKFC3H9pEM2gRm+Dmf/RRI7K1wye/jT1GMz SjE0cHnllpDYN8KrcWWrGg0B0HU9KEhwJCVUXK05RSEiO8YWrLjS6IyEZstxdOowRdGG aCav2zCnb3UIgBYFiSfqGH7Pm7tZsIJw260lHjX5QhqyR3TIbzIk3l8gOJ99X/o8KJLQ 9nIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tbe6eYF99ERZAHTpeHU0KkaMZxzeAXvVsZ+me2OQ1eY=; b=dE+PyK86LCMrBgRZrF7/a/KhAmsF3RioMSG+ZOTw+IYPH6GOHfCfVLSvq/oVYYhCQv vAzOmMLoLwEya0ASoI/5pfDt6a5/lKGbFcQFxGCtRM5HN7epWZndsItZ/aaqQP1tsi3L IbWvzhXWGQQh0faJUzUTp5x2zG/tJE5lLUySikpGbI7j+bdGQkXgTGIFbL5vJ8g6hE+n 7zck9lGCiaJQhvWE5KDZNKwZq8HSygMb2mUPRitGXmZPzL2IflED0LLobGa9oOnCV0yq 3j/Aq9ONNiZ9R2YixG75oi6unFcuT1ziGl+VLIZ2/jZbdk23+LdTIpg3sdAUyDnC1Fqc 8xgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="S7iMbP/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e18-20020a631e12000000b004d184dbf598si16141684pge.519.2023.03.09.00.11.14; Thu, 09 Mar 2023 00:11:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="S7iMbP/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbjCIIKR (ORCPT + 99 others); Thu, 9 Mar 2023 03:10:17 -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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759876990953207636?= X-GMAIL-MSGID: =?utf-8?q?1759876990953207636?= 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:17 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: 66670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp166823wrd; Thu, 9 Mar 2023 00:23:20 -0800 (PST) X-Google-Smtp-Source: AK7set/Qapf2XnTyAzhdXzce5DpD9w8e1S932QkRqv6FuY2/pGrzSg7JmKktjn0Xr0EiGnFXxfWw X-Received: by 2002:a17:90a:1d5:b0:23a:6dd3:f3d4 with SMTP id 21-20020a17090a01d500b0023a6dd3f3d4mr22196442pjd.12.1678350200089; Thu, 09 Mar 2023 00:23:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350200; cv=none; d=google.com; s=arc-20160816; b=RoUa05KfIqcaJMlVeclfhz5r3tDN6fmlh5aHSvL4QBUbmtAhvSzrEdEQF/4FXzphIl LbwOtvyNbzevT86ACpNc2v1vnuKoCqbtwr1Xvh/E1lcXz4dYjjcTaVq3ymI4D96zCS0z vlqS/URil4qf6GeoUdiIiDGDV5LBwwQwCHiCgiQPUO9hX1OXBiUuMKpLcc1SlslVf9Ki sf2/ZtmOl+XlyYODbytaRL14J6NO3sk6lTWoc6CSKotnB0yzs+xWqSj9x/ajQMMKWA4F WtdRX9hCjz+DrvitpzhzBg0qs8eXEPwYQrrBmOuzgRFXdYznpzHjogfE//9LZlY+spBN ef9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=b0QwrOgR8uET3OCdkA2sFoHPF0sSmlu2IcjBTRDdT8w=; b=IpcfpcpsUuiV1hIqqsizXfjRt+fROQbWOyzzmvs8nFvQaFbAnorH+1eTdmV39dTbTS sh5vkX5MjpiTBHOKHMTUlrUv6flh2SF0tSUW0V7lvl7sKsvcq8Q9wnXwdoSCwZITQ7A9 +D/tnqWUwvzTUAwrbp21KUJNESEnqijlBxuvQ8qUxq8Z/Mgpt3PyVw9Wu1bsp+7IIg1S tM23xcMZrV8Hjt9uNBWUVgGPwuYdctXEBGNOYRjdhQ3goyysqF9PJhiWn0hbz7+UsxEL Dfg+/DS6qjpL4eKEfupNRh05D2FgjvIipHHhlMGW0RfE0doIa4c9DpeN/GUwLKZ2uLRc WIfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nb+nP12d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j31-20020a63231f000000b004df5fe7a161si16052579pgj.660.2023.03.09.00.23.07; Thu, 09 Mar 2023 00:23:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nb+nP12d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229819AbjCIILA (ORCPT + 99 others); Thu, 9 Mar 2023 03:11:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230136AbjCIIKL (ORCPT ); Thu, 9 Mar 2023 03:10:11 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0414794A7B; Thu, 9 Mar 2023 00:09:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678349395; x=1709885395; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H5cdTwyQdDsMQRbq0AF2mKviGSSpKyj5Y/PsWAMzXUo=; b=nb+nP12dYJeE9nTkGYeFIUr8iFI0Zhm8SSfiCC8/SWv1joKSRYD2a1Cn xeTCtQ2/Y3gtR/cQPvcAOpIiLR9JtKwLtjQdc2DG7Qkpj5k4iAGS85Lhu LfVqACfsaXnTOYuoVWrYM1lrtFM+eUZrDWBC5+fzVYW4sE80RDnanfu2C sMc/W9gQ46EguIHGMwn2ivwzJBhXOP7C0T7vfeAKtlOIp76+Oe2yMzFJ0 lHEBQTuUJnUx4A4U1U7PJDoXGh0BWrQ2EVES0WULg3Awela3YBgi5ZBGE Mm7AEU1siVZgaKCq87A77YP8BowMylWITUCZXNNKqBCgHMxFYnTBM1TqC A==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="333853562" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="333853562" 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:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="746227966" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="746227966" 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:36 -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 2/8] serial: Use B0 instead of implicit zero assumption Date: Thu, 9 Mar 2023 10:09:17 +0200 Message-Id: <20230309080923.11778-3-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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759877739333039897?= X-GMAIL-MSGID: =?utf-8?q?1759877739333039897?= Compare against B0 rather than assume B0 equals zero, which is true for all archs but explicit B0 makes the code more obvious. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/serial_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index ee2aabcc8943..296d2c33ea7a 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1662,10 +1662,10 @@ static void uart_set_termios(struct tty_struct *tty, cflag = tty->termios.c_cflag; /* Handle transition to B0 status */ - if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) + if (((old_termios->c_cflag & CBAUD) != B0) && ((cflag & CBAUD) == B0)) uart_clear_mctrl(uport, TIOCM_RTS | TIOCM_DTR); /* Handle transition away from B0 status */ - else if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { + else if (((old_termios->c_cflag & CBAUD) == B0) && ((cflag & CBAUD) != B0)) { unsigned int mask = TIOCM_DTR; if (!(cflag & CRTSCTS) || !tty_throttled(tty)) 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: 66659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp162845wrd; Thu, 9 Mar 2023 00:11:46 -0800 (PST) X-Google-Smtp-Source: AK7set8VoqYyHqG1Gl/II0+0bo9N0dk3vnMGrYAg7FjxeY9l8oIiD+/8qYBPyrau4KtAIsqJ95fa X-Received: by 2002:a05:6a20:b061:b0:c7:320a:60b6 with SMTP id dx33-20020a056a20b06100b000c7320a60b6mr16584234pzb.26.1678349506033; Thu, 09 Mar 2023 00:11:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678349506; cv=none; d=google.com; s=arc-20160816; b=mUICa3sYv/JXSljQ0vfDAYYviHBr9YyXsm4n2nTgTmNGm5YqcdcSQEDL6iCoXDKVbX 4rtsS/yZn59SkRIr7dZGRpFx3VpcLhP7x4s+VCUEPmoIsGK0uNZ69Ro+7WaREJmppjFj ZaOKzJKzeFE6pQr7QwDh+ocIJ7Wq+jD48I5rayqYCyLv55IBDrHnzrHfvBlKiEPjw+y4 ZJh5Vg8Ukpq8uH8d8kz3lPEbttKPrcCbiHy965sNjifNLLKZuj1p3mLjPChGLTt0LSIq DwpjE4aFnnGeRLfm8iMVyJHa47OHQvzArm9KwxFRhShMkMHz6s/hgLAuwXwTMDwmrtJ7 V5Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=edSPJ8ie/1nGLHdVrH0xLImXcZfzl2i6L/EgJmYd/FA=; b=y9PNZ3/HaG9wiVFRdURFVaZxNZmk0YzSUZU7Bugg82nlnOAW/mfqCRNNxSO+orB5He EDAU8YIFE28uaShNwVWzdKRtYfVishIWI3oi5dI/YQDM+6y2NHOgQwO46ZFqzleeDGMB eYlX3/lTcM0wX/gSdeLs0QyNs5lKYoyrU1q0XKT2xrDbj9HZSfUZat+WpC7eOnIu+tSB kHrFHbcJ/iACxTa4ngC3cmyveRIMO2FI4iOQI+TnRMg6tpMLfLpGO7O6Db+J2m9sqzXa y05jFtIpmPAVJ30qwwTTarxUVwYkTfY2aKJa/9uOovgEq6Nb+Mq41eea0JD6pP5wIv1c Elzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RSB1rN1w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c24-20020a63ef58000000b004ce0ead7aabsi15782845pgk.302.2023.03.09.00.11.32; Thu, 09 Mar 2023 00:11:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RSB1rN1w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230243AbjCIILG (ORCPT + 99 others); Thu, 9 Mar 2023 03:11:06 -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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759877011208395215?= X-GMAIL-MSGID: =?utf-8?q?1759877011208395215?= 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:19 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: 66671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp166968wrd; Thu, 9 Mar 2023 00:23:44 -0800 (PST) X-Google-Smtp-Source: AK7set9GJ5DXpQn3gjDwq/gzeQIVhFxTcKBfX/3ZPcDT+sVdpuX5sHXWnUnOaiTtv5stRakCGC3s X-Received: by 2002:a17:902:6bc9:b0:19d:323:e68 with SMTP id m9-20020a1709026bc900b0019d03230e68mr18710367plt.1.1678350224368; Thu, 09 Mar 2023 00:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350224; cv=none; d=google.com; s=arc-20160816; b=leeEOE9iAVUVDZklL4FLemVHeFzw5ZG/K9Yz/6ucgm+lbZHwLgmIVt3nJQQu/tXc2l 5bjYJdW2yobA3mySo0oxsiTlnSuPSzasmYZGuwBMOyowCnt5YgRB3rAPrn0PDspH18Af pCMhEFKtSsdpCk4b4y1/OyEnX0Hlq5wtcJJvFadDTuNyzPkmsuR+Q2gtuwU1Y0nvHqXA TE8TR4CiGCrXmgkYsXsFlTz9MTCLPH2CFTk9zyC7ENGompwO+MxW4ymj6iBVBsbLVVec xcrcL6/W+34VpMLrNRvu22LUs4wM6EbesLFVfGPmZ7ZWldRYRaBtqHtciCLj8L2Y80fh Zznw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a6q32Ojk25SUouNfaSF9VWnRXUwWlSl82xvqLzDz9a8=; b=x2FhBjcy+SsvX80WzlPhWU/5sOeTGDK1bD3o0aBQEoApJDA2eu0RUBXLoYvV95S3tW x2E0pYllydxDNmRzczH6r4thqk4gkGwxe5o4nLegInUoz1llGiQZSjq8BwKEM+lw1v4q 6MpEUKfFVIo22stm09DyUkvM2/D7JvG4d49hG7zCX0jyzftYhybabvtksU7m4H+EXZBC 0DmEQDEpfIiCTBL9HFtRSpnWccakVozI1Mae/2bJ9wZmCbCSceoP/TvFjqrKx0UCO5WY HT1M5/0tpY0qrdUPjJ2H+7bHLYp2oO7KanphGcXDL8nyEYKdA2PlmZOO9z26snV1qodT GyHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jS2+KEVR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020a170902ec8100b0019ca0b949a9si20327862plg.237.2023.03.09.00.23.32; Thu, 09 Mar 2023 00:23:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jS2+KEVR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230314AbjCIILW (ORCPT + 99 others); Thu, 9 Mar 2023 03:11:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbjCIIKa (ORCPT ); Thu, 9 Mar 2023 03:10:30 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB9E1DBB51; Thu, 9 Mar 2023 00:09:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678349398; x=1709885398; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rJCyEkJNEsA+/cTIkJbgh5VawdlmNIWJoyG5MajweuI=; b=jS2+KEVRPPNOvVH1UuZZYGJ8KgPRDfFou3pvph8XEdMXCVVrwjUXOfyR URhwMjLZWttcxuJdMH5/DrnfRvxXbKAXHwb4rdv1E4MWCxNW85WyHPJF1 r6VHdQzyN9nerOtTlP+Y71Us8CeJLtHdl7hGZbK0gIXhY68nUoE0m253S Kz59a0u5uE34uHNhoC2q49Ie2p825WRCbyOjbXPlKS2f1OvuzHx6voJX3 c9dcpsgPeE7bLq+/a0EkBVLpM3dO5d4JoTCc/ry3PZwAtyVd2l8td0W2o g3h0NcL2Y7ZfBgng/HNMenBmsq52H0r5BL2YSmduS8koNVwBJpoNApdkw Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="333853588" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="333853588" 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:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="746227986" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="746227986" 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:42 -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 4/8] serial: Move uart_change_speed() earlier Date: Thu, 9 Mar 2023 10:09:19 +0200 Message-Id: <20230309080923.11778-5-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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759877764830469997?= X-GMAIL-MSGID: =?utf-8?q?1759877764830469997?= Move uart_change_speed() earlier to get rid of its forward declaration. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/serial_core.c | 94 ++++++++++++++++---------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 296d2c33ea7a..7201bbc44fa7 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -49,8 +49,6 @@ static struct lock_class_key port_lock_key; */ #define RS485_MAX_RTS_DELAY 100 /* msecs */ -static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, - const struct ktermios *old_termios); static void uart_wait_until_sent(struct tty_struct *tty, int timeout); static void uart_change_pm(struct uart_state *state, enum uart_pm_state pm_state); @@ -178,6 +176,52 @@ static void uart_port_dtr_rts(struct uart_port *uport, bool active) uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); } +/* Caller holds port mutex */ +static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, + const struct ktermios *old_termios) +{ + struct uart_port *uport = uart_port_check(state); + struct ktermios *termios; + int hw_stopped; + + /* + * If we have no tty, termios, or the port does not exist, + * then we can't set the parameters for this port. + */ + if (!tty || uport->type == PORT_UNKNOWN) + return; + + termios = &tty->termios; + uport->ops->set_termios(uport, termios, old_termios); + + /* + * Set modem status enables based on termios cflag + */ + spin_lock_irq(&uport->lock); + if (termios->c_cflag & CRTSCTS) + uport->status |= UPSTAT_CTS_ENABLE; + else + uport->status &= ~UPSTAT_CTS_ENABLE; + + if (termios->c_cflag & CLOCAL) + uport->status &= ~UPSTAT_DCD_ENABLE; + else + uport->status |= UPSTAT_DCD_ENABLE; + + /* reset sw-assisted CTS flow control based on (possibly) new mode */ + 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) + uport->ops->stop_tx(uport); + } else { + if (hw_stopped) + __uart_start(tty); + } + spin_unlock_irq(&uport->lock); +} + /* * Startup the port. This will be called once per open. All calls * will be serialised by the per-port mutex. @@ -486,52 +530,6 @@ uart_get_divisor(struct uart_port *port, unsigned int baud) } EXPORT_SYMBOL(uart_get_divisor); -/* Caller holds port mutex */ -static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, - const struct ktermios *old_termios) -{ - struct uart_port *uport = uart_port_check(state); - struct ktermios *termios; - int hw_stopped; - - /* - * If we have no tty, termios, or the port does not exist, - * then we can't set the parameters for this port. - */ - if (!tty || uport->type == PORT_UNKNOWN) - return; - - termios = &tty->termios; - uport->ops->set_termios(uport, termios, old_termios); - - /* - * Set modem status enables based on termios cflag - */ - spin_lock_irq(&uport->lock); - if (termios->c_cflag & CRTSCTS) - uport->status |= UPSTAT_CTS_ENABLE; - else - uport->status &= ~UPSTAT_CTS_ENABLE; - - if (termios->c_cflag & CLOCAL) - uport->status &= ~UPSTAT_DCD_ENABLE; - else - uport->status |= UPSTAT_DCD_ENABLE; - - /* reset sw-assisted CTS flow control based on (possibly) new mode */ - 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) - uport->ops->stop_tx(uport); - } else { - if (hw_stopped) - __uart_start(tty); - } - spin_unlock_irq(&uport->lock); -} - static int uart_put_char(struct tty_struct *tty, unsigned char c) { struct uart_state *state = tty->driver_data; 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: 66663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp163134wrd; Thu, 9 Mar 2023 00:12:41 -0800 (PST) X-Google-Smtp-Source: AK7set/z6oHdIjpm8eI+V7IL9o5cUPUUJSHjQfi/UBiY6VYc+Yz49D50+Tux3Lxe6vxDqzmg5vAl X-Received: by 2002:a17:90b:4d12:b0:233:d657:2c7e with SMTP id mw18-20020a17090b4d1200b00233d6572c7emr22362908pjb.8.1678349561644; Thu, 09 Mar 2023 00:12:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678349561; cv=none; d=google.com; s=arc-20160816; b=XHnKppNRx3RFpsFJalfG8cJxG/aTnzXq0DoJPizxno/aOFZl2kFR/+DCnNXlPXzWC/ IOK1dlX4/uTP+eoB7Wzyr/MrESU+eidwxe7rHbTPjXJwxxrzgCR49ztNIk6DJR6ADWuG Rjg/VS5Uiko4bUbtqAg8qIIFUD01l0CNFjaFcDJxHG3svnq5hCz5aLKZFWvBOnrpgzvt WPhvK+l24KrATbSJzx4lRMhDEPxEcWM+UgZ9Fgit0aMuQR+W0ZCnRkwOO/IZePq7jnv1 /BR4+h8Y0gMtQ4YBdsGDtRl3OWxn1r8R0HgsoTopIUxu+a0aBqVICTMP6/he42HQldmd jZvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cvtKH6d76jtgD6Pyl3gjZGP5PshHXubIMobp6X9T9jI=; b=nweC/YuWbsYiE4fFuUNu83ZUU1OZf7kdLs9kT3yf2tFgPWfnFFyRIM+TBa2YPmdDio MM9YrpX7YviWJGWQP4F0RKEbwbGWOfpe7byjuN9/4m6dv9qfloLUxcV+ECX40KyV4P+a RHoxfhPmwp5K7SLDC8ueDn6CnJlErhxhHzpbQSUiNN2nAhTF/P+xJNIJLXEE/RgRRstx sHhUV6HGnSgi+rNRq7hnVvszJHt0FL3pLZPO6A66VtM2UKN0JaJgBW/KjSrfVls40OIY rxD7R7bD3VMgWIhyfjEWDn2SJkcKv/hjAoH6uvYqO1PGUGr9Jtxc27L1Xs7ZBMhFKRkk 08WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IWy6OjSK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 2-20020a630e42000000b004fbe8661fdfsi1583654pgo.309.2023.03.09.00.12.29; Thu, 09 Mar 2023 00:12:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IWy6OjSK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230352AbjCIIME (ORCPT + 99 others); Thu, 9 Mar 2023 03:12:04 -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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759877069754696234?= X-GMAIL-MSGID: =?utf-8?q?1759877069754696234?= 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:21 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: 66669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp166509wrd; Thu, 9 Mar 2023 00:22:09 -0800 (PST) X-Google-Smtp-Source: AK7set+uogFPKVo+l2qNYeRRBaB36H+FqKNoJv/3PMo9nzTLSPTrcWEnkqkyPPs1hcuD/RkFjIqE X-Received: by 2002:a17:90a:db96:b0:233:d854:2701 with SMTP id h22-20020a17090adb9600b00233d8542701mr22539301pjv.41.1678350128882; Thu, 09 Mar 2023 00:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350128; cv=none; d=google.com; s=arc-20160816; b=pHx8yTOERzAE0VDwtxOSdWMszYNSSy1l2osIEmSe0frGzdHOaLeGRzdwX0GQ9MVQAb 0AqxGamRH0VUZH6LAYd2mBoFz4fCOC7YPlCYzmrUOPWYLiHOx7ls0xicrfJRP2ANDBpY tHA2GikG5PtvCPECgKNU3+nCr/KgXBsjvSY5nPbPA5CbtBQmKMp903QYwvcLoM8N0oDP /aRls8epzDxSZPecCySbooooXY6ydtLT1oyq+ux41bKxcDmc3+zIWLvJfPMDmxMaLcYX 3rnSqFZPW2cf31aE+TVG1mfsnYXh7FyF/2CqPTSrXeueA6XMy1iqyOVaG2NLc5+TIIVK tbYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bn1izgbdPmAHh6Apu9PKDvvQCLHN2DalUCIEkdrqrps=; b=FNPLOSsvij3Rs/QZ+v8hpalwdNpLcYDphv6rCDSN/fe3thgAUSPRJJz+58ocnFrDqh yEsXJ9kgxp932hvGqRM7kCbcaCfm6M/FYWLaDR1j3JyyOkw13I81isUK2GgHq/y2Yak9 b7fHZ4IUQuinc0M71fuKwEg4CTpmjFIaxEORlwKB/eO0P/eEaU5VRXqAnULrNW5TU2RL UTqKBdo0AeTRe06lXsFxJ6FF5eQm640zjWFvGQGsr0ylHkIwzDHvw+Ocsp7/s/wCYfLC 4BN0qKr9mrF8kL0+YH5bHFwkNTIz2XlzslDLC2xzur0lPQuv0NXYu+r/HEnNx9lesTOt CSxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PnfIP8wy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na11-20020a17090b4c0b00b0022c216a776fsi1919377pjb.1.2023.03.09.00.21.55; Thu, 09 Mar 2023 00:22:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PnfIP8wy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230330AbjCIIMN (ORCPT + 99 others); Thu, 9 Mar 2023 03:12:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbjCIIL0 (ORCPT ); Thu, 9 Mar 2023 03:11:26 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D370EE062B; Thu, 9 Mar 2023 00:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678349414; x=1709885414; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NOuN9Fv5gO0pmI98uoE3O6yj9f/bKC+iD++4nKAJLCw=; b=PnfIP8wyW194aQblwRo4x1FqtG1poMmxv/R7XpWaBR+lumjCjODi+LZW bMwXH29CeILc3f/4IL/1XOShiVRr9FMER86sL/WoUwxepxK3fu8zX8aqb jv8imG36YFIHyDDjTeQn1Qi3ty0bWDYj9jcY4tRFDpaHTHQWlkDoI5rWj IcIKQj19NQSbt62Xywbs0cVxpCKHyr0NpfgHXMEDGF4dgqajxesNyOUZK +ZK2oBd4gF5ILMfdTO3vTnI2nMqgEcs2rplucv+KEhXq1QTdtDHg5OpEf mBNAkYNBQsxeh3GDUVh0R+4LANBpTloQkIwbtn2QZmT1H0HkfIaaUpVKo w==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="333853610" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="333853610" 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:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="746228010" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="746228010" 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:47 -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 6/8] serial: Make hw_stopped bool Date: Thu, 9 Mar 2023 10:09:21 +0200 Message-Id: <20230309080923.11778-7-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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759877664803899549?= X-GMAIL-MSGID: =?utf-8?q?1759877664803899549?= Convert hw_stopped in uart_port to bool because its more appropriate type for how it is used. Also convert the local variable in uart_change_line_settings() caching old hw_stopped to bool. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/serial_core.c | 6 +++--- include/linux/serial_core.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index ecdc5d9cdb53..31b69e61e71d 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; - int hw_stopped; + bool hw_stopped; /* * If we have no tty, termios, or the port does not exist, @@ -3304,13 +3304,13 @@ void uart_handle_cts_change(struct uart_port *uport, bool active) if (uart_softcts_mode(uport)) { if (uport->hw_stopped) { if (active) { - uport->hw_stopped = 0; + uport->hw_stopped = false; uport->ops->start_tx(uport); uart_write_wakeup(uport); } } else { if (!active) { - uport->hw_stopped = 1; + uport->hw_stopped = true; uport->ops->stop_tx(uport); } } diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 05d18a145b3a..66ecec15a1bf 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -553,7 +553,7 @@ struct uart_port { #define UPSTAT_AUTOXOFF ((__force upstat_t) (1 << 4)) #define UPSTAT_SYNC_FIFO ((__force upstat_t) (1 << 5)) - int hw_stopped; /* sw-assisted CTS flow state */ + bool hw_stopped; /* sw-assisted CTS flow state */ unsigned int mctrl; /* current modem ctrl settings */ unsigned int frame_time; /* frame timing in ns */ unsigned int type; /* port type */ 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: 66672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp167086wrd; Thu, 9 Mar 2023 00:24:10 -0800 (PST) X-Google-Smtp-Source: AK7set+cv2M52/O6I0+6538bX/RfYu6F3etnfC//NsSb920Hqx2+cdr+3TrCCJHYjaOUJhxQGLo9 X-Received: by 2002:a17:90b:1a87:b0:236:70e6:ef08 with SMTP id ng7-20020a17090b1a8700b0023670e6ef08mr21548996pjb.49.1678350250210; Thu, 09 Mar 2023 00:24:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350250; cv=none; d=google.com; s=arc-20160816; b=ke2PF3T+/Mku4UolNCsflFfWxhHBLXVUNXuKUZOa1YgWjV0mY5tNVepQsA5uy8bvw+ LDKR3vbYKZdgZV1rK3tVIZZ3VHn+BioJ7VxgFdZbW05GCkHmn8ouQlJxFOnQ1cJrdSXC c+cBQWDH1IwRaHa/paMG/vUoktAqIN043NQcvsdyY9cODbV6/3o6tNbrMgCTOr6QXM1h y5GwNuHV+mSKLm/qZDzwEZ9F8/brGoE6B6ZUnHtD9Q+20zml+ilJssqfRwN/eTfE4gU4 TOYBr/WxBCrbzkFQlZ7bb8WqUHzxUiKyCt1nF1gau8Wl9cub/nyE2jO7Et0O94Gpb4rK qFdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C4Lug6O3tyfy61jU04wm1DW5T2idDJPLAGjUgcBmIpw=; b=A0oesJ5j1ndtsPkJFxJTlQZ1n8cfHHkk5O7DkJV4XZTiDDgj8A/yAzZjJ9KNq1k2OH L0kAk6aWIg0GF/GlJkl8SzSwfhbLH4Kad1aXE/jz18oyq+XcQwfPC4Bbil92NW0ArcTR l2dBoED2PlaEYK5hwkGkF+FKxhNrdEwxyX8lEq5/GO9UmY3XV8vymA+IiJV8cicVD7DF gSG6yLjPUcuhHf6TAK6tzVkaZaqhLGprj39yJft/hO7zkW4YOwVRDbElGml1YrlH3/8T wzG4H/9jCWe1jhUNFLVv03d6TAQCgPhZ3hE6Py/tJrq1zciIObMNB2PBHldNcaID+F49 x2Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZOTuLXnO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na11-20020a17090b4c0b00b0022c216a776fsi1919377pjb.1.2023.03.09.00.23.58; Thu, 09 Mar 2023 00:24:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZOTuLXnO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230345AbjCIIM0 (ORCPT + 99 others); Thu, 9 Mar 2023 03:12:26 -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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759877792256634403?= X-GMAIL-MSGID: =?utf-8?q?1759877792256634403?= 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); From patchwork Thu Mar 9 08:09:23 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: 66668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp165613wrd; Thu, 9 Mar 2023 00:19:26 -0800 (PST) X-Google-Smtp-Source: AK7set+oexUxIW+FDwwjr8hIgG/8aLbsTgLvKp7sRec4+gr9spfBqtw/AZYlB/HG3Mhmp1/r0t1S X-Received: by 2002:a05:6a20:12d1:b0:cd:fc47:ddbf with SMTP id v17-20020a056a2012d100b000cdfc47ddbfmr23188681pzg.47.1678349965743; Thu, 09 Mar 2023 00:19:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678349965; cv=none; d=google.com; s=arc-20160816; b=zfiPM9IUNKW+DAsTel8yUm1MMwp5f0iKFEErGc8W8BH8sxa3+mJ2BKGMGCc+Xkmrfb fy0VlBSuV4TksrnpyG/2nmuJRXFtZzMj+qVUB0mYPsye+5n/6N6eOMSXbq3uAJG6mMuM bE9D1BDJf+v6K0Jl020jd125GdgwE/zvK5947RDwhezda2yGDZ52oCYR74jQsbqGIfNe 3pFpGx0b0+N3UjQ0HG/Sr7jssUKuohneDF5t5JNiBNXDgkbO8Mq0jusecvWnn2P6qsFc /7L2HdL1AWnrLyWUcshWbgD9WwLIXovc0+68Hjv+1+YLsoe49a/f6dFXpSzwwuaWZCQl 7osw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PKvBcqVgH1cPxymekIr4L9wpWGyP6DbDjlAC/g7NV1U=; b=k8cUXLB7RshBrIRnw761SDi5WcGpI5pWodgsJnQfQ1xpHwdwJKOTeLmSYW3DtlIyAb TKyit8LAhn1zOwioQv2Wobmtz0Ce2YnIi/NCHpavcIryXIaE7mAflixvgjIHdDlRJ7Pf Q+OilzDOaup3MtAPrvIX6NQcX50dmixpfDtB8APyA8jXBpH9U9CHqM9plEbKesG+sVZp OfJSqgDyxUNEnmGqCMa15s3u1WplGJpsYq7skinP580Puqf/6CU77IQQLMWuQmNQrsGD d/i1nCQm9HoMVhBwvWNbpbfqXolhbmmmkIWBWSJdroGDGEwfO2IJsbJfCzIbogSC62Rs 00yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=k4vnbS34; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f1-20020aa79d81000000b005ad9f478850si16616813pfq.316.2023.03.09.00.19.13; Thu, 09 Mar 2023 00:19:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=k4vnbS34; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230398AbjCIIM7 (ORCPT + 99 others); Thu, 9 Mar 2023 03:12:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbjCIIMD (ORCPT ); Thu, 9 Mar 2023 03:12:03 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C1D1E2C41; Thu, 9 Mar 2023 00:10:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678349433; x=1709885433; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3/j3SVPlwDa6zr9LT83ubh5mFhbeuQYyePjcNkzEfHw=; b=k4vnbS34jIEGP1sGB/OdlTrtI6oT+SnydqgwiGnxIpX1UdHZUsoDBDNi dvrBk8PflChcSPSCoxEGC0088TO5cLQaUuOOOzp38V54wvpYgm6vtD36I g5w4VyAVJ9VrjTX1wLVCGYuegHLA2pcjJnVrO66r5DNt2UxlEQDTd/gaj IyFjtO8LgB++W1iGG9xtkaYWMXVEGLrHpEC9o1AL9f6Bnnj06KbySg0Px J14EudmakgFPH4zZ2PopQlr/oDSOG+b6PdIglgoTw1xjBS9ZPR/hursmf MJxvG9lc3K4FsLuznSNSlXTHhDtCc2gNnyhGduOvJVL1XQTDtWQbszBna A==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="333853636" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="333853636" 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:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="746228025" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="746228025" 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:52 -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 8/8] serial: Remove uart_wait_until_sent() forward declaration Date: Thu, 9 Mar 2023 10:09:23 +0200 Message-Id: <20230309080923.11778-9-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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759877493228545163?= X-GMAIL-MSGID: =?utf-8?q?1759877493228545163?= Remove unnecessary forward declaration of uart_wait_until_sent(). Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/serial_core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index c494cb39394b..db7f6c0c39bf 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -49,7 +49,6 @@ static struct lock_class_key port_lock_key; */ #define RS485_MAX_RTS_DELAY 100 /* msecs */ -static void uart_wait_until_sent(struct tty_struct *tty, int timeout); static void uart_change_pm(struct uart_state *state, enum uart_pm_state pm_state);