From patchwork Wed Feb 4 00:09:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1804 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770163863; bh=XyH4atoaSyars/9TMhgPzDXshzHmK3u2GbyI3gZYRoM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=uyqwK/CqDSE/dM2FDHzMgB9zH9rgyTMCs9H7om4ljFP0Lbzo/FScnvUsSnRxaaijO cYa3+4djf6qA/WVnbnWHnT7Gv3MVFma5Jis/p/4K1b+yi04j7JkcgC7YTW0bvksJc/ x/P9QGSpwe5gGRqn2tkJp8iX1EXac/x73TZrSPDUAGWDZT0y0n6Fe7YHhxUaqiBnak iGBe+eHXDbAnB8434QGE/7PUi487cLNs2DJopwIldjewq6N9lyCvxbuUucZrjl2eic 3Zn/iToebmnNXS0OKnDgnjJ0tfQof30/g/OPav98+xq14D9md5t7hsn35XpnARcTMo fb9aghYfVy/nA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9974A698FD for ; Tue, 3 Feb 2026 17:11:03 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 2u2RDgTF_HxF for ; Tue, 3 Feb 2026 17:11:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770163863; bh=XyH4atoaSyars/9TMhgPzDXshzHmK3u2GbyI3gZYRoM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=uyqwK/CqDSE/dM2FDHzMgB9zH9rgyTMCs9H7om4ljFP0Lbzo/FScnvUsSnRxaaijO cYa3+4djf6qA/WVnbnWHnT7Gv3MVFma5Jis/p/4K1b+yi04j7JkcgC7YTW0bvksJc/ x/P9QGSpwe5gGRqn2tkJp8iX1EXac/x73TZrSPDUAGWDZT0y0n6Fe7YHhxUaqiBnak iGBe+eHXDbAnB8434QGE/7PUi487cLNs2DJopwIldjewq6N9lyCvxbuUucZrjl2eic 3Zn/iToebmnNXS0OKnDgnjJ0tfQof30/g/OPav98+xq14D9md5t7hsn35XpnARcTMo fb9aghYfVy/nA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8690769911 for ; Tue, 3 Feb 2026 17:11:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770163861; bh=i0aXs2s517a07u6JF7Ko58sdUQt2FbYOqL8RnXNKE8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JO9DR/bxjVsq5scnVJFTDiioErw4oO21D+uO7yzXpqlIeJfE3KHhWZc8eppp93Y3P VD8hpzgKqfUc1rJ+fODg7CR7HuLKQ+Fc/FEkjTXLyBmbpjEwrBMBVOY/LYr9FpvP1j acrK7prL6zskeyKUNS45EA4PAcx1wbthBzB0zjB9MPNtOSaihEV4zNTSTDKtNUOhVM WMsSsldksx+vhymu6P/xxIEuewi6HzbYneEDAtdJMdVSEJeh/Hjvi8ac95RGLYvuIl LLjhYxqYsxkO880JriGuLdghrQKR4m/Uhk4qrlF7sT6yNkQzfZiJaP/AGeKsW9rp/x 47jgeUi3WBIIA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D3A78698FD; Tue, 3 Feb 2026 17:11:01 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id sYiAHVhbSelN; Tue, 3 Feb 2026 17:11:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770163857; bh=GRYNnLC42C0RcLAqittkwAOlCYjvjzryLV0qyRsmfqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MiilDDLzUOiW0bRcsMEgC29EaUaen29scqjD0ClNh1z6xfPP/DuoLlZ4dICYPl0hA Bg0n/yCRcW9eWI8z4w+TMk0f4XLorXbb8lx0ftijq9nPfvjQSA8rsNny3Cb55bikmw 2Op75MkRRHRP3MPs55mOIUsBeD3VYtxwuj+odZXELAtDSF/4SgCnCIHTCMhwGUKjOx C5bQaJCQTDK+OX+QdS7ctqxhp1ir/kJTJ7rrYhTGZewupGAnOymyYxVa7Yuxu76Ca7 gopwzb1Fb2iDXfw1LJFUmKx9UAQ19tGAu1Epz+MwnxUpa7g/ni4bacFiDXt/xeltII 1knw4UifGwmsg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6FAC069909; Tue, 3 Feb 2026 17:10:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 3 Feb 2026 17:09:54 -0700 Message-ID: <20260204001002.2638622-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260204001002.2638622-1-sjg@u-boot.org> References: <20260204001002.2638622-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6VZSXLV7XAHSBLJDHJT455GK4WLIITYM X-Message-ID-Hash: 6VZSXLV7XAHSBLJDHJT455GK4WLIITYM X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Sonnet 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/13] console: Shorten the console-error-output function names List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The current names are quite verbose. Rename console_puts_select_stderr() to err_puts() and console_printf_select_stderr() to err_printf() Co-developed-by: Claude Sonnet 4.5 Signed-off-by: Simon Glass --- common/console.c | 6 +++--- drivers/video/console_truetype.c | 6 ++---- drivers/video/vidconsole-uclass.c | 21 ++++++++++----------- include/console.h | 8 ++++---- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/common/console.c b/common/console.c index fbf2c875428..f9669a0e028 100644 --- a/common/console.c +++ b/common/console.c @@ -311,13 +311,13 @@ static void console_puts_select(int file, bool serial_only, const char *s) } } -void console_puts_select_stderr(bool serial_only, const char *s) +void err_puts(bool serial_only, const char *s) { if (gd->flags & GD_FLG_DEVINIT) console_puts_select(stderr, serial_only, s); } -int console_printf_select_stderr(bool serial_only, const char *fmt, ...) +int err_printf(bool serial_only, const char *fmt, ...) { char buf[CONFIG_SYS_PBSIZE]; va_list args; @@ -330,7 +330,7 @@ int console_printf_select_stderr(bool serial_only, const char *fmt, ...) */ ret = vscnprintf(buf, sizeof(buf), fmt, args); va_end(args); - console_puts_select_stderr(serial_only, buf); + err_puts(serial_only, buf); return ret; } diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 25df22e31b0..913ed4208e4 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -441,14 +441,12 @@ static int console_truetype_putc_xy(struct udevice *dev, void *vctx, uint x, last_cp = pos->cp; kern = stbtt_GetCodepointKernAdvance(font, last_cp, cp); if (_DEBUG) { - console_printf_select_stderr(true, "kern %c (%02x)", - last_cp, last_cp); + err_printf(true, "kern %c (%02x)", last_cp, last_cp); } xpos += met->scale * kern; } if (_DEBUG) { - console_printf_select_stderr(true, " %c (%02x)\n", - cp >= ' ' ? cp : ' ', cp); + err_printf(true, " %c (%02x)\n", cp >= ' ' ? cp : ' ', cp); } /* diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 3d440e8e672..fc2b443d0bd 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -122,7 +122,7 @@ static void vidconsole_newline(struct udevice *dev, struct vidconsole_ctx *ctx) ret = video_sync(dev->parent, false); if (ret) { #ifdef DEBUG - console_puts_select_stderr(true, "[vc err: video_sync]"); + err_puts(true, "[vc err: video_sync]"); #endif } } @@ -333,7 +333,7 @@ static void vidconsole_escape_char(struct udevice *dev, ret = video_sync(dev->parent, false); if (ret) { #ifdef DEBUG - console_puts_select_stderr(true, "[vc err: video_sync]"); + err_puts(true, "[vc err: video_sync]"); #endif } ctx->ycur = 0; @@ -460,11 +460,10 @@ static int vidconsole_output_glyph(struct udevice *dev, { int ret; - if (_DEBUG) { - console_printf_select_stderr(true, - "glyph last_ch '%c': ch '%c' (%02x): ", - ctx->last_ch, ch >= ' ' ? ch : ' ', ch); - } + if (_DEBUG) + err_printf(true, "glyph last_ch '%c': ch '%c' (%02x): ", + ctx->last_ch, ch >= ' ' ? ch : ' ', ch); + /* * Failure of this function normally indicates an unsupported * colour depth. Check this and return an error to help with @@ -578,13 +577,13 @@ static void vidconsole_putc(struct stdio_dev *sdev, const char ch) ret = vidconsole_put_char(dev, NULL, ch); if (ret) { #ifdef DEBUG - console_puts_select_stderr(true, "[vc err: putc]"); + err_puts(true, "[vc err: putc]"); #endif } ret = video_sync(dev->parent, false); if (ret) { #ifdef DEBUG - console_puts_select_stderr(true, "[vc err: video_sync]"); + err_puts(true, "[vc err: video_sync]"); #endif } } @@ -603,13 +602,13 @@ static void vidconsole_putsn(struct stdio_dev *sdev, const char *s, int len) char str[30]; snprintf(str, sizeof(str), "[vc err: putsn %d]", ret); - console_puts_select_stderr(true, str); + err_puts(true, str); #endif } ret = video_sync(dev->parent, false); if (ret) { #ifdef DEBUG - console_puts_select_stderr(true, "[vc err: video_sync]"); + err_puts(true, "[vc err: video_sync]"); #endif } } diff --git a/include/console.h b/include/console.h index 209b67f3535..83b8d4f642c 100644 --- a/include/console.h +++ b/include/console.h @@ -159,7 +159,7 @@ static inline bool console_record_isempty(void) int console_announce_r(void); /** - * console_puts_select_stderr() - Output a string to selected console devices + * err_puts() - Output a string to selected console devices * * This writes to stderr only. It is useful for outputting errors * @@ -167,10 +167,10 @@ int console_announce_r(void); * else * @s: String to output */ -void console_puts_select_stderr(bool serial_only, const char *s); +void err_puts(bool serial_only, const char *s); /** - * console_printf_select_stderr() - Output a formatted string to selected devs + * err_printf() - Output a formatted string to selected devs * * This writes to stderr only. It is useful for outputting errors. Note that it * uses its own buffer, separate from the print buffer, to allow printing @@ -181,7 +181,7 @@ void console_puts_select_stderr(bool serial_only, const char *s); * @fmt: Printf format string, followed by format arguments * Return: number of characters written */ -int console_printf_select_stderr(bool serial_only, const char *fmt, ...) +int err_printf(bool serial_only, const char *fmt, ...) __attribute__ ((format (__printf__, 2, 3))); /**