From patchwork Thu Mar 9 08:20:28 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: 66677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp167745wrd; Thu, 9 Mar 2023 00:26:16 -0800 (PST) X-Google-Smtp-Source: AK7set8vXzSfreiADC8iyMV0ayLetZmykmgcTUxob4XdZtA6ZdH8uTtey+wyab+I/b3C4saSHeTl X-Received: by 2002:a17:902:d4c9:b0:19d:323:e70 with SMTP id o9-20020a170902d4c900b0019d03230e70mr26150929plg.33.1678350376314; Thu, 09 Mar 2023 00:26:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350376; cv=none; d=google.com; s=arc-20160816; b=lG3Xsb/2Gz3GBXaghV7M/H6Q3CTqC9xPbpBktvS3+T1pUadN1vqVBfCmURpsuqNRf3 fAyc1jAb7tEbZg6UPfWUlRKAGsWfumdmot09APjHrvkUJQwZwGvkS0aGe42B1cYVsSFk TK8nq8FF34r/QMTTkUVjHYGbxh2BubENpHCEdNW4etf19hLCzFyJ8cgAVILUgdXbBIWu KIqo9S2mLfwdTUznycLdsCGX1fn/YGKqfWiHGbhGTLoGkoAtaVYj7ToUxVokTbKO462m jlQizwXhJ37tnZFY+6rizV979eY8uAWpVQE2/nmj99BRS/Bdy+K9uA30Vyk9JoPWPiI5 0O1w== 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=u/oD/Keayoxr7WmnJhYU/A+D/iunCEwHeY4A6PQ7xC4=; b=gkKDElx9AhDMzlWhwN6XlPRlriRraqkQwgURDrGDtHhGuzlfjHh0z8jhcRgXHbLPpT RHt3d3du32NlTy2B9mW1PVPKid795Z6yBT0ldOPtcYVIdf5OO8+aDIpn+iBWsGBRMX/y JMwtVo8LoMLR3UklylnOScjyneN4rbSphFdYy5K4aknFMHG5HJYDlNY/CEbcIKWSs9zL TKh3LG+W6ZGdU6ReqaJLTpsdZbs4Qi5uYDGBlnG5IRfnUl+WWQfqyTxTNEKB4oioYtvC HwAo7sFr1hC+6gnj+1Gx9Q1wjq1yL7SXOhfB0QX1bbmRhVlmGSawpqeTe4cwDKUn1V+R Ec4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q+2matrx; 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 x5-20020a1709028ec500b0019e30e3066bsi16950075plo.286.2023.03.09.00.26.03; Thu, 09 Mar 2023 00:26:16 -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=Q+2matrx; 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 S229922AbjCIIXC (ORCPT + 99 others); Thu, 9 Mar 2023 03:23:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbjCIIWm (ORCPT ); Thu, 9 Mar 2023 03:22:42 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DD4FE0617; Thu, 9 Mar 2023 00:20: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=1678350057; x=1709886057; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iSFAeXMyb15nLeLM23ofC0opCVrv3Repl2TyKJV+3ME=; b=Q+2matrx/83DeMYzNB5f34pI/60OgDfKQz0h299Pr14d7016bVpxLyM+ +faufy1rxg3ypb0vKK5XveuQBYQtKW6ei1wNa6iUNot2zWqsY2nFX0mKP U6//IjytTCLH6b9x9iuJ+CoTjNMrlQ2qFOvn4PqYHjd//v9aA6VuDNGrz DZl9q0Ne6EDz0L0p+yRuZCDtHxfBZWEiMjC8c7zNB+YV4WpZYLgxmnGic bjDJoagWDqH77zaG7F5FjaIU9bnOveQrV7AglBP/j7xk56L8XOjlYagaE EKRgK+FvJY52zPVx/uXPU2GPT7CZvLGsCRZjFfAQPSefKH0agBAIU+hWX g==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="364025743" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="364025743" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:20:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787473852" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="787473852" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:20:55 -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] n_tty: Convert no_space_left to space_left boolean Date: Thu, 9 Mar 2023 10:20:28 +0200 Message-Id: <20230309082035.14880-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> References: <20230309082035.14880-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1759877924203024297?= X-GMAIL-MSGID: =?utf-8?q?1759877924203024297?= The no_space_left variable is only assigned with 0 and 1. Change its type to boolean and move negation from its name into the check. Signed-off-by: Ilpo Järvinen --- drivers/tty/n_tty.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index c8f56c9b1a1c..4fc5bd166e56 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -625,7 +625,7 @@ static size_t __process_echoes(struct tty_struct *tty) c = echo_buf(ldata, tail); if (c == ECHO_OP_START) { unsigned char op; - int no_space_left = 0; + bool space_left = true; /* * Since add_echo_byte() is called without holding @@ -664,7 +664,7 @@ static size_t __process_echoes(struct tty_struct *tty) num_bs = 8 - (num_chars & 7); if (num_bs > space) { - no_space_left = 1; + space_left = false; break; } space -= num_bs; @@ -690,7 +690,7 @@ static size_t __process_echoes(struct tty_struct *tty) case ECHO_OP_START: /* This is an escaped echo op start code */ if (!space) { - no_space_left = 1; + space_left = false; break; } tty_put_char(tty, ECHO_OP_START); @@ -710,7 +710,7 @@ static size_t __process_echoes(struct tty_struct *tty) * */ if (space < 2) { - no_space_left = 1; + space_left = false; break; } tty_put_char(tty, '^'); @@ -720,7 +720,7 @@ static size_t __process_echoes(struct tty_struct *tty) tail += 2; } - if (no_space_left) + if (!space_left) break; } else { if (O_OPOST(tty)) { From patchwork Thu Mar 9 08:20:29 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: 66685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp169986wrd; Thu, 9 Mar 2023 00:32:45 -0800 (PST) X-Google-Smtp-Source: AK7set+PvcZKbUMUL3QQ/CqTUNHQKC7ik3R07eDcJmYkQZKadvN/S80G3vK0bMuak9NVT3+pIiFn X-Received: by 2002:a17:902:e5d0:b0:19d:6f7:70d2 with SMTP id u16-20020a170902e5d000b0019d06f770d2mr1929354plf.50.1678350765690; Thu, 09 Mar 2023 00:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350765; cv=none; d=google.com; s=arc-20160816; b=LV3CCp/KrRixTrGOmKzY0LWlfAaVAM1mTSyhPgjrf8xJ3/jl+w3plveb8mpR/24zDO Ff7AYXTodluBM9cEP5saqpKR45zvea8dLgEA5TL9PAXwL95r0tCJFQtNpwnPtcaqo8X+ 3CPg5gwG+CLz47aHLCk31PZ7v+Rt+hXpsuTDJoAxHmevjSSiDRi/IA+7Nl2H3ZJMAr0b 0FNhm1BEo+WyguYPMUtQMm009CDBAcvXCR4tAFAFpv2U9t9sf0x4qs54vVxVGzfA32y1 vtDbDzm7jE8hrB0pWT7QnfxxS1E2auPWQ9F5qCdYIu3iMKT3wShyJyHsQLUY2+HSlORB Zk9g== 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=uNQFAD4rFF9fmKGfwBbs6rrQKAFQAoH4/IopOyRudCU=; b=m3H4alPsSWFvit4DHgfNlV873S/xNCLoGDwfqICmyYNOpNc5FAxeRTdwWwuwDCaO7l k+pcItOl2KIx4oZr8w73AR3ushhtICIUpc5wEEB+nMZ0eIPg7/070IS0yue0Dk5PHeyO fo20W9tufrOCBCh9XGmyOC299Rh2YOqJN6TZNWK2hsGAwnWrOgnNFZXbpEJmYwAQhPXW j1vpRgUueH35QZ+y2WPsIMkX3I1ETbfJ3zS+J5jMXENOx2OmlMRUyTt0tzqM+NKB9VEe 3rA58bcrArvUdbrHJxlWUcaxmnYOe/UcBqTap5J1LaQzitHYc4A3oQrSThLa9fKYDv3Z MwXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZTn75XKT; 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 ka13-20020a170903334d00b001994712728csi16159699plb.607.2023.03.09.00.32.33; Thu, 09 Mar 2023 00:32:45 -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=ZTn75XKT; 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 S230250AbjCIIXI (ORCPT + 99 others); Thu, 9 Mar 2023 03:23:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230128AbjCIIWo (ORCPT ); Thu, 9 Mar 2023 03:22:44 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09E2FE063B; Thu, 9 Mar 2023 00:21:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678350078; x=1709886078; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=k3m76VGZBewKkEU33NbY6qcZRyAz+1m3GJXuwbf9sfA=; b=ZTn75XKTAgUWFkL0SfY1mnyhLBIXK7rutOzTjGWEO0iAzWMGAACWfFbp 0xBaq3rEI3aAGCQPtPdgUFg6PDJSBfW2/v3yM0vvpor5oGQZuIdqqRlF8 PhG8vjMP/QteBp4HJwdtE08C43QihS7FNWwhtDn9Xboy93UNCeHXP4E+M Xis5mr/X0ODdMgQpkqFhRDqb7JLINwn/bKQsAHRzT4CK8+Ohd5WrcRJ5R 9twLrUrFWLPn6Y+QqAQCDcDM544iZytE5sPAyM/BLrhi341zQwNM5GPRx 1kugKG23Aq2yslsdHXlcsSgT00ksNoP/LHSs6KeM9tehNhoSbq1Tx36bu g==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="364025818" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="364025818" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787473860" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="787473860" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:20:58 -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] tty_ioctl: Use BIT() for internal flags Date: Thu, 9 Mar 2023 10:20:29 +0200 Message-Id: <20230309082035.14880-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> References: <20230309082035.14880-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1759878332753894202?= X-GMAIL-MSGID: =?utf-8?q?1759878332753894202?= Convert internal flags to use BIT(). Signed-off-by: Ilpo Järvinen --- drivers/tty/tty_ioctl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index 12983ce4e43e..32ff9959b565 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -7,6 +7,7 @@ * discipline handling modules (like SLIP). */ +#include #include #include #include @@ -40,10 +41,10 @@ /* * Internal flag options for termios setting behavior */ -#define TERMIOS_FLUSH 1 -#define TERMIOS_WAIT 2 -#define TERMIOS_TERMIO 4 -#define TERMIOS_OLD 8 +#define TERMIOS_FLUSH BIT(0) +#define TERMIOS_WAIT BIT(1) +#define TERMIOS_TERMIO BIT(2) +#define TERMIOS_OLD BIT(3) /** From patchwork Thu Mar 9 08:20:30 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: 66675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp167489wrd; Thu, 9 Mar 2023 00:25:29 -0800 (PST) X-Google-Smtp-Source: AK7set+A2l8FPy4saRwsp3GDAv3r/IaflDq3m7SUdhvZQLSSdzTnSMQWh4dxFpRF2lCESwmqgDTj X-Received: by 2002:a05:6a20:734c:b0:cc:a8d7:ad7e with SMTP id v12-20020a056a20734c00b000cca8d7ad7emr23217052pzc.60.1678350328768; Thu, 09 Mar 2023 00:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350328; cv=none; d=google.com; s=arc-20160816; b=rbT2VYa7oY7OjpUYaWpXomSYil2BA5KrYQx+SCKSHp7UewEwRqpXyRPc4Tq6jlLTJp AAJCvRTnWrnUqUf5Mw2rpm3cY/Yh911IdrZLjsa4OCS1/VtscCLwclyoON6lch9aSvIl gYsn594t7A5eAeARCgNy8kKf40NJnsIgza7/rNlTs95r5N9Dy2QfexQRzdj+pv8JomtJ uPYlS+leNC7KaWt17XZBPt7OPtZbebJ0Bt/c3x4sq9tjHXircfYLGDQcxEuN3unFn1TV TOYxFcr4ohPVHga5q8gXFryl1Ua06/4Z+1bZ2R3ptahOOM4ZaVEWnSRrGCTW9dZMAhNo tc/Q== 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=s0dmyChKzMWhuekfPExMgyW+Y+YFoZ4wO8+tUGdjjIY=; b=oQgqpz247s1OJJIpJuLbpA3RKQBdkMQ+l02qWS8ug3qBEX+op/t02rt9YOkqBWq7dW cyTWhTLTmWZaNWpARHlEyD71Auefb1SJ7VQRLMSDYKnkpNzxX9CFhdjhJYCWIN0sO12M k8+ZBKCKAZ+Ce8sF4VAKoB8zGwi892M5Sa8rywc2V7Yuj3mAhm5c+ghq2qPqFfEKLzFs kI3u1yWThXa7ZrzW7jnJl2ioTeHOPbIQshM32oUYQzrQU402iYSITOOZtpHkfOjLX8I7 HxwpAapnpMAX3jSpc6dSzHz+JvhdCIu/cpRAQyFPdNadZ/uf4ZvzI13kBxpWDFwdIuT6 r1vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YxAzWDqa; 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 n127-20020a632785000000b004fbfc2b4369si18260654pgn.441.2023.03.09.00.25.16; Thu, 09 Mar 2023 00:25:28 -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=YxAzWDqa; 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 S230242AbjCIIXN (ORCPT + 99 others); Thu, 9 Mar 2023 03:23:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbjCIIWo (ORCPT ); Thu, 9 Mar 2023 03:22:44 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38C7CC666; Thu, 9 Mar 2023 00:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678350079; x=1709886079; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NVk2Uwml/dLcUozFXuj/Wgf+vlU8vTU7nn1wZsqKalg=; b=YxAzWDqat2FJf+b5kIueKO0FBplLrOtYCkTudjvCHuZtihtcNn9sY5yb fh2hamzNRkG09Ta1CcrVFUEA+Htsh680pv4Mcrrn90xaqAXsiF+jA5Eo2 0qrhKBU3lRaRrI2Fkznq00XScR61dA237AH/vgnNxpyarjW6ekPyHKAkl dXXpDp+rF+blMscLwIAFo2mIEnstZ3kPWiX4c1ibOD6xHqzL9QltCHhWZ +AmD9zgU5HHfFD0zAz+e3Yt1stq1Gsl1yYsla1F1M2LrnAZaHYwQdOMOu bsVuvEkAvr2qRe4piCOvJGfxdwMl/FfYRbe6IsOZ0C6jE4xH4IuKHfQ/M A==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="364025823" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="364025823" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787473870" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="787473870" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:01 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 3/8] Bluetooth: hci_ldisc: Fix tty_set_termios() return value assumptions Date: Thu, 9 Mar 2023 10:20:30 +0200 Message-Id: <20230309082035.14880-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> References: <20230309082035.14880-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1759877874305217891?= X-GMAIL-MSGID: =?utf-8?q?1759877874305217891?= tty_set_termios() never returns anything else than 0. Make the debug prints to look directly into the new termios instead to check CRTSCTS state. Signed-off-by: Ilpo Järvinen --- drivers/bluetooth/hci_ldisc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 865112e96ff9..efdda2c3fce8 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -323,9 +323,9 @@ void hci_uart_set_flow_control(struct hci_uart *hu, bool enable) /* Disable hardware flow control */ ktermios = tty->termios; ktermios.c_cflag &= ~CRTSCTS; - status = tty_set_termios(tty, &ktermios); + tty_set_termios(tty, &ktermios); BT_DBG("Disabling hardware flow control: %s", - status ? "failed" : "success"); + (tty->termios.c_cflag & CRTSCTS) ? "failed" : "success"); /* Clear RTS to prevent the device from sending */ /* Most UARTs need OUT2 to enable interrupts */ @@ -357,9 +357,9 @@ void hci_uart_set_flow_control(struct hci_uart *hu, bool enable) /* Re-enable hardware flow control */ ktermios = tty->termios; ktermios.c_cflag |= CRTSCTS; - status = tty_set_termios(tty, &ktermios); + tty_set_termios(tty, &ktermios); BT_DBG("Enabling hardware flow control: %s", - status ? "failed" : "success"); + !(tty->termios.c_cflag & CRTSCTS) ? "failed" : "success"); } } From patchwork Thu Mar 9 08:20:31 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: 66686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp170106wrd; Thu, 9 Mar 2023 00:33:06 -0800 (PST) X-Google-Smtp-Source: AK7set+I5teXnZjiwrMDhhZ+/xbiLZtM/6EanTHqJrwAJ6ObL6b2wWcTneLW81oXpurwN+3chX/0 X-Received: by 2002:a17:902:e842:b0:19e:4173:38b3 with SMTP id t2-20020a170902e84200b0019e417338b3mr28017908plg.46.1678350786217; Thu, 09 Mar 2023 00:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350786; cv=none; d=google.com; s=arc-20160816; b=n0NvvlzNVj9GqxUUgPcbE56VnR3/7MMahMRfAHY929teALuWsgMPAqC0ilnn6bYBeN PBsUbEbc7X6N16k0pr8JoScFRpiGLyFe2zCRxwPkZoGU3Oi2JFwXoCWShiJHcrWRIYDe 9PGUElN6lHk1gk9YbCnDg4uifQmRgFTzloAg6G6z9drRlGIWPDCqD3NROcS3+RQDDPPN q3ZpANGDyBpyLi6yjKrDk9Vc1OG+L9qUAeh6fPCxknSoJVIEDb7bUUxDdd/MAQTXVTcE tnM7Ea5mryFPlEPmUtnOu6JFUEY58TMdZiPexJKQQmWCEhNuMFKBNI7s9uHNJlZMJ/lh s3Xg== 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=FqtO4f44ob9fZ4bbmsuBjTPIkPEwSVq7yM9pV3riMXk=; b=FrwAisGi+JezqJsG+ot3uQnxfmZyi8k0d/PseXyOmrCNHw3edcTEL2M2pVpcfIo9HQ shxq5V+AgASg+/LwYAGPE0vxoy3F1gOGLJwsmbXL6nNyzOz8GLskWukg8Vv8JGYrKBKA jSPjMQIJ39W6Wey5IL2I/KyRG3xSgpmNDGN57/WqetVy79cnynZ1t2QTeJ+fpqRfXsNg LGD9QB/MMqTd8jOgVjgNFbz4j3CFxxxgT3dcEC6HRBJx1VHo9NsK2te13nflDmbQYRQM /k9J8qtMI3AD5lllqs483WSQ0u8LL/fhkeFc4je7XwBB5TZJGlJMhkApP76o0kWyNA8V xCOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q+hU8pZq; 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 c3-20020a170902d48300b0019cc584d67esi19128163plg.121.2023.03.09.00.32.54; Thu, 09 Mar 2023 00:33:06 -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=Q+hU8pZq; 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 S229702AbjCIIX3 (ORCPT + 99 others); Thu, 9 Mar 2023 03:23:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230057AbjCIIWr (ORCPT ); Thu, 9 Mar 2023 03:22:47 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5450B12F13; Thu, 9 Mar 2023 00:21:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678350100; x=1709886100; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EeMpUHRwEcd/7GGcTgh3dH4kpXVjRSLeOKvHUS2QYVc=; b=Q+hU8pZq6BEEfcCDll90tafMfjbim0leyJDXAJheIBugLJASrGcismsP nlW6dGFhtUvJBM0A2Ud1L9kjne+2eAoYvFiKECMguYwchoZZiMc0zZEJ6 xAySZfWQrCQFM6CtBJbKfn2fUAiGOOkQBuBX3fwKJHd0UGvIwOA0eRdu4 L6SbdRM6WrVhSWeFIyZS1Skr62ou+BPiPRd828A6kF/rCJJSTB4vbizvM PN2R+fL3F4ToLwlFI+9i2OqL3m8YtXs8vlcbTbaWSyGw/7eUANl9U65qy wvyd7M0VToas3CDmjSS30QUZHDYrRT3HpEu6q1pVKhlpFnegMA6d0REv9 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="364025884" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="364025884" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787473880" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="787473880" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:05 -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] n_tty: Sort includes alphabetically Date: Thu, 9 Mar 2023 10:20:31 +0200 Message-Id: <20230309082035.14880-5-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> References: <20230309082035.14880-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1759878354146576063?= X-GMAIL-MSGID: =?utf-8?q?1759878354146576063?= Sort includes in n_tty alphabetically to make it easier to see if an include is among the list or not. Signed-off-by: Ilpo Järvinen --- drivers/tty/n_tty.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 4fc5bd166e56..2cf263de1366 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -28,27 +28,28 @@ * EAGAIN */ -#include -#include +#include +#include +#include #include -#include #include -#include +#include #include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include #include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include + #include "tty.h" /* From patchwork Thu Mar 9 08:20:32 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: 66683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp169847wrd; Thu, 9 Mar 2023 00:32:22 -0800 (PST) X-Google-Smtp-Source: AK7set8DOdC4KQw66uLPK6ctvCIrwYLQCWN23OkV01x4/2KXGfBVBRrIRVJ1JLhfr+kxxt+W7Pcd X-Received: by 2002:a05:6a20:7f8c:b0:d0:4361:9723 with SMTP id d12-20020a056a207f8c00b000d043619723mr11317315pzj.22.1678350741902; Thu, 09 Mar 2023 00:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350741; cv=none; d=google.com; s=arc-20160816; b=EDmOCpivPc2opXvWihPR94yfgIHCnxy1knYT5oJlK55dMz3yNMzHTk9xwTHcD2Zdtj Z98PoggcgRka2+fgn9RxhoICBYytxI9ESRxbGKw3mMEtXWXwqDxfy05QUxQUjkeCpRYL LQU8IWeKyrmYhPxWbUod1wX1XrPADNRW22cbWjHvi8r6sLDGrHQyLgZZq8827ncJZoq5 pIGrCKvghymhw/pxgZnW/atut2Khb6jwQOKuPdIcHj5PZqRLsnynf8z1jHHIgjrJlRLw 2pUEI+GTSVm7h5N63obmN5+7Ahf/kYzyftFYSAkwfkqSPJ/4nCeD02+J/gI/GU98d4tD vzRA== 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=4UPlcozxXNpjh0BjvydOQyRXQgAk8glfaJ6Xw/1Rxfg=; b=GBZL3aUETa8HIRLTlJxZgAYIBLG6Rn/swY/Nthq4sRW4GEzeQ/bUn3tF1AEdm/ccoG xPwP3TVjnGn01J5vSbbpHwIdisJOjIO8OQQSGi/Xci85UFHQTdrLxNortW2jcX5QWRNY RzxIcBfmp3l73m9g8KByr2kj7hW4KHwLaR8+SH89PdVq7teL5dans1Wqaj4n2dK0As8w qpGb6tzzuY2Xl7ULDbiQi7x5xWBWxomWanlKJVXUJUE46bmmwsWzF1ED4yqQAGmdNGO8 4fR46hQx4fSiURUvvHE5APhTI+BoMs8YY9MBuJ6/Aspc08qUvNlg94/F3C/QjtFSvArt L8bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FDvlVHOV; 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 r4-20020a632b04000000b0050726756ee5si13712432pgr.98.2023.03.09.00.32.09; Thu, 09 Mar 2023 00:32:21 -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=FDvlVHOV; 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 S230293AbjCIIXk (ORCPT + 99 others); Thu, 9 Mar 2023 03:23:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbjCIIWt (ORCPT ); Thu, 9 Mar 2023 03:22:49 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE1BB61B1; Thu, 9 Mar 2023 00:21:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678350116; x=1709886116; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1gjDjb6XOju7BxrPkMiH9NjVH6xJrxEdgnWQjbfCD6k=; b=FDvlVHOVmQJZoiuG5w1pDjIvU06vFYMzPabMqLrf3BSYub87zBfFvdBA M4xG2CyxIiUeMvyRksF1gD6sJ6sqfob5wRS5FoEJLeyVdUujkt9n0vqyX RuMMv/0fYLUF+EyM7sn5IqRHOvpfGmZ1ICZrMCW9j0I+1xr/Yu+o6welj v0ePHbaeu9Fyt55RpDXW2LURtqac0WcvRh/Z7CErBb2hE0+7so5l8OOlJ W7qF8rUVe8LY6v3ZpFrBkdQZeG0lyi8EXWJQjJPwvFq1bwaT+/3HzfFrh /asDIoo6ryJF1ZPJavLkayhoBSqNvOZgV2aK4J3NhPF3lMawNhp2QSV3a Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="364025940" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="364025940" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787473884" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="787473884" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:07 -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] n_tty: Use DIV_ROUND_UP() in room calculation Date: Thu, 9 Mar 2023 10:20:32 +0200 Message-Id: <20230309082035.14880-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> References: <20230309082035.14880-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1759878307282148146?= X-GMAIL-MSGID: =?utf-8?q?1759878307282148146?= When PARMRK is set, a character can result in up to 3 chars in the read buffer. Receive code calculates for how many characters there (at least) is room. Convert an opencoded rounding in the calculation to use DIV_ROUND_UP(). Note: the room variable is decremented afterwards by one which ensures the characters will fit into the buffer for real so the code is okay despite rounding upwards. Signed-off-by: Ilpo Järvinen --- drivers/tty/n_tty.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 2cf263de1366..6d754fc35dce 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -1692,7 +1693,7 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, room = N_TTY_BUF_SIZE - (ldata->read_head - tail); if (I_PARMRK(tty)) - room = (room + 2) / 3; + room = DIV_ROUND_UP(room, 3); room--; if (room <= 0) { overflow = ldata->icanon && ldata->canon_head == tail; From patchwork Thu Mar 9 08:20:33 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: 66690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp170724wrd; Thu, 9 Mar 2023 00:34:47 -0800 (PST) X-Google-Smtp-Source: AK7set9ea3pG6SkWR2hAnlCVBiJcbmuC7bisbraVAMRpn6hZ/POudGUrVuU61a2qzcIn/NE8i31B X-Received: by 2002:a05:6a20:d003:b0:cd:6c14:9854 with SMTP id hu3-20020a056a20d00300b000cd6c149854mr16624902pzb.26.1678350887657; Thu, 09 Mar 2023 00:34:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350887; cv=none; d=google.com; s=arc-20160816; b=0sjYQwaVHBH2blXccX5yjb57BIv+hsZnMpdfAVbhytdL+4hgVk/gxeJRRedK1xuggz eDTRpujrS5S5OEgz4LZDwKbFy9CwaINArAmf72SE4oA0Lgo9BBDQhAABWgMNKSNy53Si s1210PSgz8i/VNwD3COOqznAnbhen97/Eg5bQNbI/IyTtcz5Rmqm03l7RNKRRsPDhDYd JDW3y7EDOmvQXHbK0z9kcUdj9eNx+hpasefUJgXaGFbB6wacHxKVkKC2tbkTboy1K1qp 6K+ZnBnwuKuz/rfuwGggrSfwb4yUrxniOI5WE/feKNHVtm8zvCmyf2sUAatwmAykVAq1 3sWw== 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=NliGvN15292YSfT7oJ4s8zrTWZp7n2uLfuBUrR2+Aj0=; b=FCIQ6SVlDPGI1R1scGVPUqS27x/2AqmfHotJg147XTzlnlK8K1PbRVG6hYZ4C4RoFv WSXvUL937N2MpF34nZf1u5p7N5I1rqKi7wf+NZQNN+lLjZzx4oaC1JabrzMGIuiDIYoj IN+uvawYTnTGuMu8G7EAp/QyuV2TZGNUE834/I5zQnam/QQ9aVLy3JDF3/irw+K9HNw+ 1ThDxQ2ozcHeXT0ky9FJlBoNtRT3YFCdth1j19Koaho6L6thicCXbRMo01RxLxbpN4yI Eidzakpda8HZNcHozD4lDoLIiIeimh5dxE+tyY8N1ELAIa0L64pMUFciZB+Tf+Ao97jh TmGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JavNjAz9; 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 3-20020a631743000000b004df18fa49aesi17227913pgx.796.2023.03.09.00.34.35; Thu, 09 Mar 2023 00:34:47 -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=JavNjAz9; 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 S230099AbjCIIXi (ORCPT + 99 others); Thu, 9 Mar 2023 03:23:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbjCIIWr (ORCPT ); Thu, 9 Mar 2023 03:22:47 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71B991EFC7; Thu, 9 Mar 2023 00:21:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678350104; x=1709886104; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LugKJEKmoFir+JyJxq1ICb/Yr9xuZ+hFG2k0xUqfkNU=; b=JavNjAz9DxTpoHbBRBTfeaQ5KnbVSbF+oeRVvcOv81pe48f3BM30Eu9W L0MuPEH2MFycL7JKyWK4xK5V+0oU0gHdz3Bnu8A863ptgD3zdheAogJMC mghV0Fi2z1l+Owb919l0iuZC4C+vvTTXQfM0DAk0TUyAfPyw4mQdTvNqw NRrtDuynaY160M7E1Di1h5XiqfoXMNk8nUplZuHyup3p8Y6dbO3ItXbwH whwq2odl6bDGlfRTAdl87MwMqJv9xSZ3kDmLBW4eCzOyWs3i61geBWEJK PMLuRXm4k65fNDWAFrO2DgyqGzXqDjXUNkdE9yQ/Ois0pYhenT1+JJerK A==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="364025901" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="364025901" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787473886" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="787473886" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:10 -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] n_tty: Cleanup includes Date: Thu, 9 Mar 2023 10:20:33 +0200 Message-Id: <20230309082035.14880-7-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> References: <20230309082035.14880-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1759878460316632508?= X-GMAIL-MSGID: =?utf-8?q?1759878460316632508?= n_tty uses: - bitmap_zero() from linux/bitmap.h - EXPORT_SYMBOL_GPL() from linux/export.h - jiffies, time_after() from linux/jiffies.h Add includes. n_tty uses nothing from: - linux/audit.h - linux/interrupt.h - linux/major.h - linux/mm.h - linux/module.h - linux/timer.h Remove those includes. Signed-off-by: Ilpo Järvinen --- drivers/tty/n_tty.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 6d754fc35dce..0481e57077f1 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -28,24 +28,21 @@ * EAGAIN */ -#include +#include #include #include #include +#include #include #include -#include -#include +#include #include -#include -#include #include #include #include #include #include #include -#include #include #include #include From patchwork Thu Mar 9 08:20:34 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: 66689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp170655wrd; Thu, 9 Mar 2023 00:34:36 -0800 (PST) X-Google-Smtp-Source: AK7set9ciA0Nqu6yvrHJSiPOZkRYT0mbxJ0gdHOzP3sA+J3cYYSO0Y26MGJx6OXDN6N8pAY2XwzK X-Received: by 2002:a05:6a21:338a:b0:cc:b73a:6f63 with SMTP id yy10-20020a056a21338a00b000ccb73a6f63mr23309036pzb.4.1678350876318; Thu, 09 Mar 2023 00:34:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350876; cv=none; d=google.com; s=arc-20160816; b=nMc2oL6bxzAOHy6Wav+n94QVOdUkyiQ4+OBAfpZVGsWsQtsHoQsW/+++qk3Gf0gM0P HOBjORmQVHCJ89TouQLuknXuYKREnHPKG3P3P7KhmPy8XW88Pde8PWWtpNL51ruJRGuZ JaIundTKfTP64FA8Cp1Dggh1VUzaD4nsG1sXq20ZyzHfQQTN/sBQZTFqGRTyDaN24xeK YiAmnE1Td5qNvTBhevvw3UKzhgKIKCcuqv6tHjri34AlwtHEvymKhLerysnhRfmbN3Nw LG6Q80VjC5q/0sm31FR3D/3zt4MCinD8vU4TNCGcnjsR7EzlWejTuvYtg9v2GaRkHi2i QF3w== 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=L3f1DDuWrwPGfgSVjmZqamPYMNIA4nfTzIaX/N/8oL8=; b=po8yktCDvs/Q91Q0oYJZ7JI+hSxJxNA+YfadnE9/4p/6474zuTqrz0khvRf8bLlByC hMVpSoEvOuZSXStV+D2zyCgp/cqw293sGs0qjXWeJh+CraCfXAMUcZp/wP8iqzYH2FNf L4jTfPboAlmmIXcCDiDv0Ardw7r09yD1ub6vNXTbh7IolAnt/qzvx8NbB0ddIhscKifO kWI8o+tuzOcg8nb0gTOQP8RZP/ADg/45H2P6QOGr4SfBa1EqSCL2D5fiG0rZMQiVQONj 8R4qRVkpZW+Nw0+k0bsEQKHhm/hnawgI3LwmzbcYlclHnQA87STrGF2ZhF04jzq/m+LK AGBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YE7Wcahn; 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 s13-20020a63924d000000b004fbc18d0938si16304254pgn.361.2023.03.09.00.34.23; Thu, 09 Mar 2023 00:34:36 -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=YE7Wcahn; 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 S229685AbjCIIXe (ORCPT + 99 others); Thu, 9 Mar 2023 03:23:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbjCIIWr (ORCPT ); Thu, 9 Mar 2023 03:22:47 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9F181EBDC; Thu, 9 Mar 2023 00:21:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678350103; x=1709886103; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uA1jsUBpsTn1cyEGtu8uNzvvl9mod+0mi7D3hpv/8ZU=; b=YE7WcahnrA7kUKtR9GEKP6Yd3E0r2eOgmUfeEBK7M9VqSMUoD59TNfLN V3LmKsnGkdxBJVO4nhFZYF3BiHO2sP5g2Y1j1Tkk3RycjwN89zCVuienu /KzKejzgB/gQQLHbRRNlcWDAbvXpkEp8W4vH8QJ5Iazac2YVkX6mD4JdS dCDDp2dPlpGMfqfe5y4YkhAaw1bGzZrw/kSzSBLuRwDUcOlKVz6Pj5cXo CtfKc8/xqZEggEQYy+c4rKaxEbq2XWumShwNJaAX0vYfGUX/9M4l1yPrm pw9d20IxR4th985nM9zN/aGO0eWD7qt91nCzuEU1dq+48Jm3JW52dvvKo w==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="364025895" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="364025895" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787473896" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="787473896" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:12 -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] n_tty: Reindent if condition Date: Thu, 9 Mar 2023 10:20:34 +0200 Message-Id: <20230309082035.14880-8-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> References: <20230309082035.14880-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1759878448630042480?= X-GMAIL-MSGID: =?utf-8?q?1759878448630042480?= Align if condition to make it easier to read. Signed-off-by: Ilpo Järvinen --- drivers/tty/n_tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 0481e57077f1..1c9e5d2ea7de 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -1176,7 +1176,7 @@ static void n_tty_receive_overrun(struct tty_struct *tty) ldata->num_overrun++; if (time_after(jiffies, ldata->overrun_time + HZ) || - time_after(ldata->overrun_time, jiffies)) { + time_after(ldata->overrun_time, jiffies)) { tty_warn(tty, "%d input overrun(s)\n", ldata->num_overrun); ldata->overrun_time = jiffies; ldata->num_overrun = 0; From patchwork Thu Mar 9 08:20:35 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: 66676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp167522wrd; Thu, 9 Mar 2023 00:25:34 -0800 (PST) X-Google-Smtp-Source: AK7set+nXangHbE7ew0StPamcKDJCH7f3/2xftMaOP1nj+jrolZ8nBuFeRoP3rKBD3tNB33AJfQu X-Received: by 2002:a05:6a20:9381:b0:be:a177:af42 with SMTP id x1-20020a056a20938100b000bea177af42mr24486874pzh.62.1678350334626; Thu, 09 Mar 2023 00:25:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678350334; cv=none; d=google.com; s=arc-20160816; b=EutFf4wBbNPnHNpzmbk47m84879MS5AJEi2gmeerjdlMI9WspJwiDZrqHdqDdWY1Gz IuC7BokTkmiA4J9wLBzOUfKx8mbZQqXZvI07gAPzIuU7lAEp+c/vBMBNx0f4e3i9JVJO 4cZP80EHCyYqlfInIIPbZEiJpLg6ygjmL/9X6lkY/8y7eU/CMgFuTHODYbyCrkJ4rj+j nzTMaFxPlqDRhQlt2YRn6BdWG6LImU+XuipykShrEUCQRG2L39hzXlQatgTO6C8esHq+ v/4TLPxD9gFZW1YxA6m7umvTU3yL2Rx6idg1NELu3dLfWj6ZQKOKnDzkV4sgC9jloyvh FHLw== 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=rLJKMo0Z5fqKhbI9MSFZsEaCNWGHShxOVR4Z31DNBXA=; b=Q3Hfr9TETkM0qAe1IdBAwOk0kOJQjjz6FK8JQJTSWqKFyE9nMUbZWTalrSVaeFH8q5 u3Y3xWbYvli52nnCPNc+j+zZT0jKT6srz3Ir7asCkwpfKjPTCnsixR3tfxE4XQrcBdBG r42Y0Sc10I49R9LAPqWFZL8mIqM3K9TXzU8WkLYSIkR6U9Isn74bNk7yakjwDdm+p6EJ BQY5khSVtcybqJeSdK2xSD8fLBBZypr5uHfQzZPueIHOWJe30ZmUNs9+iNnn0Sg0qJQT 2E/pjY5qwXR6loMR7AheQEYFcPS7wVcdFr/wuYgbFxUtqN0n4shu0jGs/lFZDIR1e68J ligw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SR+neSPx; 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 o25-20020a635d59000000b004fd2171917asi17291097pgm.350.2023.03.09.00.25.21; Thu, 09 Mar 2023 00:25:34 -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=SR+neSPx; 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 S229521AbjCIIYG (ORCPT + 99 others); Thu, 9 Mar 2023 03:24:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230110AbjCIIWt (ORCPT ); Thu, 9 Mar 2023 03:22:49 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FBFD3B65B; Thu, 9 Mar 2023 00:21: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=1678350118; x=1709886118; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CxxEqgd3/ySziCnHqMBtXGYZorO4KpYH46SmZHK5Ytg=; b=SR+neSPxmTmcldf2ThYLSPFPw30FJh/D5TQPNMb0PjGc5/SsTS8YkdyL oUqsxCEDaePUhwbaMlGHhDwlSE4MHQ++/P4Hb3ZxXRnbJqb2Va+HMEQk4 baQ3XGupiuqDjtjftZtWmYxUAOAoaIh2JnGwK6LSE7tzaPY+lW6Oa5Dzs 35eA7bm7AUyevc/ML5Qhf7D067RPqccvapY6HzFc2HXJF6iz6CV3V/DF1 WMFolMbtC9FfkAz0V+lFDESP6wTxr/RxORS/ZYNHJxqCmyxi14X+qOYjB d467aAH1vVBu969umphcjacczj+pCIl1lpi9PbYQey4T1fblYk21/hYe7 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="364025957" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="364025957" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787473901" X-IronPort-AV: E=Sophos;i="5.98,245,1673942400"; d="scan'208";a="787473901" Received: from unknown (HELO ijarvine-MOBL2.mshome.net) ([10.237.66.35]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 00:21:15 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Arnd Bergmann , Ulf Hansson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 8/8] tty: Convert hw_stopped in tty_struct to bool Date: Thu, 9 Mar 2023 10:20:35 +0200 Message-Id: <20230309082035.14880-9-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com> References: <20230309082035.14880-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1759877880517443426?= X-GMAIL-MSGID: =?utf-8?q?1759877880517443426?= hw_stopped in tty_struct is used like bool, convert the variable type to bool. Signed-off-by: Ilpo Järvinen Acked-by: Ulf Hansson # For MMC --- drivers/char/pcmcia/synclink_cs.c | 6 +++--- drivers/mmc/core/sdio_uart.c | 10 +++++----- drivers/tty/amiserial.c | 6 +++--- drivers/tty/mxser.c | 6 +++--- drivers/tty/synclink_gt.c | 6 +++--- include/linux/tty.h | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 6ddfeb2fe98f..97c5bfb9d58a 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -1060,7 +1060,7 @@ static void cts_change(MGSLPC_INFO *info, struct tty_struct *tty) if (info->serial_signals & SerialSignal_CTS) { if (debug_level >= DEBUG_LEVEL_ISR) printk("CTS tx start..."); - tty->hw_stopped = 0; + tty->hw_stopped = false; tx_start(info, tty); info->pending_bh |= BH_TRANSMIT; return; @@ -1069,7 +1069,7 @@ static void cts_change(MGSLPC_INFO *info, struct tty_struct *tty) if (!(info->serial_signals & SerialSignal_CTS)) { if (debug_level >= DEBUG_LEVEL_ISR) printk("CTS tx stop..."); - tty->hw_stopped = 1; + tty->hw_stopped = true; tx_stop(info); } } @@ -2312,7 +2312,7 @@ static void mgslpc_set_termios(struct tty_struct *tty, /* Handle turning off CRTSCTS */ if (old_termios->c_cflag & CRTSCTS && !C_CRTSCTS(tty)) { - tty->hw_stopped = 0; + tty->hw_stopped = false; tx_release(tty); } } diff --git a/drivers/mmc/core/sdio_uart.c b/drivers/mmc/core/sdio_uart.c index 50536fe59f1a..aa659758563f 100644 --- a/drivers/mmc/core/sdio_uart.c +++ b/drivers/mmc/core/sdio_uart.c @@ -478,13 +478,13 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port) int cts = (status & UART_MSR_CTS); if (tty->hw_stopped) { if (cts) { - tty->hw_stopped = 0; + tty->hw_stopped = false; sdio_uart_start_tx(port); tty_wakeup(tty); } } else { if (!cts) { - tty->hw_stopped = 1; + tty->hw_stopped = true; sdio_uart_stop_tx(port); } } @@ -633,7 +633,7 @@ static int sdio_uart_activate(struct tty_port *tport, struct tty_struct *tty) if (C_CRTSCTS(tty)) if (!(sdio_uart_get_mctrl(port) & TIOCM_CTS)) - tty->hw_stopped = 1; + tty->hw_stopped = true; clear_bit(TTY_IO_ERROR, &tty->flags); @@ -882,14 +882,14 @@ static void sdio_uart_set_termios(struct tty_struct *tty, /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && !(cflag & CRTSCTS)) { - tty->hw_stopped = 0; + tty->hw_stopped = false; sdio_uart_start_tx(port); } /* Handle turning on CRTSCTS */ if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) { if (!(sdio_uart_get_mctrl(port) & TIOCM_CTS)) { - tty->hw_stopped = 1; + tty->hw_stopped = true; sdio_uart_stop_tx(port); } } diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index d7515d61659e..c06ad0a0744b 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c @@ -347,7 +347,7 @@ static void check_modem_status(struct serial_state *info) #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) printk("CTS tx start..."); #endif - port->tty->hw_stopped = 0; + port->tty->hw_stopped = false; info->IER |= UART_IER_THRI; amiga_custom.intena = IF_SETCLR | IF_TBE; mb(); @@ -362,7 +362,7 @@ static void check_modem_status(struct serial_state *info) #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) printk("CTS tx stop..."); #endif - port->tty->hw_stopped = 1; + port->tty->hw_stopped = true; info->IER &= ~UART_IER_THRI; /* disable Tx interrupt and remove any pending interrupts */ amiga_custom.intena = IF_TBE; @@ -1197,7 +1197,7 @@ static void rs_set_termios(struct tty_struct *tty, const struct ktermios *old_te /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { - tty->hw_stopped = 0; + tty->hw_stopped = false; rs_start(tty); } diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index ef3116e87975..10855e66fda1 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -553,7 +553,7 @@ static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, if (tty->hw_stopped) { if (cts) { - tty->hw_stopped = 0; + tty->hw_stopped = false; if (!mxser_16550A_or_MUST(info)) __mxser_start_tx(info); @@ -563,7 +563,7 @@ static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, } else if (cts) return; - tty->hw_stopped = 1; + tty->hw_stopped = true; if (!mxser_16550A_or_MUST(info)) __mxser_stop_tx(info); } @@ -1361,7 +1361,7 @@ static void mxser_set_termios(struct tty_struct *tty, spin_unlock_irqrestore(&info->slock, flags); if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { - tty->hw_stopped = 0; + tty->hw_stopped = false; mxser_start(tty); } diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 33f258d6fef9..543b3224dce9 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c @@ -730,7 +730,7 @@ static void set_termios(struct tty_struct *tty, /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { - tty->hw_stopped = 0; + tty->hw_stopped = false; tx_release(tty); } } @@ -1953,13 +1953,13 @@ static void cts_change(struct slgt_info *info, unsigned short status) if (info->port.tty) { if (info->port.tty->hw_stopped) { if (info->signals & SerialSignal_CTS) { - info->port.tty->hw_stopped = 0; + info->port.tty->hw_stopped = false; info->pending_bh |= BH_TRANSMIT; return; } } else { if (!(info->signals & SerialSignal_CTS)) - info->port.tty->hw_stopped = 1; + info->port.tty->hw_stopped = true; } } } diff --git a/include/linux/tty.h b/include/linux/tty.h index 093935e97f42..60871a9d3212 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -227,7 +227,7 @@ struct tty_struct { unsigned long unused[0]; } __aligned(sizeof(unsigned long)) ctrl; - int hw_stopped; + bool hw_stopped; unsigned int receive_room; int flow_change;