[Concept,16/18] video: truetype: Remove console_tt_store struct

Message ID 20260117005702.1684841-17-sjg@u-boot.org
State New
Headers
Series Refactor vidconsole context for dynamic allocation |

Commit Message

Simon Glass Jan. 17, 2026, 12:56 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Now that console_tt_store only contains console_tt_ctx, remove the
wrapper struct and save/restore console_tt_ctx directly.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 drivers/video/console_truetype.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
  

Patch

diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index 7b1540b6c40..f73fb3e6595 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -249,15 +249,6 @@  struct console_tt_priv {
 	char *scratch_buf;
 };
 
-/**
- * struct console_tt_store - Format used for save/restore of entry information
- *
- * @ctx: Per-client context
- */
-struct console_tt_store {
-	struct console_tt_ctx ctx;
-};
-
 static int console_truetype_set_row(struct udevice *dev, uint row, int clr)
 {
 	struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
@@ -1170,8 +1161,7 @@  static int truetype_ctx_dispose(struct udevice *dev, void *ctx)
 static int truetype_entry_save(struct udevice *dev, struct abuf *buf)
 {
 	struct console_tt_ctx *ctx = vidconsole_ctx(dev);
-	struct console_tt_store store;
-	const uint size = sizeof(store);
+	const uint size = sizeof(*ctx);
 
 	if (xpl_phase() <= PHASE_SPL)
 		return -ENOSYS;
@@ -1179,8 +1169,7 @@  static int truetype_entry_save(struct udevice *dev, struct abuf *buf)
 	if (!abuf_realloc(buf, size))
 		return log_msg_ret("sav", -ENOMEM);
 
-	store.ctx = *ctx;
-	memcpy(abuf_data(buf), &store, size);
+	memcpy(abuf_data(buf), ctx, size);
 
 	return 0;
 }
@@ -1188,13 +1177,11 @@  static int truetype_entry_save(struct udevice *dev, struct abuf *buf)
 static int truetype_entry_restore(struct udevice *dev, struct abuf *buf)
 {
 	struct console_tt_ctx *ctx = vidconsole_ctx(dev);
-	struct console_tt_store store;
 
 	if (xpl_phase() <= PHASE_SPL)
 		return -ENOSYS;
 
-	memcpy(&store, abuf_data(buf), sizeof(store));
-	*ctx = store.ctx;
+	memcpy(ctx, abuf_data(buf), sizeof(*ctx));
 
 	return 0;
 }