From patchwork Mon Nov 7 14:16:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 16435 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2078186wru; Mon, 7 Nov 2022 06:20:10 -0800 (PST) X-Google-Smtp-Source: AMsMyM4A3Hg7KIEcjqhRCFlMJXX++MJX1H+mkOkqIw8aRwc4K/QS/pYfI7AXR4E3yIy2RXuuO85A X-Received: by 2002:a05:6402:548f:b0:457:ed40:5f58 with SMTP id fg15-20020a056402548f00b00457ed405f58mr50443321edb.408.1667830809869; Mon, 07 Nov 2022 06:20:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667830809; cv=none; d=google.com; s=arc-20160816; b=Wy3zfXwsqGKt7x9+UqTdJFAkFGtHZnzgxndqcwv5FMfnH/wM8yez6xnDTnnhSVBAy4 7ef0Xr8KCDaRSkzSUdnYIOa4WSRv31GRWp+j5mihDTtstRz3tGVM2Cq05xX0HFKEtJ25 4FUiMjZ39IPiIC5l/va+WvVp3BNmT43dK1WxOIByAGv/+pOiri8zWUHED00E1knDTusT g4+VdZNqwBg1ZmercXDs4JbTIF1u3vBcth9evBtKeEJJxq3hsqcwIIxqVQGJppoBHcxt P8ibbZdr+3akm+v8AR2QH2TC3XS9CXyMOyq+0JiqPUnWxXsZHvdE9IkRmAaxaTpM93zX qzqw== 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=kStKa0WjYDeKLxGc8aWMlTa8ztLKd7SaO/mrohxpQTE=; b=oJWjkunKgqC81MMHWNxlt7rJKMnKYnW28NzEfjlh1LuHw3OnTtNlout2GzvS48tehK XgvLT3qsr9qEWxG8C1zs8re0lwoQ4NU2CD2uRyGF/IVjuVMoPVhv6kBQm5RjBEGBOhMd eDch2usMu2G3iT/JYMRfh5NDOr0jk4ZyfZ6JxB462E5MqH2P34X83dITi2FIbiyDV31N 0r0vxxjxsqiBoIg4OgZBnF7VltzTSr7TSIGxWboeVOAGiJz0oRnoNGyvDsD2l50se2ce 0bKpZSypb6TDr+8KESbfmTr0rwFzJwUCkjFDPmXhJk+COJeCW/k+RdlW0ntzILIOEsWG HnTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="pz/gQ/1s"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=l5i2HOU0; 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 lj14-20020a170906f9ce00b0078ae5192906si7236251ejb.193.2022.11.07.06.19.44; Mon, 07 Nov 2022 06:20:09 -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="pz/gQ/1s"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=l5i2HOU0; 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 S232369AbiKGOS0 (ORCPT + 99 others); Mon, 7 Nov 2022 09:18:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232217AbiKGOQy (ORCPT ); Mon, 7 Nov 2022 09:16:54 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83B541CFF1 for ; Mon, 7 Nov 2022 06:16:53 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1667830612; 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=kStKa0WjYDeKLxGc8aWMlTa8ztLKd7SaO/mrohxpQTE=; b=pz/gQ/1sVexBvgNtGDYjCRgwbJbEvU2eH4YV9pYimdcqvWP2I+B1duvHeKAbgYv5Lr07fJ 3nSzyHqOLORAovjTQxpM5UWGC5xmpELupKsgitL24XB/k/6CbYqbdrByQjGVG32ntimIJ1 USj7SHbao60ntXl7F0B8/Dgf2I0ETZl2HOE6SvWVzvw6syMMJ7jkBNFcCqtzk2ci0rb/h/ nzelv8Zhcyl2iQtUuncRNBpI6lOSso410y4Bkv7m8+4KFJrOnAiON98KbP8i6OKblxuMiU 1Npm/OYCrsXehm0v8UpG8OKzvnQOtYRcwsNbXQ+4ALpv4hu7eoaYI7SzAqD/Bw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667830612; 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=kStKa0WjYDeKLxGc8aWMlTa8ztLKd7SaO/mrohxpQTE=; b=l5i2HOU0W5lz3c3aPgWHXD4IoEYHwPnmVudjTMsP1yxWvp9K9lwAxVDh5Sa/IY4JgVQe+k TL9RD2dZn3zPqhDg== 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 v3 26/40] tty: hvc: use console_is_registered() Date: Mon, 7 Nov 2022 15:22:24 +0106 Message-Id: <20221107141638.3790965-27-john.ogness@linutronix.de> In-Reply-To: <20221107141638.3790965-1-john.ogness@linutronix.de> References: <20221107141638.3790965-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?1748847359407973863?= X-GMAIL-MSGID: =?utf-8?q?1748847359407973863?= 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