From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55D20CE79A8 for ; Tue, 19 Sep 2023 23:09:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233522AbjISXJY (ORCPT ); Tue, 19 Sep 2023 19:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233128AbjISXJQ (ORCPT ); Tue, 19 Sep 2023 19:09:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9368C4 for ; Tue, 19 Sep 2023 16:09:10 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695164948; 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=fFf1kFlBgEjf3N0WbcHTHhbAP/Zmjn3VBhye6lfUWfg=; b=Ji/Nc38yfLVaVLklKC8ElmecwukK9eYHd/xy+zRdEHUz1FlAV5pEXIJiRvrf92e6/AffdU 3xSJZ9Rmc45lH6uh0CZvwv6VUYkSCGWl8Y3muVrFyNtA9tMp3vgrGqkpU2otzGFlzyPrnU aF72eJLOGgDavU7eZAugt5TQywfa+A4gIBvhsrh2MooZO735vePLxRGKGQZON7CSknjmWt G46xk49I3KWLkkVTzifElnnaTT13vJjniJlmQTeEwB2dGAQtzrlQ3jxX2ZBJIVf+RzXI2v jiSMfDQLTD2/3kQC1xOiLdWgn3W+w9Z9vKc0aOesag4So0OJvmSeaSf9EB8GqQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695164948; 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=fFf1kFlBgEjf3N0WbcHTHhbAP/Zmjn3VBhye6lfUWfg=; b=X8lELKW72ir/HEJ6adxk6nez4Z4oqG/cjZChnCPxzeFYkIeq3RqfDNN27LHnpOW3wYlgjY M5XJwZRtIwTzaFDw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH printk v2 02/11] printk: Let console_is_usable() handle nbcon Date: Wed, 20 Sep 2023 01:14:47 +0206 Message-Id: <20230919230856.661435-3-john.ogness@linutronix.de> In-Reply-To: <20230919230856.661435-1-john.ogness@linutronix.de> References: <20230919230856.661435-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 6e8c1b02adae..69c8861be92c 100644 --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h @@ -80,6 +80,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. @@ -94,8 +96,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