From patchwork Tue Jan 20 23:17:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1679 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=1768951142; bh=qR/r1T6JVFaDRO71ax0N6IZ/4nggg1WgRKibfcRiQxU=; 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=RgeZuXp2LMevwqjxdhLm1LQznSQHzkHFCsD++xT5tYZJB6LDO7wMbRzLI8pcMeq/g QKj4zq3eUaUuRHg3XV8OXQu2WgeLc1Es9r6Entempxa/VbsBsjsWFRB9JgPI6pjP2L CbqEOxqWVAVPbpDdf74RMf78wdssFzKq+7V4OnqlVILi59capvm3jC8giWGLW2aA4o 4woZ1tdMrK7RBlty1IBAQ9ifFoSAjfaRfeOTISTPkoU9OM5u/bN9fEYcWEtF3WtySd YH782jpHY+KIIdqO8qr3BCWrY4fLtRRVlrNgS/v2OaYerD8v1O+6Nhk9T/sq4gOyid iw5/6++BOqoyw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9FD5069589 for ; Tue, 20 Jan 2026 16:19:02 -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 AFQQrpoiSAhG for ; Tue, 20 Jan 2026 16:19:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951142; bh=qR/r1T6JVFaDRO71ax0N6IZ/4nggg1WgRKibfcRiQxU=; 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=RgeZuXp2LMevwqjxdhLm1LQznSQHzkHFCsD++xT5tYZJB6LDO7wMbRzLI8pcMeq/g QKj4zq3eUaUuRHg3XV8OXQu2WgeLc1Es9r6Entempxa/VbsBsjsWFRB9JgPI6pjP2L CbqEOxqWVAVPbpDdf74RMf78wdssFzKq+7V4OnqlVILi59capvm3jC8giWGLW2aA4o 4woZ1tdMrK7RBlty1IBAQ9ifFoSAjfaRfeOTISTPkoU9OM5u/bN9fEYcWEtF3WtySd YH782jpHY+KIIdqO8qr3BCWrY4fLtRRVlrNgS/v2OaYerD8v1O+6Nhk9T/sq4gOyid iw5/6++BOqoyw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8C71369587 for ; Tue, 20 Jan 2026 16:19:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951140; bh=r6xG5cnvYkkFGXGnEJsQjUZACIQ+N8Ns/7QS7x7zOk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vYsE0UXuMIQMynvEsZ6ElVHq9tMquBrcz4egjHDT5GgLhR0xM/1voRVQX5MWg9Wca 1n8VbuoHyfr/KH29RqUrrqVFqTN9QuYyvGj1VZmIYfDK+pwXqZI61DYhEeMUCkywcN SXAN8Ar7MMfDLzdPWJesKlbnf+i6dVUeLJfAIuJuJ2Uji4+P1vgLaBG2rT8SMvOxiZ 1NE1hUigwQGP1EHioTTC+ZE7Dvcl8If3TO2cFXgvmvuhlhQ2GSotqoirKvZ1MXuy90 LdOGCFtHnsQ2qG/jB15EyDUimIiMybLCd5WrfnylHj62wlnuiuWS4aRdCYOjQaLcbi mDf8dYa1iZZ9A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A28F16957E; Tue, 20 Jan 2026 16:19:00 -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 V864MLiTEB8P; Tue, 20 Jan 2026 16:19:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951136; bh=9BEl8l9mGZV09O2xsiQhY+J8gkbvilHkQaQUBYsmtRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ktp6GybDYMo3HIAv7RX3F64PLf+yY1OGSZWibBdR5u83mRc7NPVwXnfSpb1pib3QU wKvPbj+dFa4MUjCHBjVpJdkbqL1YniDl8IfwTrc9yeKMGMBxFTwqAuQspB0lSiP8W7 /1yRc4MP2m8L1TFlRYQ/UQwSPq5Y9/05sNlTdMW82bxNiWTpC3oHr0yDvro+Wa6ukF u81kuRUBtOqGJiw57BRfGuO3tDHkd9fyN4nMaCVEZ1v7c7MAo3VX1XlOVa2z6lZZD1 rRc4nXPDYo83Y0RQUW6qqkPmTltClvvBYoGQwozQ5COOKvoxJwe77jbEwlYhN+5dQf J/9sg2D6bVNjg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5913A6913F; Tue, 20 Jan 2026 16:18:56 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:17:33 -0700 Message-ID: <20260120231814.2033069-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260120231814.2033069-1-sjg@u-boot.org> References: <20260120231814.2033069-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: E4LN5HT7E5PU7KNXA7DYG54KBD53US7P X-Message-ID-Hash: E4LN5HT7E5PU7KNXA7DYG54KBD53US7P 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 Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/36] video: Pass context to vidconsole_readline_start/end() 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 Add a vctx parameter to vidconsole_readline_start() and vidconsole_readline_end() to allow callers to specify which vidconsole context to use. If NULL is passed, the function falls back to using the default context from the device. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/scene_txtin.c | 4 ++-- drivers/video/vidconsole-uclass.c | 12 ++++++------ include/video_console.h | 13 ++++++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/boot/scene_txtin.c b/boot/scene_txtin.c index 2b72ecaed39..3944bce9a96 100644 --- a/boot/scene_txtin.c +++ b/boot/scene_txtin.c @@ -107,7 +107,7 @@ static void scene_txtin_putch(struct cli_line_state *cls, int ch) void scene_txtin_close(struct scene *scn) { /* cursor is not needed now */ - vidconsole_readline_end(scn->expo->cons); + vidconsole_readline_end(scn->expo->cons, NULL); } int scene_txtin_open(struct scene *scn, struct scene_obj *obj, @@ -137,7 +137,7 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj, return log_msg_ret("sav", ret); /* make sure the cursor is visible */ - vidconsole_readline_start(cons, true); + vidconsole_readline_start(cons, NULL, true); return 0; } diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 200bc60c55b..ca21cb8154f 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -1019,18 +1019,18 @@ void vidconsole_idle(struct udevice *dev) } #ifdef CONFIG_CURSOR -void vidconsole_readline_start(struct udevice *dev, bool indent) +void vidconsole_readline_start(struct udevice *dev, void *vctx, bool indent) { - struct vidconsole_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *ctx = vctx ?: vidconsole_ctx(dev); ctx->curs.indent = indent; ctx->curs.enabled = true; vidconsole_mark_start(dev); } -void vidconsole_readline_end(struct udevice *dev) +void vidconsole_readline_end(struct udevice *dev, void *vctx) { - struct vidconsole_ctx *ctx = vidconsole_ctx(dev); + struct vidconsole_ctx *ctx = vctx ?: vidconsole_ctx(dev); ctx->curs.enabled = false; } @@ -1041,7 +1041,7 @@ void vidconsole_readline_start_all(bool indent) struct udevice *dev; uclass_id_foreach_dev(UCLASS_VIDEO_CONSOLE, dev, uc) - vidconsole_readline_start(dev, indent); + vidconsole_readline_start(dev, NULL, indent); } void vidconsole_readline_end_all(void) @@ -1050,7 +1050,7 @@ void vidconsole_readline_end_all(void) struct udevice *dev; uclass_id_foreach_dev(UCLASS_VIDEO_CONSOLE, dev, uc) - vidconsole_readline_end(dev); + vidconsole_readline_end(dev, NULL); } #endif /* CURSOR */ diff --git a/include/video_console.h b/include/video_console.h index 663f89b25f2..c6cc050e054 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -278,7 +278,7 @@ struct vidconsole_ops { * entry_start() - Indicate that text entry is starting afresh * * @dev: Device to adjust - * @ctx: Vidconsole context to use + * @ctx: Vidconsole context to use (cannot be NULL) * Returns: 0 on success, -ve on error * * Consoles which use proportional fonts need to track the position of @@ -596,9 +596,10 @@ int vidconsole_hide_cursor(struct udevice *dev); * Called at the start of command line input to show the cursor * * @dev: vidconsole device + * @vctx: vidconsole context to use, or NULL to use the default * @indent: indent subsequent lines to the same position as the first line */ -void vidconsole_readline_start(struct udevice *dev, bool indent); +void vidconsole_readline_start(struct udevice *dev, void *vctx, bool indent); /** * vidconsole_readline_end() - Disable cursor for a video console @@ -606,8 +607,9 @@ void vidconsole_readline_start(struct udevice *dev, bool indent); * Called at the end of command line input to hide the cursor * * @dev: vidconsole device + * @vctx: vidconsole context to use, or NULL to use the default */ -void vidconsole_readline_end(struct udevice *dev); +void vidconsole_readline_end(struct udevice *dev, void *vctx); /** * vidconsole_readline_start_all() - Enable cursor for all video consoles @@ -637,11 +639,12 @@ static inline int vidconsole_hide_cursor(struct udevice *dev) return 0; } -static inline void vidconsole_readline_start(struct udevice *dev, bool indent) +static inline void vidconsole_readline_start(struct udevice *dev, void *vctx, + bool indent) { } -static inline void vidconsole_readline_end(struct udevice *dev) +static inline void vidconsole_readline_end(struct udevice *dev, void *vctx) { }