[Concept,04/14] expo: Update poll_mouse() to use struct vid_pos

Message ID 20251006165452.1675349-5-sjg@u-boot.org
State New
Headers
Series expo: Continue development of expo with mouse |

Commit Message

Simon Glass Oct. 6, 2025, 4:54 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Simplify the function to use struct vid_pos instead of separate x/y
pointers.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 boot/expo.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
  

Patch

diff --git a/boot/expo.c b/boot/expo.c
index 1051133e200..b5c54291220 100644
--- a/boot/expo.c
+++ b/boot/expo.c
@@ -411,22 +411,18 @@  static int poll_keys(struct expo *exp)
 	return key ? key : -EAGAIN;
 }
 
-static int poll_mouse(struct expo *exp, int *xp, int *yp)
+static int poll_mouse(struct expo *exp, struct vid_pos *pos)
 {
-	struct vid_pos pos;
 	int ret;
 
 	if (!exp->mouse_enabled)
 		return -EAGAIN;
 
 	/* First check if we have a click available */
-	ret = mouse_get_click(exp->mouse, &pos);
+	ret = mouse_get_click(exp->mouse, pos);
 	if (ret)
 		return log_msg_ret("epm", ret);
 
-	*xp = pos.x;
-	*yp = pos.y;
-
 	return 0; /* Click available */
 }
 
@@ -438,11 +434,11 @@  int expo_poll(struct expo *exp, struct expo_action *act)
 	if (key != -EAGAIN) {
 		ret = expo_send_key(exp, key);
 	} else if (IS_ENABLED(CONFIG_MOUSE)) {
-		int x, y;
+		struct vid_pos pos;
 
-		ret = poll_mouse(exp, &x, &y);
+		ret = poll_mouse(exp, &pos);
 		if (!ret)
-			ret = expo_send_click(exp, x, y);
+			ret = expo_send_click(exp, pos.x, pos.y);
 	}
 	if (ret)
 		return log_msg_ret("epk", ret);