[Concept,06/18] video: Use vidconsole_ctx_from_priv() in expo_test

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

Update expo_test_render() to use the vidconsole_ctx_from_priv() helper
function instead of accessing the ctx field directly. This is more
consistent with the rest of the codebase.

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

 boot/expo_test.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
  

Patch

diff --git a/boot/expo_test.c b/boot/expo_test.c
index a905b144745..a5ad571eedb 100644
--- a/boot/expo_test.c
+++ b/boot/expo_test.c
@@ -120,6 +120,7 @@  int expo_test_render(struct expo *exp)
 	struct expo_test_mode *test = exp->test;
 	struct vidconsole_priv *cons_priv;
 	struct udevice *dev = exp->display;
+	struct vidconsole_ctx *ctx;
 	struct video_priv *vid_priv;
 	char buf[30];
 	ulong now;
@@ -140,6 +141,7 @@  int expo_test_render(struct expo *exp)
 
 	vid_priv = dev_get_uclass_priv(dev);
 	cons_priv = dev_get_uclass_priv(exp->cons);
+	ctx = vidconsole_ctx_from_priv(cons_priv);
 
 	/* Accumulate delta times for averaging */
 	test->render_total_us += test->render_delta_us;
@@ -176,7 +178,7 @@  int expo_test_render(struct expo *exp)
 
 	/* Display frame count */
 	snprintf(buf, sizeof(buf), "frame  %6d", test->render_count);
-	x = vid_priv->xsize - 18 * cons_priv->ctx.x_charsize;
+	x = vid_priv->xsize - 18 * ctx->x_charsize;
 	y = 10;
 	vidconsole_set_cursor_pos(exp->cons, x, y);
 	vidconsole_put_string(exp->cons, buf);
@@ -184,7 +186,7 @@  int expo_test_render(struct expo *exp)
 	/* Display FPS on next line (only if non-zero) */
 	if (test->fps_last > 0) {
 		snprintf(buf, sizeof(buf), "fps    %6d", test->fps_last);
-		y += cons_priv->ctx.y_charsize;
+		y += ctx->y_charsize;
 		vidconsole_set_cursor_pos(exp->cons, x, y);
 		vidconsole_put_string(exp->cons, buf);
 	}
@@ -193,7 +195,7 @@  int expo_test_render(struct expo *exp)
 	snprintf(buf, sizeof(buf), "render %6lu.%01lums",
 		 test->render_avg_us / 1000,
 		 (test->render_avg_us % 1000) / 100);
-	y += cons_priv->ctx.y_charsize;
+	y += ctx->y_charsize;
 	vidconsole_set_cursor_pos(exp->cons, x, y);
 	vidconsole_put_string(exp->cons, buf);
 
@@ -201,7 +203,7 @@  int expo_test_render(struct expo *exp)
 	snprintf(buf, sizeof(buf), "sync   %6lu.%01lums",
 		 test->sync_avg_us / 1000,
 		 (test->sync_avg_us % 1000) / 100);
-	y += cons_priv->ctx.y_charsize;
+	y += ctx->y_charsize;
 	vidconsole_set_cursor_pos(exp->cons, x, y);
 	vidconsole_put_string(exp->cons, buf);
 
@@ -209,7 +211,7 @@  int expo_test_render(struct expo *exp)
 	snprintf(buf, sizeof(buf), "poll   %6lu.%01lums",
 		 test->poll_avg_us / 1000,
 		 (test->poll_avg_us % 1000) / 100);
-	y += cons_priv->ctx.y_charsize;
+	y += ctx->y_charsize;
 	vidconsole_set_cursor_pos(exp->cons, x, y);
 	vidconsole_put_string(exp->cons, buf);