Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1876879lqb; Sun, 26 May 2024 23:41:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUt1DJJDyU4WgsjbE72xxmmvrHtuAJnOU2v0WJQ2vNrYtOwdC41+bl9XH8UEgZXBI9+yYtXuGUyvw5edib9C9fwSQm3t5vDdUHXpIhUVw== X-Google-Smtp-Source: AGHT+IEx+KqCmMrjzWqPWCY4F94C1KeD3m4FSKn7fHnzJkLkaNdJqaDfxznO1mpCO9F8A49rNkHt X-Received: by 2002:a50:a45d:0:b0:578:632e:6794 with SMTP id 4fb4d7f45d1cf-578632e6d9fmr7216131a12.10.1716792072599; Sun, 26 May 2024 23:41:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716792072; cv=pass; d=google.com; s=arc-20160816; b=t6VSFKIlSeobjOqVWg1G1xiyrlPhatvs3nVaqy8aICxCHoaafy9KJfclTPp/2jkHbu fgNBRehUmiAV/CEwQZj5r91969PaN3h8OpeGIL2sl5ZVIIjq3MMPYZQvv62V6YmRWU3f HevErO1CqjPlIE3HLrdGzPOWuwqZwOrshxBnWMWoX+40QM0PVXW60tNq7siFITBo699u m8u9FhS5rZ6DumdYt/O1GomzfosFQb7YdsAFCk+E/KniUpldFzsrmmeHSGvaQyzfyEh2 vRqbF+xPCl1HPPh1CFwDmBzUiHuGfUPBS4Jl6PrqrAOgfu6x3lmdPo6ly5wSKioe2dYm AJSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:dkim-signature:dkim-signature:from; bh=gIB/C0kn4U7fgTEgQsG7CoHVIr2JrRBBOwabsQzPu5A=; fh=pKnPKUsir0uEGSsor+4Zc2vgbu+g+ayvUgsdzkuXaoA=; b=nZlNp6ithWgrV2auItPaScgf+ccmNWXFCd7t7FsbSqtT2SkWz/5tP6ZGkzkGnqETt8 6fF9grDhB/uWgReTGS6ejx4PksuToqal/7fU/BPXfV9f1nuM6CkJvrHNrj6Jn/iSufwW LsHXK4VJ6GTVSaTMSzKgmb/sprtMhVSGrHnSWLWdrgjAtYUJBoik1074WindgcXGtTK8 6mZuP2DoqJ5liU+Ix+TE2tQs1PqHlzaaWfpXxVhR8nLcGc5BhggWGuIHetPvvVGMqhQF 309+4Wmlb/BtgEqEvwhedCPHz9YxI+lbu+60v+nC1oB72pQIq6qChRwbjgsKt3zecNLr uK0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=prLPqaXY; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-190089-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57868f69171si2417317a12.683.2024.05.26.23.41.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 23:41:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190089-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=prLPqaXY; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-190089-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4B72F1F21086 for ; Mon, 27 May 2024 06:41:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F07D13AA5F; Mon, 27 May 2024 06:38:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="prLPqaXY"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lwTrE/7f" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1903C4597F for ; Mon, 27 May 2024 06:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716791906; cv=none; b=Zs3C6ElnveA3IiK3V+FlVJiCDW4T8TPyzb/OAfZu2LiGh4nOsVaCizB6MOWPYQMA/xWxD7M/NB2HSiC3RlGDlUF7PCG9hAlVPg9K8BJZW0mUnGXkYhyAko4rn9H7qXtHcVybxQ6LUqV/CdsWiWNmoOy8SLvtAAyRmyNzjqdF5U0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716791906; c=relaxed/simple; bh=lwK7GcrDHEjSCVMCl6fH9fAyvwP+TuECoQz0KJrspIs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EBYGl4ntQRRvgVilhe451W31T1vIuSGV4+Ag3wrZY9ENLc1On4imuynLOmXQMYsNxzByvf2h7t7waML3aeX8LTdClYFFscXYCvJjnqOMqHknRxoT4epbEHh8zt87a5fRr8EUZr+rULC5xrCKRAhnrBVt/tXqtkSMfxOO7LcGxNI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=prLPqaXY; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lwTrE/7f; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1716791902; 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=gIB/C0kn4U7fgTEgQsG7CoHVIr2JrRBBOwabsQzPu5A=; b=prLPqaXY/YwLg18ps2ATzjroIHoOJyl8e1ibma8O9cTQJXRP1Cjk7ZMBB35DbQ3cej9yn3 QEYGg8eXC+VR9BWb/xHw/E6fJSLCuiK3ZbbsrOHap1+tWwtHTgptypGdjem+0WVGVOoYjL cjGAVLVl8fmf7PLV9ykK0xNc3a5050fUPSb4TPuJdggKzIP0x3VOHfNF7Vm+9PkXoF86rj Ci9CEUDg7eqa7v8pjgvNHZ8sJ+GvXtrRoBH+70niNlohmEHCzmLet13UysEOhsuuK+65qE I/YOZC1f0tB4LqduIji/xSVfhY550Q+eNjdBCDuIMUnlUlHu0tsWH3MMrhbwJQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1716791902; 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=gIB/C0kn4U7fgTEgQsG7CoHVIr2JrRBBOwabsQzPu5A=; b=lwTrE/7f/XOHeBAl3/9gxDZ0udiSbhCfuTHx0npOCRd/B6GNSbaE9lDbrS1YK53WdAKlXq 6GjO2SQO18TgYlBQ== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH printk v6 16/30] printk: Let console_is_usable() handle nbcon Date: Mon, 27 May 2024 08:43:35 +0206 Message-Id: <20240527063749.391035-17-john.ogness@linutronix.de> In-Reply-To: <20240527063749.391035-1-john.ogness@linutronix.de> References: <20240527063749.391035-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The nbcon consoles use a different printing callback. For nbcon consoles, check for the write_atomic() callback instead of write(). Signed-off-by: John Ogness Reviewed-by: Petr Mladek --- kernel/printk/internal.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h index 339563dd60bb..943e8f083609 100644 --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h @@ -87,6 +87,8 @@ void nbcon_free(struct console *con); /* * Check if the given console is currently capable and allowed to print + * records. Note that this function does not consider the current context, + * which can also play a role in deciding if @con can be used to print * records. * * Requires the console_srcu_read_lock. @@ -101,8 +103,13 @@ static inline bool console_is_usable(struct console *con) if ((flags & CON_SUSPENDED)) return false; - if (!con->write) - return false; + if (flags & CON_NBCON) { + if (!con->write_atomic) + return false; + } else { + if (!con->write) + return false; + } /* * Console drivers may assume that per-cpu resources have been -- 2.39.2