Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2361558lqz; Tue, 2 Apr 2024 15:25:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV1TuLkU3oEE/VeHHBknwtXepz+sU86jbBBi4AhzUDUx6/0X1Dj6AZL/stmIog5ZM+Qa8KlJMq+YM33SVBIbYAmhAfStOGNTVFocKoJ5w== X-Google-Smtp-Source: AGHT+IFaKu6NQIAjPfSRR2JhH1VuFsXIrZz2KzN5Xci68pJEhCi03JjdmgSL1BMBbxtMKb/pU4xf X-Received: by 2002:a05:6358:5311:b0:183:c2e1:9b4a with SMTP id n17-20020a056358531100b00183c2e19b4amr943600rwf.18.1712096700546; Tue, 02 Apr 2024 15:25:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712096700; cv=pass; d=google.com; s=arc-20160816; b=Evp3Q2q4cmF4tWAQtcEEl1DhtFbeuGH69OCxD4Kf7D2JKJHcbFdJkRCwvH40272UQH F4wyHpco91M3ppt/HBveOWwUdnjQUyEDH85gUkhKyJmyqJuQLJgTKh4N4G5xAqFmye8Y vCrWQjex82foGZ9CvI2L8d8FjYjZYIbjGycsW+SBLHIbdwnwTt5gcpBc1DnMp9vOYhqD MJ7FcgOHwZ4hViq5hqiduoqKdMvn8ONKCIa+9sOMLLfcORO2Z0u38dmZWBgLFfD88OKp nPvUMiuWB6Q3+iuhVgq1LJCtQLVoviITpO3TmqFT8byKgcN5YzEA3epCWTChhtobCNib txcw== 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=nd9y0ptddjz3VGhzIqvJOBfqj/DRxNA65wb3bV/cuvY=; fh=/NZX815RJy/ecOe1WbZ023sSZUJKZnpaeIZwQG5Ym7U=; b=Dh7lJh2+R6AXGXAfKP+Ig8w5qUO50S3X1n342Zh6mdPIuaTZCH12/Q0LXlNUSZQdbT sWQxoCw8vmz08ZKB/Sib0YS52wD5hR/LSwaqqKNNs4Dlt1QldA8aDRAhV89T5xUaWY8M cpfRypJymgZaRZRzy2DzVd7PPl/B8jOkxKgqyg702rrCfyLQ4cNSnbYnVXUKEUb3Dy37 iegwC+X68GmoadBqKXpBQo30P4BCzAp1pg8FT5vV72nGQ2yCWvhxAfw8tSDysLq0xoiP LMv0tBmeHhg/wooya63pld//916JFds/MnYsyv1BUSpfAr9rmK69phPd4/mtVAgYfoh3 Pw5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=gOta4gtJ; 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-128762-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128762-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 67-20020a630046000000b005dc8719cdfasi11935060pga.298.2024.04.02.15.24.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 15:25:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128762-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=gOta4gtJ; 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-128762-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128762-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0B125B249AF for ; Tue, 2 Apr 2024 22:12:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C705515EFA5; Tue, 2 Apr 2024 22:11:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gOta4gtJ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GTrtdyTu" 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 568E315E816 for ; Tue, 2 Apr 2024 22:11:35 +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=1712095898; cv=none; b=OAEMZcmsRUBe3aIjGuVFq5rEoqrOLr3G6jLQMV5IbI70qMQqNP7IXYl6RoYzuJpF6bjSr2Iv1hhSIGtkMgFkBwh76mRcPEBfNNlDKOB73UTYfbRV3XD3EgRXtPIr+8fiRQz0j1/wx7DO51G+AI4VvbQnI5OqP01sdJIepqbf/8Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712095898; c=relaxed/simple; bh=/0MxrjHFyOtBJDmRT8XjtwDOoZX0ohrlr35f/aHxS2Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kRoIrKynzp0zcsh0dYv+pvupsWUY9w5XfofFZ/xdHXIl5cEYa2ND3H/F0+5qhtAsKs3LhOYGfvZdH7vkybkciiMI2qmb/oZHOcFYsIh6mnf7TTzO83CJm0T9Kfyjb1GhTHG78JNjRreJMxtpsCXH8v9//WEIaDW/B29OHKE2KxA= 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=gOta4gtJ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=GTrtdyTu; 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=1712095894; 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=nd9y0ptddjz3VGhzIqvJOBfqj/DRxNA65wb3bV/cuvY=; b=gOta4gtJ6uOdbb3XFjZVywi1IvDppk6CbumLId+in4AwYsVieFFT+PYirKiFMMe4Mzz8ch pefePFlLqWzztw0pTBLkydiQln1mOta1CeGkIt9KVNdrq5E7cSWoa+2qrYbFHt6JrksOmo BW9D4/6diQ4BEnVzR5wzucq4tj/0prwaTEvpBlJMTzw3k/+DVGYxLhHf9/lI30illfAa/L cjvT7oSblViUYWH1L9oDdtkWpsKClXo4DDJ+EVE5oFzJt5lx0UcXtMQ+0EOMwTNFIXP5Zb P3MQ4UjmRjj+0ZqKTlztnzYl92IsKonFCbTEwTdHbMltmzsiCdelGDPILgx1kg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712095894; 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=nd9y0ptddjz3VGhzIqvJOBfqj/DRxNA65wb3bV/cuvY=; b=GTrtdyTuYj3sX6Q/3QBdgs9fFHNA2Q+XV+aRiRWhbH94gb/XYQGrNiMqm/smRpRv2sSUtB KdMOK0sxfTd7pyDg== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH printk v4 03/27] printk: nbcon: Remove return value for write_atomic() Date: Wed, 3 Apr 2024 00:17:05 +0206 Message-Id: <20240402221129.2613843-4-john.ogness@linutronix.de> In-Reply-To: <20240402221129.2613843-1-john.ogness@linutronix.de> References: <20240402221129.2613843-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 --- 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 d741659d26ec..2516449f921d 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