[Concept,15/18] video: truetype: Remove redundant store.cur field

Message ID 20260117005702.1684841-16-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>

The store.cur field is used to separately save xcur_frac and ycur, but
these are already saved as part of store.ctx since console_tt_ctx
contains vidconsole_ctx which has these fields.

Additionally, the restore code is buggy - it sets com->xcur_frac and
com->ycur, then immediately overwrites them with *ctx = store.ctx.

Remove the redundant field and simplify the save/restore functions.

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

 drivers/video/console_truetype.c | 9 ---------
 1 file changed, 9 deletions(-)
  

Patch

diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index 2ab4f7dcb25..7b1540b6c40 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -253,11 +253,9 @@  struct console_tt_priv {
  * struct console_tt_store - Format used for save/restore of entry information
  *
  * @ctx: Per-client context
- * @cur: Current cursor position
  */
 struct console_tt_store {
 	struct console_tt_ctx ctx;
-	struct pos_info cur;
 };
 
 static int console_truetype_set_row(struct udevice *dev, uint row, int clr)
@@ -1172,7 +1170,6 @@  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 vidconsole_ctx *com = &ctx->com;
 	struct console_tt_store store;
 	const uint size = sizeof(store);
 
@@ -1183,8 +1180,6 @@  static int truetype_entry_save(struct udevice *dev, struct abuf *buf)
 		return log_msg_ret("sav", -ENOMEM);
 
 	store.ctx = *ctx;
-	store.cur.xpos_frac = com->xcur_frac;
-	store.cur.ypos  = com->ycur;
 	memcpy(abuf_data(buf), &store, size);
 
 	return 0;
@@ -1193,16 +1188,12 @@  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 vidconsole_ctx *com = &ctx->com;
 	struct console_tt_store store;
 
 	if (xpl_phase() <= PHASE_SPL)
 		return -ENOSYS;
 
 	memcpy(&store, abuf_data(buf), sizeof(store));
-
-	com->xcur_frac = store.cur.xpos_frac;
-	com->ycur = store.cur.ypos;
 	*ctx = store.ctx;
 
 	return 0;