From patchwork Tue Aug 1 11:57:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: oushixiong X-Patchwork-Id: 709122 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16C37C00528 for ; Tue, 1 Aug 2023 11:58:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232113AbjHAL6C (ORCPT ); Tue, 1 Aug 2023 07:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234405AbjHAL5z (ORCPT ); Tue, 1 Aug 2023 07:57:55 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA4E219AA; Tue, 1 Aug 2023 04:57:44 -0700 (PDT) X-UUID: 3673350e4fa642aa80c56927871104fd-20230801 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.28, REQID:4b477b88-1d0e-4176-b74c-3029f2cd175a, IP:15, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-INFO: VERSION:1.1.28, REQID:4b477b88-1d0e-4176-b74c-3029f2cd175a, IP:15, UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:0 X-CID-META: VersionHash:176cd25, CLOUDID:6b84b142-d291-4e62-b539-43d7d78362ba, B ulkID:230801195728JVEQZRGY,BulkQuantity:0,Recheck:0,SF:24|17|19|44|102,TC: nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OS I:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 3673350e4fa642aa80c56927871104fd-20230801 X-User: oushixiong@kylinos.cn Received: from localhost.localdomain [(111.48.58.12)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1103825839; Tue, 01 Aug 2023 19:57:26 +0800 From: oushixiong To: Greg Kroah-Hartman Cc: Jiri Slaby , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Samuel Thibault , Daniel Vetter , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, oushixiong Subject: [PATCH v2] tty: vt: Remove some repetitive initialization Date: Tue, 1 Aug 2023 19:57:24 +0800 Message-Id: <20230801115724.1428952-1-oushixiong@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Members vc_col、vc_rows and vc_size_row of the struct vc_data have been initialized in visual_init(), so it no longer to initialized them again in vc_init(). v1->v2: - Fix the comment. Signed-off-by: oushixiong --- drivers/tty/vt/vt.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 1e8e57b45688..cf77011a8f4e 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -140,8 +140,7 @@ EXPORT_SYMBOL(vc_cons); static const struct consw *con_driver_map[MAX_NR_CONSOLES]; static int con_open(struct tty_struct *, struct file *); -static void vc_init(struct vc_data *vc, unsigned int rows, - unsigned int cols, int do_clear); +static void vc_init(struct vc_data *vc, int do_clear); static void gotoxy(struct vc_data *vc, int new_x, int new_y); static void save_cur(struct vc_data *vc); static void reset_terminal(struct vc_data *vc, int do_clear); @@ -1103,7 +1102,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ if (global_cursor_default == -1) global_cursor_default = 1; - vc_init(vc, vc->vc_rows, vc->vc_cols, 1); + vc_init(vc, 1); vcs_make_sysfs(currcons); atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, ¶m); @@ -3398,16 +3397,10 @@ module_param_named(color, default_color, int, S_IRUGO | S_IWUSR); module_param_named(italic, default_italic_color, int, S_IRUGO | S_IWUSR); module_param_named(underline, default_underline_color, int, S_IRUGO | S_IWUSR); -static void vc_init(struct vc_data *vc, unsigned int rows, - unsigned int cols, int do_clear) +static void vc_init(struct vc_data *vc, int do_clear) { int j, k ; - vc->vc_cols = cols; - vc->vc_rows = rows; - vc->vc_size_row = cols << 1; - vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; - set_origin(vc); vc->vc_pos = vc->vc_origin; reset_vc(vc); @@ -3475,8 +3468,7 @@ static int __init con_init(void) visual_init(vc, currcons, 1); /* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */ vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); - vc_init(vc, vc->vc_rows, vc->vc_cols, - currcons || !vc->vc_sw->con_save_screen); + vc_init(vc, currcons || !vc->vc_sw->con_save_screen); } currcons = fg_console = 0; master_display_fg = vc = vc_cons[currcons].d;