Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp193971rdb; Thu, 18 Jan 2024 00:08:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2QsxF0RnTY9v5uu1TZfKbf+IrKXOpWRHr2eMsU14pQvmHIASZZqAJ8uqM6RV1wVzoWmzE X-Received: by 2002:a17:902:7241:b0:1d6:ff69:2546 with SMTP id c1-20020a170902724100b001d6ff692546mr446568pll.58.1705565282269; Thu, 18 Jan 2024 00:08:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705565282; cv=pass; d=google.com; s=arc-20160816; b=Ok1eON7UDnLaurNzOC9A49MgKm40vB+H89hqJPFCFVo4pjbFYQQ6IvKVMW1jLssaps D9vyj+oc3jWkDASdl7bbNFKk9OVVIGnFYW/f9JL4inp63grR5oExbWq11Oqdcloe/waB IGvwSY55YAPuYbNAAIm+C25070SiH2T5oRMCVMvsbOw6pyKy1xVc5240GW2TZjvemDdf 8kpJPulbHPPyGtIs2RvxnCpiJHOE5WMFFOPN319wgbVT1IFz5YIlL4HXiBV/MUyl753F Io04clSfKj3gR/51gnzvl/Me45OQzksryXp9/w9vsUh2QfM67lz+JGDXKk6Pd7kHxOVi uV8Q== 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=3dUj9ke+pWSv/ttNmwczDcoqEzHffzHbVjjh9dlMBTs=; fh=1YNwm5KBWetjB3qGkhgLqh/dZnCTsWuqRk83JW6hjgE=; b=gAim1AbH1Yj5Y2KwNQBRaUdrjr/9vjo3//swKioiImbhnwjB3XRSL2OIyGDSU+ok0/ N9KQvgF8zdNcLK001bvpVbxL4qqSGVqjYrS7PqeMC7Ekt/JSS9OZBoXZGCrrvIKQds+d kbDRrNHI9+gHjkbrmdIZh2x+aXpaCxbHos1UltB4Jt6qSgVfq/D6SuMLd01QDwPsRLbQ 5NRm2JJrZ2RhDmGpSC7JvF1/AlPJaeIxOyL9nb9RcePsra6vY97VEJPw5GKGlYlQC4XB UeIuNEDXgIs8vBjQcRbViRibjeQLMv2O8FZ2CTqpOVXwENDmblg5sAlr1/sxjg/uCMDS AYLg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=miPuuFj5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-29809-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29809-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i5-20020a170902c28500b001d6e9ff6951si1012383pld.498.2024.01.18.00.08.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 00:08:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29809-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=miPuuFj5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-29809-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29809-linux.lists.archive=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 0D371B253C5 for ; Thu, 18 Jan 2024 08:03:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E56B22C84F; Thu, 18 Jan 2024 07:58:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="miPuuFj5" 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 177CB2C6BF; Thu, 18 Jan 2024 07:58:46 +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=1705564727; cv=none; b=aRaLoc5kGReqUF3Rf/IW4ZCgNPDb0Hu6N44CcEc7dXCeVof4/HSz/2zbJETqFXPlEqsr75wyre+cJndHcxW31gWdlodtCWjDNE2dokgQ0If5KgvAmr3x+MPaCvNPVHxGh6P9N3kqCaQXXf0HkrNOhQHFRafa/+5VK12cwOjOxqE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705564727; c=relaxed/simple; bh=YRzFj4BN6f8YNzJ8WuOrgNl97sICo/Ly8ow9YGu8iDo=; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; b=ENUzimpuHQNewtPjtDhCdRK7zeGvPPtNvuLjEvHBPPDMCUH3lGiReZG/dmcKZv2VtRIDBpBeIY/CxLloXRJqix2hgiUSK/zFDl7Yx1IkTzeQrrhL9svoWclEqbs2YhgKglM2WpzSPm8CcU5WahakQdP/+QQeLLvqGwuyJdT5gAI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=miPuuFj5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DBACC433F1; Thu, 18 Jan 2024 07:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705564726; bh=YRzFj4BN6f8YNzJ8WuOrgNl97sICo/Ly8ow9YGu8iDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=miPuuFj5etJVAcz9yJUXZ4WE9Q52BwEXzyJTluO6MtFeXv7WULwc+Du2fVhcYNF4T wDG8j944GJmjlV1PiFDf4gfbwkDoOEB9HnBwV8mZBTM4smbIlMdmkTIb4TUCHcLSyb DxWSTnpXlxvIFQ9v8XW8bJTOyLCtsv2d8+B7wAojkwt8Ubk9PXUxjKZFE8Y6d0NIhr RJGeljdzI0rUpvI1x4LxD7L7J8K5aHGRv4sgb8DmqbrTrXIjWDfiCd8TnkMeANnUow ZTKmf+Sesp/tLL1GsA90sj/8he8+OryJ43lgjYmLtBQHoZIu5GTOGxeohGpb5Wo+6b xcOBVUsd+g8MQ== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" Subject: [PATCH 22/45] tty: vt: add con_putc() helper Date: Thu, 18 Jan 2024 08:57:33 +0100 Message-ID: <20240118075756.10541-23-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240118075756.10541-1-jirislaby@kernel.org> References: <20240118075756.10541-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit And let it call consw::con_putc() if it exists, otherwise consw::con_putcs(). This is similar to tty_put_char(). It supports dropping unneeded duplication of code like sticon_putc() is (see the next patch). Signed-off-by: Jiri Slaby (SUSE) --- drivers/tty/vt/vt.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index a4ee983824d5..73e48a53dc31 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -300,6 +300,14 @@ static inline unsigned short *screenpos(const struct vc_data *vc, int offset, return p; } +static void con_putc(struct vc_data *vc, u16 ca, unsigned int y, unsigned int x) +{ + if (vc->vc_sw->con_putc) + vc->vc_sw->con_putc(vc, ca, y, x); + else + vc->vc_sw->con_putcs(vc, &ca, 1, y, x); +} + /* Called from the keyboard irq path.. */ static inline void scrolldelta(int lines) { @@ -762,7 +770,7 @@ void complement_pos(struct vc_data *vc, int offset) old_offset < vc->vc_screenbuf_size) { scr_writew(old, screenpos(vc, old_offset, true)); if (con_should_update(vc)) - vc->vc_sw->con_putc(vc, old, oldy, oldx); + con_putc(vc, old, oldy, oldx); notify_update(vc); } @@ -779,7 +787,7 @@ void complement_pos(struct vc_data *vc, int offset) if (con_should_update(vc)) { oldx = (offset >> 1) % vc->vc_cols; oldy = (offset >> 1) / vc->vc_cols; - vc->vc_sw->con_putc(vc, new, oldy, oldx); + con_putc(vc, new, oldy, oldx); } notify_update(vc); } @@ -833,7 +841,7 @@ static void add_softcursor(struct vc_data *vc) i ^= CUR_FG; scr_writew(i, (u16 *)vc->vc_pos); if (con_should_update(vc)) - vc->vc_sw->con_putc(vc, i, vc->state.y, vc->state.x); + con_putc(vc, i, vc->state.y, vc->state.x); } static void hide_softcursor(struct vc_data *vc) @@ -841,8 +849,8 @@ static void hide_softcursor(struct vc_data *vc) if (softcursor_original != -1) { scr_writew(softcursor_original, (u16 *)vc->vc_pos); if (con_should_update(vc)) - vc->vc_sw->con_putc(vc, softcursor_original, - vc->state.y, vc->state.x); + con_putc(vc, softcursor_original, vc->state.y, + vc->state.x); softcursor_original = -1; } } -- 2.43.0