From patchwork Fri Feb 2 06:56:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 195660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp257328dyc; Thu, 1 Feb 2024 23:12:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFECbB/YlI5CJ1QAvnFYfUWBntyaUJCWC56eGwPC8/4PFVtlzIpL2tbvRwD7Bt4jPM+/nJG X-Received: by 2002:a05:6a00:998:b0:6de:5e6:8ade with SMTP id u24-20020a056a00099800b006de05e68ademr6005789pfg.24.1706857976967; Thu, 01 Feb 2024 23:12:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706857976; cv=pass; d=google.com; s=arc-20160816; b=EWRQGECXykfRKvLBnrPHP5GvUwbmtPDZ1CPe9p7BFiJCkh0ei8T+I6Ap6W7lTD9hSJ KiYb0uo8h+XszF0L/X9T/StNN/7k81m2eaaKosfQh6mhXayfYc5C3dAx0hoL/x+s5ri3 /YMlnL2/tSoPLk96LMXR44a0zI2evr77bspXW51xNt+9BfoFfAYh4HMJtiDq+scJvemz X6IUMHYN/nV8FP/Nn8EGm1DG+r/F9Kj6y2MvMQnLPB7wLUvfiYkNPJovHwUn0Wm6wl2/ 11PGWBjfKuPnmJjqPHGwVn8zpNy9+unQ4d3oEtpTNApWYzC4E45ZSg28/hULL8nf9LWX zY3g== 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=ZWaD/TyHqTp4VyBTGdVfNeD+T9ZNAlHguThnM0xdAaQ=; fh=bTsEjx7RqhSxBtiNlZNvdzsG0d3YKFYZ+QrQ2uVQ8d8=; b=bhlCQMSt/ETZptv0gYkzCyF9gKO4aOrX8m4APtbthmwOMA3a/U6Uzt2yGyWcSGx+S+ 4kpY6HyY7idmnVNry1eD1hvVpBRWit843K3f7P0gRmZAKZCmj3bMMcAXXd14VLbWnMcl XLPFp8TXhUx4TIXNWJ4qilcCwBPla32wQmbSz1MtsGl4pQ1D9ryMVcHEZsTu4q4by21S jAD0yQXLBbGrQPWp+WI9clARjhP6Vft0DWvQ2VjKIsDKNVyY1zTDfzM924KVhredy9yI sUGBnV9r2WHmYCa2In4PfpB8Ss16OFG0v4EUweBGAztGu+ZtWpSMhR8BFY6TKqpUBcF+ EYfQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oKsN4Buf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49336-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49336-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCW6timBq/BuyIkzGcn5F5Cpbx3LtLCCpbqKNXK48nnk5xe5b+2z4y3z3bmm4EG0kkBupoPyPxq6d9pqkv4Lfob3BMT0EA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q7-20020a63e207000000b005d8b6af16b4si1119754pgh.577.2024.02.01.23.12.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 23:12:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49336-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oKsN4Buf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49336-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49336-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BBF5CB27095 for ; Fri, 2 Feb 2024 07:01:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58CB24A9A5; Fri, 2 Feb 2024 06:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oKsN4Buf" 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 95AEF487A3; Fri, 2 Feb 2024 06:56:42 +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=1706857002; cv=none; b=KbIZaseLzQQgJCv9/qQXkqvqfnXixjIe+ZOCq9WJhSaRgnJOHiu+UE07cKuiWzm0PwGn/ITcf5DO6hEUCfNbh1rtcLAQs6gIgymxHSMxbIyZXcwXX1wfSKdb4eD8+t0PEPxU3gNmbZDRm7PhhUxBmfmFnaeJFeoljGKqYmoLOSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706857002; c=relaxed/simple; bh=nkWkHSb0yfwwGbw4xRVlBM1cIu2gl8Yeewy4ovMPibY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tVt6+wmq0xelnKdi89uzNKmZ7LRy1NU4mUpXqaWok8SB36M9aX3qDG91EJ+j6t/2UlMQ851oy5YXyZMqoKo06rZbPUdaPF5VkVoi1mi9EoNN9Rjl/2KSRhhSXhqKrRtKyJWiiIEjK4jdpMvvb+gm/mu98YAS4FauDSWc2bQ6Jtw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oKsN4Buf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B97EC433F1; Fri, 2 Feb 2024 06:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706857002; bh=nkWkHSb0yfwwGbw4xRVlBM1cIu2gl8Yeewy4ovMPibY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oKsN4Buf4FfaSfj508bocnUZ2FXfe0mjiJMu1gXev4VDSb3zPJ8AQH5LsQX1lgY++ zCzNsYG4x4nA7nfIpp4n7HawBEo/EVAKGi1+htZxXfrYMsLjCk/e9TVxX4J6hzymdE zKR/wjycigLKJS9eougbDQ2HbgHec3zKK76/YmGgY4DX2kO6EJqF5Z2k4+osDutU+v qxLQ176yzHFWvRE9/K0wF8Gd5WvjtJUMpdgOHPLQp8T4x0rrgnMUj0W2I7OtvGsfKd t0EtUQWVu8tZHHjfCKjCpp7nS5NjQ/74UShvnVM3u+6RYsCc1vrPIbpLyZ0pZaGrYH 5BCHfqZFtfwNQ== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" Subject: [PATCH 20/22] tty: vt: use switch+case in the ESgetpars case Date: Fri, 2 Feb 2024 07:56:06 +0100 Message-ID: <20240202065608.14019-21-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: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789770310431921180 X-GMAIL-MSGID: 1789770310431921180 To be uniform in the 'c' handling, use switch-case (with ranges) even in the ESgetpars case in do_con_trol(). Signed-off-by: Jiri Slaby (SUSE) --- drivers/tty/vt/vt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index b5fc3b896e26..b3c61ec92df9 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -2628,10 +2628,14 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, u8 c) vc->vc_priv = EPecma; fallthrough; case ESgetpars: /* ESC [ aka CSI, parameters expected */ - if (c == ';' && vc->vc_npar < NPAR - 1) { - vc->vc_npar++; - return; - } else if (c>='0' && c<='9') { + switch (c) { + case ';': + if (vc->vc_npar < NPAR - 1) { + vc->vc_npar++; + return; + } + break; + case '0' ... '9': vc->vc_par[vc->vc_npar] *= 10; vc->vc_par[vc->vc_npar] += c - '0'; return;