From patchwork Mon Nov 14 16:29:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 19901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2238630wru; Mon, 14 Nov 2022 08:32:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf4EhBGwyAFqwpuYvz3Jj3T166jhberiMZrHkCaRJRMdXxlnvtfLVOdeAsuS99z/bRQD7KI5 X-Received: by 2002:a17:906:a401:b0:7ad:f398:78e6 with SMTP id l1-20020a170906a40100b007adf39878e6mr10765455ejz.341.1668443535894; Mon, 14 Nov 2022 08:32:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668443535; cv=none; d=google.com; s=arc-20160816; b=yaJwKo++f/v3HGSTEUl9jzm9YykvgyKWZQO1IuSPAbqiGOwePuA2qLLlLeV7JRJdDB vv0zvqWZmxjv0+RYfBRZmfwWlQl5EhNcv551zR83PYYDQ6u5K5JY50glfhbGgsWoPYq6 7oM4Z3S45Vhk7EcAObJpVCjlfxjc/i2XnTWekizyAiPNjFj7gQNamYxeZcTlXcOrM82I WX4ioFoalIyCsQA2rb9bk/LP5TK/Z4vMPwvHJ2TVABMPOtDwqa6xWk0/KaTZBbwhcT4z nFIsPFVdvSV9zvwX8apYBfUomNHpDNcbFUbOC0+/trNcLwonWvMWNAye5Kd4UBmW1twQ 49aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=WoAi/IMpBqhMANDygn8dBGFjZ2GQ0xeR1eRQRwl7/a4=; b=OsDc2muyu7kTPTZe/FmKhTfAFL62Jy4/uChI31Ux9QBgHCjGh0pBUz0CJZo9Bp2ebA u5CY+OJW/xO1zlwLYnv04V/XNDz2a9lx9c3p+7ftAELoJfNoHy/Fbf8Hv6eWDVZ7c4ua PJzNJJClMAu5fS2SzDVg/5o3PiZ/TWoz544Fn5lfUGgzkXgc53/M2Soznsny/N0AG+nJ /IUqT2Id5PKTl2vHTXCYN7jLetgLjdYpO4hIdhsfFNm1z338DNIBS3A5uIUkOGtfvGdx lZNrggtQxJID0rAgdmIWrwx0iceOtlrqwwtSEuZoHHOQXpFR6Bg0uQ0jlBlRuMtPpsjf qiUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AqUN9haB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=mZitRJc9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a17090618f100b00780f0b45416si7589285ejf.622.2022.11.14.08.31.32; Mon, 14 Nov 2022 08:32:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AqUN9haB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=mZitRJc9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237778AbiKNQbJ (ORCPT + 99 others); Mon, 14 Nov 2022 11:31:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237632AbiKNQaZ (ORCPT ); Mon, 14 Nov 2022 11:30:25 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEC3B1F2CB for ; Mon, 14 Nov 2022 08:29:45 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668443384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WoAi/IMpBqhMANDygn8dBGFjZ2GQ0xeR1eRQRwl7/a4=; b=AqUN9haBzsP/HqmGWn7LninVTZwjqkkysLnOs9sIGh9FQdeeoKz7Gzt8aR3TUbQRR01ZD0 4fbSxfS2xwqbCSk4MGPZ/h9nKiWaZCjsUIYMtNaGYmCBLCtSYOMuMh/nWAMO/VbVximvSY qhW7QXGBolQdpr6mlObUNHsK8ptW93CSvfm/UHosiEe1R7oHb4NKrx2oEcBhHONoCsUtip WtYNXCCYjG94gDQtWriUL2ugK+/1sNbhHMGID8IONHOaIp2MmkGweRmUbLmExqlun3O0/3 16w4tC2pTh/0J4jTDAOoYO6LCO0OnMhXfiIRwUwS9CBL567Glz7vkU5qaYTNSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668443384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WoAi/IMpBqhMANDygn8dBGFjZ2GQ0xeR1eRQRwl7/a4=; b=mZitRJc9FS7M35SEGDgcrp6yBIpx7ZU+LTSfluPEhBlQEioB3RYMPItGTx/ey2cplmPiur 1rbpiEy4260r+8BA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linuxppc-dev@lists.ozlabs.org Subject: [PATCH printk v4 24/39] tty: hvc: use console_is_registered() Date: Mon, 14 Nov 2022 17:35:17 +0106 Message-Id: <20221114162932.141883-25-john.ogness@linutronix.de> In-Reply-To: <20221114162932.141883-1-john.ogness@linutronix.de> References: <20221114162932.141883-1-john.ogness@linutronix.de> MIME-Version: 1.0 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749489849278630001?= X-GMAIL-MSGID: =?utf-8?q?1749489849278630001?= It is not reliable to check for CON_ENABLED in order to identify if a console is registered. Use console_is_registered() instead. Signed-off-by: John Ogness Reviewed-by: Petr Mladek --- drivers/tty/hvc/hvc_console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 4802cfaa107f..a683e21df19c 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -264,8 +264,8 @@ static void hvc_port_destruct(struct tty_port *port) static void hvc_check_console(int index) { - /* Already enabled, bail out */ - if (hvc_console.flags & CON_ENABLED) + /* Already registered, bail out */ + if (console_is_registered(&hvc_console)) return; /* If this index is what the user requested, then register