Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1424835lqm; Thu, 2 May 2024 14:39:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSnkZnrmQwcMFikbABVg/L8fkiFNzucQSV8uBR36uYpOkcInnB2YxNXR6ihhtEWCsCJR+S4P8x6bR0WJVD+dgkFpdR+9+yyzXB5yZIEQ== X-Google-Smtp-Source: AGHT+IFsHbxDLcWCxAKnCpLLsftisbM3Jz6IieWh6CTlc0Hxn0209r14tXlF8s7tzh+k3oauJ5YJ X-Received: by 2002:a50:d6da:0:b0:570:5b70:d76d with SMTP id l26-20020a50d6da000000b005705b70d76dmr398850edj.28.1714685960841; Thu, 02 May 2024 14:39:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714685960; cv=pass; d=google.com; s=arc-20160816; b=XU/Cg63sycZBh0Ci5NEvk8D5lHw0hXWyb52xy085QQr4iyMRn75WxLqlBBYeGQbN/A lyRNlVeaURJDmlN5WxvTEhUbHDptSlQdtbPTjP6q70kf8g0naYnZREMOrBWWSbkHpe0+ ZGD+rG0YmCyLzaNyDYSxFNnfhY80ULaJS/JIxJUeTiQhw9jOKbL3SOsCsk7ushp0nNV5 z8ba1EpbsMXRh4FPqLi/EtgHmyD8ZZr1J40ea/4JywMgGQstqrKr2Hli63MeZkPkKMtR vITm/NOrH6vyizpt5S7zaaMiL9YaQ/5g1FHasBX5nS94Zg26TXc7LVaBsGVpUuP6ImiX AHMA== 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=FGxVNv6QbVc1S9vlUzY53XnVo+kA+8x3wI8r9c33MRA=; fh=/NZX815RJy/ecOe1WbZ023sSZUJKZnpaeIZwQG5Ym7U=; b=ISfungT0xiDGzQWYTKAE+/vJQi+RlXnFMaTSyv38CMaQGjuF1kM1NQP5LGt8KYnj7D sUwwMEZJs8x9T254jgkGM1rIzoYWixXfJAduHV2NuiXsuJGQkv3xkPXikp6FZC4+ojaf vTLdyq3pq/i8K5WH4QetsbTOLJOLrTs0G/QKDCjMUmfdQexZK/4NAMWpdFuOaQgvt/AI anouBsayIUbqi4aRjJ++aWHXiUJL6K6kDcFhutBbwK17TKgbzdw/fHCJDQdaFgHhx215 0bGwszkFNnV+zjlXj7PfKDTWucU0t0xYQQ0gMpqWlwcDNtgd+gGyFX8oW91oiWFjlGMK /5HA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bsMC1Ueu; 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-166954-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166954-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c28-20020a50f61c000000b00572c0474fe1si868897edn.212.2024.05.02.14.39.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 14:39:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166954-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bsMC1Ueu; 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-166954-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166954-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 A062A1F20A9C for ; Thu, 2 May 2024 21:39:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 322ED199EA4; Thu, 2 May 2024 21:38:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bsMC1Ueu"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sLAhE8DK" 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 E58FA180A9E for ; Thu, 2 May 2024 21:38:46 +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=1714685928; cv=none; b=hoZFcaZ4GuHe7k3MyV/juMZD/VPBeCwIZZf3sq36CEs1nlrkYjaoUP1azMN270A0fB2MWDmeOK11aRr8obAqEHP0CgC7PjpCb2iSGRSAFiVx2Vm3v1fd3cgWciEcTrVc4RV5hXtueBFcm6HtkqNUkyqnDyEbxudcVvwJES964Z4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714685928; c=relaxed/simple; bh=y85BCsAtj/oIZY53Aq9gsvAF7SkfMiwPpUsNnn9BKuo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZmW/2POr3PYvW3mA44PtfXeBO4q02YXrWmiqSHCMaVOK+iJ3nOjWhZW5j0f2fEVB5tQCm6swhGAf26iuU6JI7dfjyUo5MSKDuhitO0nHbV/9J5AflWuMBsuufS2mJ0hRKwA7CQ6uADIPLadgpkJ/kOGUN2JT50Ds+lEBwxj1ltE= 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=bsMC1Ueu; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sLAhE8DK; 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=1714685925; 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=FGxVNv6QbVc1S9vlUzY53XnVo+kA+8x3wI8r9c33MRA=; b=bsMC1Ueu4QL/FV59npAdNDqzjpmrtAZ/POtmA+9+31VgEJcbUkZVSXB1XCdgJzS/rluA1S HjyGj9VEARxYxNXk0SacPvw+9hMpc8wxkSPDvjwY1sVDZavR/vczJHCkYxnzwnQNJJKk8p w0f2CcIOGvnbGxTw/PsCWAsXvfi7jMdKyM9gH0BtaSZT5Rnj2K4to26/3mtJx+AJRbyn4/ i/gE6H8wdBpJddjkzxleoaK+Gr1zTHOwM4PkZ4uy0P0l53yFotSmSJ+MHabUZTUn8cuRzN FgtAEDlhyHaozi/tmr/0rtBGXCRDfbXWjbyA30XconxFEw5QyRvbRy9Rgsk60w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1714685925; 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=FGxVNv6QbVc1S9vlUzY53XnVo+kA+8x3wI8r9c33MRA=; b=sLAhE8DKrpSZfCWypbS8O3IlmQ1SjOC8VGrelZOUHpUgdr+8ZFlpVRafWA5RHb2efqBe1R 5kFjsNXIIThrkHCA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH printk v5 03/30] printk: nbcon: Remove return value for write_atomic() Date: Thu, 2 May 2024 23:44:12 +0206 Message-Id: <20240502213839.376636-4-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 return value of write_atomic() does not provide any useful information. On the contrary, it makes things more complicated for the caller to appropriately deal with the information. Change write_atomic() to not have a return value. If the message did not get printed due to loss of ownership, the caller will notice this on its own. If ownership was not lost, it will be assumed that the driver successfully printed the message and the sequence number for that console will be incremented. Signed-off-by: John Ogness Reviewed-by: Petr Mladek --- include/linux/console.h | 2 +- kernel/printk/nbcon.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/linux/console.h b/include/linux/console.h index 779d388af8a0..54b98e4f0544 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -327,7 +327,7 @@ struct console { struct hlist_node node; /* nbcon console specific members */ - bool (*write_atomic)(struct console *con, + void (*write_atomic)(struct console *con, struct nbcon_write_context *wctxt); atomic_t __private nbcon_state; atomic_long_t __private nbcon_seq; diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c index de260531b0da..dd7c3180b335 100644 --- a/kernel/printk/nbcon.c +++ b/kernel/printk/nbcon.c @@ -849,7 +849,6 @@ static bool nbcon_emit_next_record(struct nbcon_write_context *wctxt) unsigned long con_dropped; struct nbcon_state cur; unsigned long dropped; - bool done; /* * The printk buffers are filled within an unsafe section. This @@ -889,16 +888,16 @@ static bool nbcon_emit_next_record(struct nbcon_write_context *wctxt) wctxt->unsafe_takeover = cur.unsafe_takeover; if (con->write_atomic) { - done = con->write_atomic(con, wctxt); + con->write_atomic(con, wctxt); } else { - nbcon_context_release(ctxt); + /* + * This function should never be called for legacy consoles. + * Handle it as if ownership was lost and try to continue. + */ WARN_ON_ONCE(1); - done = false; - } - - /* If not done, the emit was aborted. */ - if (!done) + nbcon_context_release(ctxt); return false; + } /* * Since any dropped message was successfully output, reset the -- 2.39.2