Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1835221rwb; Mon, 7 Nov 2022 06:23:47 -0800 (PST) X-Google-Smtp-Source: AMsMyM4+XgrTVqzQ7+iyPIw16fFT+usblQrdy5ZjmhzihZ4dCoc4M7Oo7BzJ/2nDP8L9Zc4a82oi X-Received: by 2002:a17:907:763b:b0:7aa:1ae6:900b with SMTP id jy27-20020a170907763b00b007aa1ae6900bmr46354946ejc.416.1667831027009; Mon, 07 Nov 2022 06:23:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667831027; cv=none; d=google.com; s=arc-20160816; b=fOrlM3bMHyRdVraN/scAE9U+4ejiJ24t79lypWyVHLNu9ltqy06REByHvk82HaSzqF /TzjKmvOT2fmj3u58KR3qJiMcHQplJEnNrqXgOaNhY6YWDl7A4kmf4eLE+9tgN4GkcJY 2V1zCmVM2flHI1lN9JvTbuRWfmpvOsiDFQ9rsY4U6zk8dD1O+ZVJb6FHEdQA4LMRgJVp RAaV2cD4GlvadeF6PTiGTlWjeklHNt3xY8sNF0LBGQvUCqY4PyxmWN6qQG8Z3Y6hELXx eQV/+onvgZZHi7gT5rEqoN11qk8kS6E4xrMjoNu8apq/uRs3QkNsvQ3P3q2X9S0d2KKR wF3A== 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=hTh+Y7bD13JCVuc3SV32h+lY6g8QzK5tRTIXwcqSGfI=; b=Cza9sFRKk8n5akjgJ2mmJdkQ9ugpKUuXfPju9qgUElhc6VgNX2o7MUD9NNfWqny6LO 5Ou18uauMtRV+/V+/VCMG9Xgyp7DOGblUCZkMG9aVitHoN8cWCwp6Vk7ZXvqwqxkmduu hyaoMpjpSYxBOzDIqIeveufdLdorVkpOdgZIFPXP1JqS5gzLMFeXrYiUCVFiAclR5QoH FSM/oMNB5nqA6hK0fbAKVhahRLrSTfsGUpOKV8iBIhskHymy2PmC1lLmK5mdS7iLfJvJ alttulEaHoh4swDcfqjMA+hng9a7mTc5GKnxtuZQcGZqWfa8deMUAUxAQOvLGa42t+3C nmcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vQeoLKWE; dkim=neutral (no key) header.i=@linutronix.de; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb6-20020a0564020d0600b0046453c39abdsi11312007edb.104.2022.11.07.06.23.24; Mon, 07 Nov 2022 06:23:47 -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=vQeoLKWE; dkim=neutral (no key) header.i=@linutronix.de; 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 S232380AbiKGOSr (ORCPT + 93 others); Mon, 7 Nov 2022 09:18:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232202AbiKGOQx (ORCPT ); Mon, 7 Nov 2022 09:16:53 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 943D71D0E0 for ; Mon, 7 Nov 2022 06:16:52 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1667830611; 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=hTh+Y7bD13JCVuc3SV32h+lY6g8QzK5tRTIXwcqSGfI=; b=vQeoLKWE1k4R6O3nMnBfOLEHIpwhVsbvXcVbHBj6NMymPvMJgyWKk8a+SWMhfut8ws1okf Rqf9Cz5bLPDfyH+IyWepofmoKnEQOGvQ1iHo3uNlukZnoFRP/pK5Sn5O02G21xpmFqMb+u hlTpVg1FSFH8SZ5WJyjH7IZ6QWr3b0vra6/IicriLiXUPXoi2kY+4Ry5gxKoUarCzr9z0L Jn/x7yIxlwj3fKZG/3gv9EsOyIpQRYwIlQqQP0/vFXqq5R1VhYgWlvhKaj+E2sPNiXxMoP PRI0wvXScmB0NbnXYTOF9ujFHajDe8JAN/lBQ8WvjFv+BmWum45rO42CvDc0XA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667830611; 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=hTh+Y7bD13JCVuc3SV32h+lY6g8QzK5tRTIXwcqSGfI=; b=T64AeLS2skGi+8SZjeqwwtVGih9S8IofM6v6ACJ2ABibEKOmMbg6PouGq2vD32FeJ/mS4n /VBpHt26tQKzOUBw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org Subject: [PATCH printk v3 24/40] tty: nfcon: use console_is_registered() Date: Mon, 7 Nov 2022 15:22:22 +0106 Message-Id: <20221107141638.3790965-25-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 Content-Transfer-Encoding: 8bit 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 Currently CON_ENABLED is being (mis)used to identify if the console has been registered. This is not reliable because it can be set even though registration failed or it can be unset, even though the console is registered. Instead, use console_is_registered(). Signed-off-by: John Ogness --- arch/m68k/emu/nfcon.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/m68k/emu/nfcon.c b/arch/m68k/emu/nfcon.c index 557d60867f98..292669fa480f 100644 --- a/arch/m68k/emu/nfcon.c +++ b/arch/m68k/emu/nfcon.c @@ -49,14 +49,14 @@ static void nfcon_write(struct console *con, const char *str, static struct tty_driver *nfcon_device(struct console *con, int *index) { *index = 0; - return (con->flags & CON_ENABLED) ? nfcon_tty_driver : NULL; + return console_is_registered(con) ? nfcon_tty_driver : NULL; } static struct console nf_console = { .name = "nfcon", .write = nfcon_write, .device = nfcon_device, - .flags = CON_PRINTBUFFER, + .flags = CON_PRINTBUFFER | CON_ENABLED, .index = -1, }; @@ -106,10 +106,8 @@ static int __init nf_debug_setup(char *arg) return 0; stderr_id = nf_get_id("NF_STDERR"); - if (stderr_id) { - nf_console.flags |= CON_ENABLED; + if (stderr_id) register_console(&nf_console); - } return 0; } @@ -151,7 +149,7 @@ static int __init nfcon_init(void) nfcon_tty_driver = driver; - if (!(nf_console.flags & CON_ENABLED)) + if (!console_is_registered(&nf_console)) register_console(&nf_console); return 0; -- 2.30.2