From patchwork Tue Jan 20 23:17:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1683 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=1768951161; bh=sklq7ZUEj7ty5riRgLBsYB8huMO9assezynhvNevpxY=; 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=SCE7D9NWpjRdHPHKhgXNdoMYmB7SoGhz2S3iKjmubkYODV7cc2JJ5flO0aJR4zboX 5qkbnSduJhhGGyINdPzpKeMNStcYxNubpkZKgoVpCIAp8l2UBHTe/HY4Kjx2DMOvQQ X4huEoEO3ygKK0viqQwOWECJ7y8NohLVyzlI74PsMA3MRFdUBiXLzv6PoI6U4AW/lq GBUhR1sSal86B3tNiejC2dfBGC3auGBNftaSuyrYSxleZGhf/sEJqcX4KHOTT5VvSY KhWR7YB3k8uF73uijBrV5WTyznSbMMFB4c2JoQWbZJslhybQG/HWiA+M+Q3N2xexU/ qUSd5J00SsGGQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CD9C969572 for ; Tue, 20 Jan 2026 16:19:21 -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 1kvv3WFmUNQJ for ; Tue, 20 Jan 2026 16:19:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951161; bh=sklq7ZUEj7ty5riRgLBsYB8huMO9assezynhvNevpxY=; 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=SCE7D9NWpjRdHPHKhgXNdoMYmB7SoGhz2S3iKjmubkYODV7cc2JJ5flO0aJR4zboX 5qkbnSduJhhGGyINdPzpKeMNStcYxNubpkZKgoVpCIAp8l2UBHTe/HY4Kjx2DMOvQQ X4huEoEO3ygKK0viqQwOWECJ7y8NohLVyzlI74PsMA3MRFdUBiXLzv6PoI6U4AW/lq GBUhR1sSal86B3tNiejC2dfBGC3auGBNftaSuyrYSxleZGhf/sEJqcX4KHOTT5VvSY KhWR7YB3k8uF73uijBrV5WTyznSbMMFB4c2JoQWbZJslhybQG/HWiA+M+Q3N2xexU/ qUSd5J00SsGGQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BD03A6957E for ; Tue, 20 Jan 2026 16:19:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951159; bh=FIAdY4QS9jKC+Vqs8xqgPXQppKIczjccJxO9N7O1Wb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QOPXW73lJqSJvzmwoMgd/5hSCiqm26hkO3F9nAYz+3K6ciRS3bzBOJBKMBiCrXJxJ j3EmhDitvJbH+xhpderSNnTItUBzpmAFhn+fZayua/0p62nHMdiepEEr9TT0xYZ/1M LnS/2GwwM1DxmByV2g40lGorgQ0AKbGrw3LQGpu9PfMlvAJcU2lkg01rwFZQl+2UWQ inDh+r0fxNQ3q1YtI//jNrpCbw4wfBj8XEJdFE7rB2DeIKrQOSjCppJzAO0Nu5Sl1/ 9OteXeXqcKSeKx00S9atlVPQSiQbIK+ey7zLUk9IVnmrIGflKhKzEnySrKJUmnMRan S1jsGmIZqD0Ew== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2DA8D69572; Tue, 20 Jan 2026 16:19:19 -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 oKnXWlbR0liJ; Tue, 20 Jan 2026 16:19:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768951155; bh=W7H3e+KqNy7ebe6Ge4rp7jRiFgBpY6cqsc2hFF/pGfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UOONvE5ZIL5DX1rD6gEPu5ZMg4CHClraw4VsTJxlf9KFnbBrafWVxffZ0+X0EPcf5 8abIRk+SloBj33T61h5ab/v3qa3ao1/5vhYPT5nGu8m+JsgfPrWT62kML2oeoq+0rH DAo8M2MEgpJLKIZMuXe1VtOG3iOcVaXyHgReEHs33RNVezNEz0gYz6OpuP+Fm9QGxq LMD5nwcCIX05d2jT+McPMpfMZy6Lc4TF5qKKv/qpEG7i29JYnqLIgAlS/6iwHA49UT FSlfawbfZBkdF0wEanIMVgQGNYCCcS9ND/ZqdMrcQaH+tYDDRgXnkPVbljbz4VkHIF 0CRjISJlhvcAQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D73306913F; Tue, 20 Jan 2026 16:19:14 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:17:37 -0700 Message-ID: <20260120231814.2033069-11-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: MJQQ5EQLEPRDRTLGMBJST34XGK3IDYWP X-Message-ID-Hash: MJQQ5EQLEPRDRTLGMBJST34XGK3IDYWP 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 10/36] video: Pass context to backspace() method 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 backspace() driver method currently uses the default context. Update it to accept a context parameter so callers can specify which context to use for the backspace operation. This is needed for text-input objects which have their own vidconsole context. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 5 +++-- drivers/video/vidconsole-uclass.c | 10 ++++------ include/video_console.h | 3 ++- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 106da0e086d..519b8f88843 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -660,12 +660,13 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, * not been entered. * * @dev: Device to update + * @vctx: Vidconsole context to use * Return: 0 if OK, -ENOSYS if not supported */ -static int console_truetype_backspace(struct udevice *dev) +static int console_truetype_backspace(struct udevice *dev, void *vctx) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - struct console_tt_ctx *ctx = vidconsole_ctx(dev); + struct console_tt_ctx *ctx = vctx; struct vidconsole_ctx *com = &ctx->com; struct pos_info *pos; int xend; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index ca21cb8154f..8590219ae64 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -61,16 +61,14 @@ int vidconsole_entry_start(struct udevice *dev, void *ctx) return ops->entry_start(dev, ctx); } -/* Move backwards one space */ -static int vidconsole_back(struct udevice *dev) +/* Move backwards one space, ctx must be non-NULL */ +static int vidconsole_back(struct udevice *dev, struct vidconsole_ctx *ctx) { - struct vidconsole_priv *priv = dev_get_uclass_priv(dev); - struct vidconsole_ctx *ctx = vidconsole_ctx_from_priv(priv); struct vidconsole_ops *ops = vidconsole_get_ops(dev); int ret; if (ops->backspace) { - ret = ops->backspace(dev); + ret = ops->backspace(dev, ctx); if (ret != -ENOSYS) return ret; } @@ -523,7 +521,7 @@ int vidconsole_put_char(struct udevice *dev, char ch) vidconsole_newline(dev); break; case '\b': - vidconsole_back(dev); + vidconsole_back(dev, ctx); ctx->last_ch = 0; break; default: diff --git a/include/video_console.h b/include/video_console.h index c6cc050e054..3390d4fe1a7 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -294,6 +294,7 @@ struct vidconsole_ops { * backspace() - Handle erasing the last character * * @dev: Device to adjust + * @ctx: Vidconsole context to use * Returns: 0 on success, -ve on error * * With proportional fonts the vidconsole uclass cannot itself erase @@ -305,7 +306,7 @@ struct vidconsole_ops { * If not implement, default behaviour will work for fixed-width * characters. */ - int (*backspace)(struct udevice *dev); + int (*backspace)(struct udevice *dev, void *ctx); /** * get_font() - Obtain information about a font (optional)