Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp705733rwb; Thu, 10 Nov 2022 06:29:33 -0800 (PST) X-Google-Smtp-Source: AMsMyM6cQINcnVeYzyNvajTF/J5MBvFc7FTn1sbMhrUJAZ3LpHijgIDCLVaVkwWB19O3rY9SL6Al X-Received: by 2002:a05:6402:1f13:b0:461:e0b5:8402 with SMTP id b19-20020a0564021f1300b00461e0b58402mr2436780edb.189.1668090572874; Thu, 10 Nov 2022 06:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668090572; cv=none; d=google.com; s=arc-20160816; b=ujuDjpaTmuLDmgYtT0QqTNuy1A+I4dDZ+JushHlV8DKxNDB0I/AkNhxGclBg8MXGWg mjrnlgdKGmtmyytZ4ghuY7CaxAFFvJOCl2gzu3xvAYGBQi6oFrWlSmTPa3g1z8fTdZDu 9fTxzd6bJd4I+hHIA9e0GJ1QySHoy13307x+ftoFnvOav0k3fQX3baocbVX7jHeGe6K5 GsNAi6GnUSXU8ETvbTuuaPld9+ylVcPaq2Ltfax5RXO5BQxQuL3BpiFoyrXln99JteuU pc+IY70L6UEegl45XYZn8gjLzcre5HI/JFGa1omBJ7JCaQVv+JiZuTNR3TBBgyVz9f8S K5Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=CLHBQggQls4mWIgeZbw7Mj4Foog8Zgpi+AZP3I0LDjo=; b=phrJG0GQLkWVQItoOIbGdXVzJHTQRzhSDk3nAvWTrqE3Xp4LHvseS456YQ2wYx8dne CoflX8nUOP9hq0oktTsW29aDsKPLBFLMcvUKe7kw+PZ0ZouqtKMyLmNBs4VVGbRX2Sr0 36d4zGvc99il9obv0hTb7TkFun9oGNjkAcQhfvYmyPs3gKNmlsktnHKdxBhoFC+rHDQi Ip88N910z5u3kHpg37J00CnNvNb9yP2u9AuEVuP2ciqtMtL1Ayzv1tBjmF8xHEUwijF7 HrbVgyWf+Be4BKhg+iieqlRlNIfYF7QswuqqZTungUx2og2KC2k+UF6lK2HJFCX6OWKj 1rTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TeyzoeMB; 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 hv11-20020a17090760cb00b007ae9f42f878si4170895ejc.354.2022.11.10.06.29.09; Thu, 10 Nov 2022 06:29:32 -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=TeyzoeMB; 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 S229960AbiKJOTH (ORCPT + 92 others); Thu, 10 Nov 2022 09:19:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbiKJOTF (ORCPT ); Thu, 10 Nov 2022 09:19:05 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9871165AF for ; Thu, 10 Nov 2022 06:19:04 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668089943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CLHBQggQls4mWIgeZbw7Mj4Foog8Zgpi+AZP3I0LDjo=; b=TeyzoeMBsyYpwQEcZ7EWDcxKdM1GA5YG3rA9Rd/s6Mj/hMRJt/CpMZqEY2AONXSU5QtyvO PXdvYEzwGP3Ulb+OiWg35ZaYuNuAI3CHWUqqEPfBQLNfvmOQ/ZXjJImfXkGx7uy0XfTQWA vmtCMPHTIqnf8FO54hbFouDBVPzGZ69l2EBCngFRZNG9G1I2tpXDMAO1QHwU968mx4yzod HXi5s97LggtkkmtA56Lwre1sjoZRcHFgJVMPKk8B1dzPVlGI31nSoS8gV3GOhutszYS7WC tFXYCVanN6ah4JTrlmFUNPzD2QkKPYd2rL2q+btcRzXBjjzUkvooQ2dN6jXKPQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668089943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CLHBQggQls4mWIgeZbw7Mj4Foog8Zgpi+AZP3I0LDjo=; b=XVCMkXBronBmd1KX+rOaAL7HrZZrturZw18aI93S+jm3mmMSItyqIEZXc2Qx33a+nZGgqy nib2Diw68mRskRAg== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org Subject: Re: [PATCH printk v3 24/40] tty: nfcon: use console_is_registered() In-Reply-To: References: <20221107141638.3790965-1-john.ogness@linutronix.de> <20221107141638.3790965-25-john.ogness@linutronix.de> Date: Thu, 10 Nov 2022 15:25:02 +0106 Message-ID: <87cz9u6gfd.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain 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 On 2022-11-10, Petr Mladek wrote: >> 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, > > This causes that register_console() will always put the console into > console_list. It causes regression, see below. Agreed. Nice catch. I will remove initializing with 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); > > My understanding is that this should enable the console > when debug=nfcon kernel parameter is used. > > It is a non-standard way. This is why CON_ENABLED flag > has to be explicitly set. Understood. I will add a comment explaining why CON_ENABLED is set here. >> - } >> >> 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); > > This calls register_console() when it was not already > registered by the debug=nfcon early parameter. > > It is the standard way. It should enable the console only > when console=nfcon is defined on the commandline. Or when > there is no preferred console and no console enabled by default yet. > > We should not pre-set CON_ENABLED in this case. Agreed. The hunk itself is OK. John