[Concept,20/42] video: Update cursor_show() to take a simple pointer

Message ID 20250919201507.4024144-21-sjg@u-boot.org
State New
Headers
Series video: Support a cursor more generally |

Commit Message

Simon Glass Sept. 19, 2025, 8:14 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

We don't need to pass a pointer to a pointer, so just pass a normal
pointer. This is simpler to understand.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/video/console_core.c        | 6 +++---
 drivers/video/console_normal.c      | 5 ++---
 drivers/video/console_truetype.c    | 2 +-
 drivers/video/vidconsole_internal.h | 2 +-
 4 files changed, 7 insertions(+), 8 deletions(-)
  

Patch

diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c
index 36e7f81dc0a..575d0bfe2b8 100644
--- a/drivers/video/console_core.c
+++ b/drivers/video/console_core.c
@@ -160,7 +160,7 @@  int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri
 	return ret;
 }
 
-int cursor_show(void **line, struct video_priv *vid_priv, uint height,
+int cursor_show(void *line, struct video_priv *vid_priv, uint height,
 		bool direction)
 {
 	int step, line_step, pbytes, ret;
@@ -183,10 +183,10 @@  int cursor_show(void **line, struct video_priv *vid_priv, uint height,
 	value = vid_priv->colour_fg;
 
 	for (int row = 0; row < height; row++) {
-		dst = *line;
+		dst = line;
 		for (int col = 0; col < VIDCONSOLE_CURSOR_WIDTH; col++)
 			fill_pixel_and_goto_next(&dst, value, pbytes, step);
-		*line += line_step;
+		line += line_step;
 	}
 
 	return ret;
diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 3865870dcd5..315d3daa5ce 100644
--- a/drivers/video/console_normal.c
+++ b/drivers/video/console_normal.c
@@ -85,7 +85,7 @@  static int __maybe_unused console_set_cursor_visible(struct udevice *dev,
 	struct console_simple_priv *priv = dev_get_priv(dev);
 	struct video_fontdata *fontdata = priv->fontdata;
 	int pbytes = VNBYTES(vid_priv->bpix);
-	void *start, *line;
+	void *start;
 
 	/* for now, this is not used outside expo */
 	if (!IS_ENABLED(CONFIG_EXPO))
@@ -98,8 +98,7 @@  static int __maybe_unused console_set_cursor_visible(struct udevice *dev,
 		x -= 1;
 
 	start = vid_priv->fb + y * vid_priv->line_length + x * pbytes;
-	line = start;
-	cursor_show(&line, vid_priv, vc_priv->y_charsize, NORMAL_DIRECTION);
+	cursor_show(start, vid_priv, vc_priv->y_charsize, NORMAL_DIRECTION);
 
 	return 0;
 }
diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index babab5eb2c3..eedc285903b 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -1032,7 +1032,7 @@  static int truetype_set_cursor_visible(struct udevice *dev, bool visible,
 		x * VNBYTES(vid_priv->bpix);
 
 	/* Use the shared cursor drawing function */
-	cursor_show(&line, vid_priv, height, NORMAL_DIRECTION);
+	cursor_show(line, vid_priv, height, NORMAL_DIRECTION);
 
 	video_damage(dev->parent, x, y, VIDCONSOLE_CURSOR_WIDTH, height);
 
diff --git a/drivers/video/vidconsole_internal.h b/drivers/video/vidconsole_internal.h
index 02b73296292..0654a8f98e6 100644
--- a/drivers/video/vidconsole_internal.h
+++ b/drivers/video/vidconsole_internal.h
@@ -116,7 +116,7 @@  int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri
  *
  * Return: 0, if success, or else error code.
  */
-int cursor_show(void **line, struct video_priv *vid_priv, uint height,
+int cursor_show(void *line, struct video_priv *vid_priv, uint height,
 		bool direction);
 
 /**