From: Simon Glass <simon.glass@canonical.com>
Update console_alloc_cursor() to take a context parameter so it can
allocate cursor memory for a specific context rather than always using
the default.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
drivers/video/console_core.c | 7 ++-----
drivers/video/console_truetype.c | 2 +-
drivers/video/vidconsole_internal.h | 3 ++-
3 files changed, 5 insertions(+), 7 deletions(-)
@@ -278,9 +278,8 @@ int cursor_hide(struct vidconsole_cursor *curs, struct video_priv *vid_priv,
return 0;
}
-int console_alloc_cursor(struct udevice *dev)
+int console_alloc_cursor(struct udevice *dev, struct vidconsole_ctx *ctx)
{
- struct vidconsole_ctx *ctx;
struct vidconsole_cursor *curs;
struct video_priv *vid_priv;
struct udevice *vid;
@@ -288,8 +287,6 @@ int console_alloc_cursor(struct udevice *dev)
if (!CONFIG_IS_ENABLED(CURSOR) || xpl_phase() < PHASE_BOARD_R)
return 0;
-
- ctx = vidconsole_ctx(dev);
vid = dev_get_parent(dev);
vid_priv = dev_get_uclass_priv(vid);
curs = &ctx->curs;
@@ -312,7 +309,7 @@ int console_probe(struct udevice *dev)
return ret;
if (CONFIG_IS_ENABLED(CURSOR) && xpl_phase() == PHASE_BOARD_R) {
- ret = console_alloc_cursor(dev);
+ ret = console_alloc_cursor(dev, vidconsole_ctx(dev));
if (ret)
return ret;
}
@@ -1301,7 +1301,7 @@ static int console_truetype_probe(struct udevice *dev)
debug("%s: ready\n", __func__);
- ret = console_alloc_cursor(dev);
+ ret = console_alloc_cursor(dev, &ctx->com);
if (ret)
return ret;
@@ -152,9 +152,10 @@ int cursor_hide(struct vidconsole_cursor *curs, struct video_priv *vid_priv,
* Allocates memory for saving pixels under the cursor
*
* @dev: vidconsole device
+ * @ctx: vidconsole context
* Return: 0 if success, -ENOMEM if allocation fails
*/
-int console_alloc_cursor(struct udevice *dev);
+int console_alloc_cursor(struct udevice *dev, struct vidconsole_ctx *ctx);
/**
* console probe function.