linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH 1/8] n_tty: Convert no_space_left to space_left boolean
Date: Thu,  9 Mar 2023 10:20:28 +0200	[thread overview]
Message-ID: <20230309082035.14880-2-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20230309082035.14880-1-ilpo.jarvinen@linux.intel.com>

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 <ilpo.jarvinen@linux.intel.com>
---
 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)) {
-- 
2.30.2


  reply	other threads:[~2023-03-09  8:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  8:20 [PATCH 0/8] tty: Cleanups Ilpo Järvinen
2023-03-09  8:20 ` Ilpo Järvinen [this message]
2023-03-09  8:20 ` [PATCH 2/8] tty_ioctl: Use BIT() for internal flags Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 3/8] Bluetooth: hci_ldisc: Fix tty_set_termios() return value assumptions Ilpo Järvinen
2023-03-14 23:10   ` patchwork-bot+bluetooth
2023-03-09  8:20 ` [PATCH 4/8] n_tty: Sort includes alphabetically Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 5/8] n_tty: Use DIV_ROUND_UP() in room calculation Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 6/8] n_tty: Cleanup includes Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 7/8] n_tty: Reindent if condition Ilpo Järvinen
2023-03-09 13:45   ` Jiri Slaby
2023-03-09 13:59     ` Ilpo Järvinen
2023-03-09  8:20 ` [PATCH 8/8] tty: Convert hw_stopped in tty_struct to bool Ilpo Järvinen
2023-03-09  8:33   ` Arnd Bergmann
2023-03-09 14:58   ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230309082035.14880-2-ilpo.jarvinen@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).