Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4663708imc; Mon, 25 Feb 2019 08:46:20 -0800 (PST) X-Google-Smtp-Source: AHgI3IZUE9rqyXLIjvmAxdTCAl+b6N5UnBPZj01Ds6+k5Io/AGD8g95QCgqmpjx9ypwYBKIkPhnK X-Received: by 2002:a62:3681:: with SMTP id d123mr21369370pfa.242.1551113179944; Mon, 25 Feb 2019 08:46:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551113179; cv=none; d=google.com; s=arc-20160816; b=JSOmOtNA7AE0P3go/Ezfcc9bjPqpADAbp6pQZpkxV4Lj6uJMtt/iO27Ksa6WY4+P6Q XDGAXsH4Zhshm4lWETmIddGK2MOxznbAexgYmtgpVIvmsk1Za68XdC5A2ZvVNYI/PnZl iAnYCZMgzSMTWT9aN8y9GPcWIS4L8stU9c6gipPiWEz6Dzlcov55WngKNycFk3b+eqbP Q45/6IVqIUKmJjVMquiyZaF/Wlcq0FiJFit3lxrKAHEioqYn3KT5yAMvJ9V0w8i4Enkx qyhecZ4SeP2K7BPfj5B8BpvejhThBIMSTG5QdCW+GH5R/P4xDfDtzLaIrdB85KCecNth a02A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lFzgS9xHg1g3NiGPuvqsyQgq7W8qNR6O5yaRCVzCSNs=; b=NuC/yO2KIT1CtKN19RaYojL+fW9kicOBHmXx8v7nubYTogF7LuLBB6WXAKuuj7ofsT 50tkXa8Pj9dScfxunKx7riezrAJ9s0fUvz+Od/GU1ch/4I3li9gnrhlzI2tQkRRqhkIq trnReBIaT+HpC2bmxiecaytnUqhyxGodpJZpB7aEredi5zvPUXvmteT4Lh8WD1Gq7zwO /6ret+NZHbSbp2RYCxgI0GUBneRDcU6RvGdymfQINlR5HRVuDBc2Odn1O6RtTM6Lkc+m YN4XXgHufS2geKSCnyeCts8zz83E6ImXzIX3rdqEIk+z300u39N9YpWytl0a8Yy5+jwR loGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tomli.me header.s=1490979754 header.b=pGxeSDYJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tomli.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l186si9354675pgd.67.2019.02.25.08.46.04; Mon, 25 Feb 2019 08:46:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@tomli.me header.s=1490979754 header.b=pGxeSDYJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tomli.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728424AbfBYQoM (ORCPT + 99 others); Mon, 25 Feb 2019 11:44:12 -0500 Received: from tomli.me ([153.92.126.73]:38580 "EHLO tomli.me" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728138AbfBYQoL (ORCPT ); Mon, 25 Feb 2019 11:44:11 -0500 Received: from tomli.me (localhost [127.0.0.1]) by tomli.me (OpenSMTPD) with ESMTP id c964809e; Mon, 25 Feb 2019 16:44:09 +0000 (UTC) X-HELO: localhost.lan Authentication-Results: tomli.me; auth=pass (login) smtp.auth=tomli Received: from Unknown (HELO localhost.lan) (2402:f000:1:1501:200:5efe:3d30:359c) by tomli.me (qpsmtpd/0.95) with ESMTPSA (DHE-RSA-CHACHA20-POLY1305 encrypted); Mon, 25 Feb 2019 16:44:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=tomli.me; h=from:to:cc:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=1490979754; bh=hlS8cDsy0ZtAhqRb2guVC+lQrA61gX5oN+NrwC7dGl0=; b=pGxeSDYJTsadTHi5DkX1eVFJ01yZIxyKqcd/6mRlGb5FEQ0dQNygHqQszVYwIbSQiTKyTQcMaeyes93C6AvMPjYSFKklOhVSP3dpfoPFDkR7IX2A8Dc4M18Dpnal8z92/QaD84aiEWW4UjTrwuVgbOQVIe0i8I39pTFqPMrWteDDdUA0H29V20uhOyqC5pHYDh5UYkFwDmWaWyv/gik4jzaZcroMy8fSHPqBVgpxtHzRW0a+JY+R5IJVAIaXEbEiofbzvM6f29xpZc9fH0mPyP5vlgEuvRwZuNMX01gR1YyD0eW7OKb95XZgkSBumBJf6A0GduzrDsV8/GvFJHFiPw== From: Yifeng Li To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby , Nicolas Pitre , Adam Borowski , Mikulas Patocka , Alexander Potapenko , Yifeng Li , Mike Frysinger , Daniel Vetter Subject: [RFC 1/1] tty: vt.c: Fix TIOCL_BLANKSCREEN VT console blanking if blankinterval == 0 Date: Tue, 26 Feb 2019 00:43:46 +0800 Message-Id: <20190225164346.1359-2-tomli@tomli.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225164346.1359-1-tomli@tomli.me> References: <20190225164346.1359-1-tomli@tomli.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In vt.c, "blank_state" will be initialized to "blank_normal_wait" in con_init() if AND ONLY IF ("blankinterval" > 0). If "blankinterval" is 0, "blank_state" will be "blank_off" (== 0), and a call to do_blank_screen() will always abort. Even if a forced blanking is required from the user by calling TIOCL_BLANKSCREEN, the console won't be blanked. In this commit, we introduce a 4th "blank_state" - "blank_normal_notimer", it indicates the console can be blanked, but not automatically by a timer. Then, we made a change to "con_init()" - if (blankinterval == 0), "blank_state" will be set to "blank_normal_notimer" (we have similar changes to "do_unblank_screen()" and "poke_blanked_console()"). Finally, we change do_blank_screen() - now it will return if "blank_state" is neither "blank_normal_wait" nor "blank_normal_notimer", thus allowing the console to be blanked even if there's no timed autoblanking. Signed-off-by: Yifeng Li --- drivers/tty/vt/vt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 41ec8e5010f3..ec84bc2868e1 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -238,6 +238,7 @@ enum { blank_off = 0, blank_normal_wait, blank_vesa_wait, + blank_normal_notimer, /* no auto blanking, only manual blanking */ }; /* @@ -3334,6 +3335,8 @@ static int __init con_init(void) if (blankinterval) { blank_state = blank_normal_wait; mod_timer(&console_timer, jiffies + (blankinterval * HZ)); + } else { + blank_state = blank_normal_notimer; } for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) { @@ -4168,7 +4171,8 @@ void do_blank_screen(int entering_gfx) return; } - if (blank_state != blank_normal_wait) + if (blank_state != blank_normal_wait && + blank_state != blank_normal_notimer) return; blank_state = blank_off; @@ -4232,6 +4236,8 @@ void do_unblank_screen(int leaving_gfx) if (blankinterval) { mod_timer(&console_timer, jiffies + (blankinterval * HZ)); blank_state = blank_normal_wait; + } else { + blank_state = blank_normal_notimer; } console_blanked = 0; @@ -4293,7 +4299,8 @@ void poke_blanked_console(void) else if (blankinterval) { mod_timer(&console_timer, jiffies + (blankinterval * HZ)); blank_state = blank_normal_wait; - } + } else if (!blankinterval) + blank_state = blank_normal_notimer; } /* -- 2.20.1