From patchwork Wed Nov 16 16:21:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 21155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp233362wru; Wed, 16 Nov 2022 08:25:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Up10EtmsSYUoGWZsTmLUrIf2Z2yFMT/vTaSfy51fIlC2sPUahOufr9OTi9/LaRfqGmEuV X-Received: by 2002:aa7:9197:0:b0:572:7b49:4f48 with SMTP id x23-20020aa79197000000b005727b494f48mr7669704pfa.33.1668615944275; Wed, 16 Nov 2022 08:25:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668615944; cv=none; d=google.com; s=arc-20160816; b=VE7Tyy2EDtM6oxGYYhcMrm1oCxTIpRFvdzQ1UI2lPB3FsdyRgVz3OySyr8jp2deMQL d3Ej3WeiHzHQK4ysEijBj16ABbIZ7lkEBd+T7JH3IZifyCspPnaiUyYepfeK06L+E28/ hi1ZHRkbpDydmNgqCsT4LT5Hqw3lKRfdevQYw+EGCIYXEmlvl+iatqD5nTVzGt5DrYJ6 FL1No6gVNiV3Tt5JSHiRV8lL2Okd968yrAhMEcjnylB6nofylTshT+6hzEPYxWlkoc3o 0n2vEs3MymMATSMw1TUQoU1e+LjIYjGiqSk9PS+dxBgnDfQCblB4d/Yl25S64qQnOGVY ZWog== 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=TSIVIe1EqIleDtxkM+5UtUbVkbW2RBazLwzkAekkWjd4Aq2BO/kIuRMmV6fxau2oNT vhbGiuJTgzek1rfnrFDErzbbu6dwtPCHnEulKNoViIzF2Qamu3O3rW16Y5evq95IOMaT 1CuQiI9B87KC9rU4bRpETU80nkDY8c407+Nky7eZj+EvgCXDIfQTDjYSXYDiodOzADtX Lw2+Bh6kJixX1ZnsHqr/R4bWwFNbZMdpzsadZ4zAa9TPq8J7w7WFp/2JIXIjxDSN19c5 n9S5DdPTMHqHhbAG9gIKeRUtncFp0/naX0lUk+tu8ADcTcJ8syCApoHtU7R6yEJ2+Ht4 A+VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3DQ4ybTO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=BAcrakEp; 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 ja7-20020a170902efc700b001854f631c8esi14420448plb.221.2022.11.16.08.25.30; Wed, 16 Nov 2022 08:25:44 -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=3DQ4ybTO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=BAcrakEp; 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 S234423AbiKPQZA (ORCPT + 99 others); Wed, 16 Nov 2022 11:25:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234879AbiKPQWi (ORCPT ); Wed, 16 Nov 2022 11:22:38 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 195CE56EEC for ; Wed, 16 Nov 2022 08:22:10 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668615728; 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=3DQ4ybTOYcFtmwITLSHIYeVyVwnAXkGWFQW/4sJDsRLNKaCHLDRnlfSlMsgSfYPJL06aU6 HObqr0W9cSaKt1dPrg88oy2FnVMdizwcMqHQh/H9lJHeqvg7UgarLJvkZW/wof37+IqYp0 PUM5sQ0uYjBDY8iSw0ByaONYCNjofDYn38xrzQcO68QqVPwBLsAzqSolO9quGnzP4IqYSL Kw7JHvV4ZuZra98V5OSvbL4vcRlGBWHVUS9pmiBj7zVX8jdPOPuJHOJ0O0mq2VO3o03dXo bvMpC71N/uhuEhtU7QQaUNzrCbgtikuD2C5DSalmb+Zl1yXI7vuDI9zlf/D9Bg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668615728; 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=BAcrakEpk8MQUdoOPQfpxF5sGvK4lMHn3g/fTME1TCNLAdTunomPlI5CyDW0olh1v3Kiq5 +U26bZuftwKQNSBw== 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 v5 25/40] tty: hvc: use console_is_registered() Date: Wed, 16 Nov 2022 17:27:37 +0106 Message-Id: <20221116162152.193147-26-john.ogness@linutronix.de> In-Reply-To: <20221116162152.193147-1-john.ogness@linutronix.de> References: <20221116162152.193147-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?1749670632566851483?= X-GMAIL-MSGID: =?utf-8?q?1749670632566851483?= 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