Message ID | 20240202065608.14019-22-jirislaby@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-49337-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp252807dyc; Thu, 1 Feb 2024 23:02:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWGq+ckil6vImlZWUc/QcisuDYs/X7BNZxjt3BtzCADK5v0rUNVtRwnR2pGURvoAinOwQo X-Received: by 2002:aa7:c45a:0:b0:55f:e8b4:4f7c with SMTP id n26-20020aa7c45a000000b0055fe8b44f7cmr648113edr.5.1706857326121; Thu, 01 Feb 2024 23:02:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706857326; cv=pass; d=google.com; s=arc-20160816; b=d3f9jUEB6Z6fXdvHMloz0C3oExmvoL1XDSSQGpK4FUF+NZWpqEZ19iLAcI0rwm/lJ7 wnTtzeby41jA1LCkKUJAZkmwkMasuXVfk73FrVpii9A+/oeOl0kr0KvBKG59iciDJ9j+ xxtyBjrt3tpQIxCCsyeyWg0AadXlYWfPM8h+Aa9CNL4wmjaTiwOHYqFgxF3vvyrA1BwX 2ELZSb8PYjfCsKjzgQSTBz+7IYDIqnNlg7f4pT8jKDBfcZza3RrEQa59y/O5/xY5LXfG y5R+qschzEc6vbCa1p1hT97EN783bdDQTKCxpj9CJ69aFyzl6Zms98Qke8KhEztSyx2h Llvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=mbspxjfCNfqG09aFBHiQjPC51Si3kPWftNnuNdV5oP8=; fh=H1sUvTr4jRePQa7FbR+hFUIg9DpoaYKZhK3j33saWfs=; b=udztBVcT74FL8ufI5hcCwVbiQajyaSesdMq4IVaRsBSCOT1lcoCm83JtsZWjCoyc3g 0ZMo3Nz6pFKEoDDPAc6rlKJ3ZEUgiLPHAJ1fUk4XLmy7mbbjLa9wy1wyepld9T0MmUbj 8yqOAtoLk1Ppq1u7+5GufBqSNCj6m4nBJTGqk0LdRpAA/zPh+0vjwMakljrSvhi+oEbD vqR10gtKm53FeMFtenGV1HlE6y99nhdcj2K04c/DzpJci4WOm8aCDm8Z7905/zpsneCo L/oAvXYpX37wuOyqg+Xae1PHoo86qCmbp9dJaYKscR1xrbXdMfQmQbftKVWEkbCJS3eh bPQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lghqeEoq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49337-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49337-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCU+dFJ8NRxpQXtVKk/ZbD8IRQwwExzb4Mi6KP4Zelpg2qLCwsfVNoeU9tZlFvCHtK10WZEhpL+5yzng2W/5mM24CTWh6Q== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o17-20020a056402039100b0055f2033af19si539243edv.607.2024.02.01.23.02.05 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 23:02:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49337-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lghqeEoq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49337-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49337-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B4C1C1F248FE for <ouuuleilei@gmail.com>; Fri, 2 Feb 2024 07:02:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D8DE17996; Fri, 2 Feb 2024 06:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lghqeEoq" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB8FF48CD2; Fri, 2 Feb 2024 06:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857003; cv=none; b=fJnueGg/Xs9gKLOl5mWoAfoBQSwHHU5V0xCIIZxb0eBVVYAlvAgP12xoALfGkTA72pzIR9HegGimcqeTqNmNxDxhaYLr5JJgU3gsN73py98y7q3RCQLbkblgGF/FYe8MTv8RO9gQjAImppfa9bNeZXpoCk14t3o4xHLC6aIPWwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857003; c=relaxed/simple; bh=VOEOzfnSThEWfOBJs6nKpRIEyLceRRUxrYlGmQrTE5g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SB8T/rQ3wj/AEKpX5J75zBrPBFGUggNQi/loWc5NJY8MWwv4MgdlLBetrE829kZZ46iAr6gU+i4S62cLPki0rIWWFZQOnJ8ZffJvKXI/++z+TACLGJZjH2JwqyfnQM8CqWOsfniw8QBEJV8ditq1xWLQI/5KhuKlktv9XIL9ff4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lghqeEoq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86348C433C7; Fri, 2 Feb 2024 06:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706857003; bh=VOEOzfnSThEWfOBJs6nKpRIEyLceRRUxrYlGmQrTE5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lghqeEoqNlo0iQxUcgQ+h3jWhF9iNmNOdEM7gxs9NG4VGihXIase6yX9+SkohvOUO SPrmVPygwVB1KzXFVkFLnPWQiqnrC+5ZrXfn/iPfYJAs8MxXK7IVqh7mgvX6s1IOwc EMk3PmDozw1IBfCjtZWsHP+ugyNUxcNRv27jGlnrht1MXtVuuZmhAWthAzn8nkoKvx bjW97dH+bkhYeHksM13x8wbfCx7MW8XjHJAtFTJ12gHYkL1+PHP214DPsVCtanQMlu kRWivQ4F7XWBUXlRKZooHPztyIuYjnjU4idT3UqS+ht+mO6zU5+A5yGsJMSd+gpmO1 23QZ7jjI+7sow== From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Subject: [PATCH 21/22] tty: vt: use ASCII enum constants in vt_console_print() Date: Fri, 2 Feb 2024 07:56:07 +0100 Message-ID: <20240202065608.14019-22-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240202065608.14019-1-jirislaby@kernel.org> References: <20240202065608.14019-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789769627958590490 X-GMAIL-MSGID: 1789769627958590490 |
Series |
tty: vt: cleanup ESC sequences handling
|
|
Commit Message
Jiri Slaby
Feb. 2, 2024, 6:56 a.m. UTC
There are still numbers used for ASCII characters in vt_console_print().
As we have an ASCII enum now, use the constant names from the enum
instead.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/vt/vt.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index b3c61ec92df9..e35f7a31a7bd 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -3240,22 +3240,23 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) cnt = 0; while (count--) { c = *b++; - if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { + if (c == ASCII_LINEFEED || c == ASCII_CAR_RET || + c == ASCII_BACKSPACE || vc->vc_need_wrap) { if (cnt && con_is_visible(vc)) vc->vc_sw->con_putcs(vc, start, cnt, vc->state.y, start_x); cnt = 0; - if (c == 8) { /* backspace */ + if (c == ASCII_BACKSPACE) { bs(vc); start = (ushort *)vc->vc_pos; start_x = vc->state.x; continue; } - if (c != 13) + if (c != ASCII_CAR_RET) lf(vc); cr(vc); start = (ushort *)vc->vc_pos; start_x = vc->state.x; - if (c == 10 || c == 13) + if (c == ASCII_LINEFEED || c == ASCII_CAR_RET) continue; } vc_uniscr_putc(vc, c);