Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1425689lqm; Thu, 2 May 2024 14:41:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXe07B0qhiPTAWNxexYELMLDqcLVoLWBDHkYzqtCGWLjxa4hXvAP/QV93vqjiQWFJprZZDsVm0xIm94Zraux3IujVIbbNnAGEXFoL5baA== X-Google-Smtp-Source: AGHT+IEOG4qpzLN7xPIu1AMRkbBblN6njhMuKXXbgBNsnAKBdQ57uojJBiZ96pPYrQDqagHO1jHc X-Received: by 2002:a05:620a:19a9:b0:790:9be7:6ce0 with SMTP id bm41-20020a05620a19a900b007909be76ce0mr1124150qkb.16.1714686093082; Thu, 02 May 2024 14:41:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714686093; cv=pass; d=google.com; s=arc-20160816; b=mjHb153kU+9+CS2eshX5C4fmBj8Q6Il36Piiu2oWnfkYlhAa8Q4FVFc0F6w0yIi9Dx HljYOHE1lFeE+AFKp/uROFjxMlAAmJI7Out3VH+XUpXhEqMZXG9R3WDDjmJZrKeYHnDf w9Xfkv2Kyx2a0qgx6G+HIS9EmO+ebCuTW7KQZblaZtR7UOSfnoMFA3GUogM3V0mLim9E 4cpIpLb3Id3HYK9RobLP/zVp6fW0nXTvJXAi6UMNdG6CwKEQtbaZPiQqSa4bVoEla3BB iCotyE7GqGUplAAUdPOTXLLCZZfew9NJwLVoHapDpoVhaCft5OMuYkXwpdNPD6eaQQbM 125g== 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=xC94fAGzNDSMaSw1pYegQqX9UTsMarUM5SutqWauIiEgL+PW2erKwAHttc1X2td4hF 5By/zhmDRP5KJOyN4/KTjaD5SOzRwHSTEthSJ9GW3oK5tdFK2q/1WYWn+UAxxsVGYZ2x RvIlvyABaRDDXfsWZuUSgb5B/HLA3itAI/iRnudQX7tcbL3u+4RSNnCPOEmmdVvM9KVc MwNkAj1nTYfW4QD+UELUkGidxN1FHwnQQJWK+NEV3MrCxOKvs0ZBZo20rU+gY02N0HyV 44CdbJI8XXEUtxuI52GOdw7pYwCd3XEysmIPHtrEgikPD4ABvsCtjoPoL+nSSRFB2vn5 44fw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=aRCUgySs; 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-166966-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166966-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dt21-20020a05620a479500b007927b455dbasi1070858qkb.677.2024.05.02.14.41.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 14:41:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166966-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=aRCUgySs; 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-166966-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166966-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CB1931C21EAB for ; Thu, 2 May 2024 21:41:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A12C1C9EDF; Thu, 2 May 2024 21:38:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="aRCUgySs"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bBEygG+t" 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 01F851C233B for ; Thu, 2 May 2024 21:38:51 +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=1714685933; cv=none; b=J6AqXmyMzuifBRQUpzcsaO4lx9y3KnMaggDe4W5/0lRNB9BucuMPYzWLGPoQcU9YY/SZSsu4Xah8p0ZqMIU6F3AIQt4RexiMN1f/FiX484GgfnfZtpQg3bgQ0s2/iZe/Zmi9IcOOomOt1X1D3rFVxdJtCYVAwR591sGS5xuLSFI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714685933; c=relaxed/simple; bh=lwK7GcrDHEjSCVMCl6fH9fAyvwP+TuECoQz0KJrspIs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=swPlsRww6YpA9FwWaWN8WpvZbVGQqOL2TSgWsFc6ArTzWbrxw2c39m8UZ8KD3MJaUeHCtqvwN6+GPnIU+q7if/Awuf8E09v95mnujlUKvWi06h7q5nKYXABVzLqImkaNxBVNvi/mpl3JwMTGc2wcD8UDp6/hKC9EArk+1CC5QoU= 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=aRCUgySs; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bBEygG+t; 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=1714685930; 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=aRCUgySsgIMJPdkX8w83I6XtQKM9MpLdM6TI+yT9ThD4ktEvVJnqNLeguPv6YLzZUxxb+c Bztr3PrEnd4upA89FdjBv1Q9Rb85zJ8XRtUjzf0DHaKbxduHe/V3NxAM080s56WDnyvskl MUsPrX5WLHLX4FndYzXvdyegCdm6ysiEJ1KgYbTp37NRk7lfkRhOVLsTmQxuDYh/Np0mF4 49FlaFL3CgTM0ru92r5wfiYze7megajaQOcnfvK8x8LZFeMjCr/BqKy1zLfL3vHdYDqdts uIWTzKL2CAKcf5kCHKCyv28V2SurryoiRzSXcOyHds1UNrYORKhs8/JT7+grDA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1714685930; 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=bBEygG+tIrdX7FBVduKNWeDSAUMNudEJd1sOtzR6U/D3E4AIyEkPwtD52glTUiabrv3W0U Z8pUERObNzgqokCA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH printk v5 16/30] printk: Let console_is_usable() handle nbcon Date: Thu, 2 May 2024 23:44:25 +0206 Message-Id: <20240502213839.376636-17-john.ogness@linutronix.de> In-Reply-To: <20240502213839.376636-1-john.ogness@linutronix.de> References: <20240502213839.376636-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