All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Anatolij Gustschin <agust@denx.de>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Simon Glass <sjg@chromium.org>
Subject: [PATCH 08/11] video: Remove duplicate cursor-positioning function
Date: Sun,  5 Feb 2023 12:46:24 -0700	[thread overview]
Message-ID: <20230205194627.203961-9-sjg@chromium.org> (raw)
In-Reply-To: <20230205194627.203961-1-sjg@chromium.org>

There are two functions for positioning the cursor on the console. Remove
one of them.

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

 drivers/video/vidconsole-uclass.c | 44 +++++++------------------------
 1 file changed, 10 insertions(+), 34 deletions(-)

diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 72a13d30527..9f8b8ebe8ac 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -126,26 +126,14 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y)
 	priv->ycur = y;
 }
 
-/**
- * set_cursor_position() - set cursor position
- *
- * @priv:	private data of the video console
- * @row:	new row
- * @col:	new column
- */
-static void set_cursor_position(struct vidconsole_priv *priv, int row, int col)
+void vidconsole_position_cursor(struct udevice *dev, uint col, uint row)
 {
-	/*
-	 * Ensure we stay in the bounds of the screen.
-	 */
-	if (row >= priv->rows)
-		row = priv->rows - 1;
-	if (col >= priv->cols)
-		col = priv->cols - 1;
-
-	priv->ycur = row * priv->y_charsize;
-	priv->xcur_frac = priv->xstart_frac +
-			  VID_TO_POS(col * priv->x_charsize);
+	struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
+	short x, y;
+
+	x = min_t(short, col, priv->cols - 1) * priv->x_charsize;
+	y = min_t(short, row, priv->rows - 1) * priv->y_charsize;
+	vidconsole_set_cursor_pos(dev, x, y);
 }
 
 /**
@@ -192,7 +180,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
 			int row = priv->row_saved;
 			int col = priv->col_saved;
 
-			set_cursor_position(priv, row, col);
+			vidconsole_position_cursor(dev, col, row);
 			priv->escape = 0;
 			return;
 		}
@@ -254,7 +242,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
 		if (row < 0)
 			row = 0;
 		/* Right and bottom overflows are handled in the callee. */
-		set_cursor_position(priv, row, col);
+		vidconsole_position_cursor(dev, col, row);
 		break;
 	}
 	case 'H':
@@ -278,7 +266,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
 		if (col)
 			--col;
 
-		set_cursor_position(priv, row, col);
+		vidconsole_position_cursor(dev, col, row);
 
 		break;
 	}
@@ -644,15 +632,3 @@ int vidconsole_memmove(struct udevice *dev, void *dst, const void *src,
 	return vidconsole_sync_copy(dev, dst, dst + size);
 }
 #endif
-
-void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row)
-{
-	struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
-	struct udevice *vid_dev = dev->parent;
-	struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev);
-	short x, y;
-
-	x = min_t(short, col * priv->x_charsize, vid_priv->xsize - 1);
-	y = min_t(short, row * priv->y_charsize, vid_priv->ysize - 1);
-	vidconsole_set_cursor_pos(dev, x, y);
-}
-- 
2.39.1.519.gcb327c4b5f-goog


  parent reply	other threads:[~2023-02-05 19:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-05 19:46 [PATCH 00/11] video: efi: Improve the EFI-app video console Simon Glass
2023-02-05 19:46 ` [PATCH 01/11] efi: video: Move payload code into a function Simon Glass
2023-02-05 19:46 ` [PATCH 02/11] efi: video: Return mode info for app also Simon Glass
2023-02-05 19:46 ` [PATCH 03/11] efi: Support a 64-bit frame buffer address Simon Glass
2023-02-05 19:46 ` [PATCH 04/11] x86: Add a few more items to bdinfo Simon Glass
2023-02-05 19:46 ` [PATCH 05/11] efi: Use a fixed value for the timer clock Simon Glass
2023-02-05 19:46 ` [PATCH 06/11] efi: Support copy framebuffer Simon Glass
2023-02-10 12:11   ` Heinrich Schuchardt
2023-02-14 19:48     ` Simon Glass
2023-02-14 20:09       ` Heinrich Schuchardt
2023-02-05 19:46 ` [PATCH 07/11] video: Allow a copy framebuffer with pre-allocated fb Simon Glass
2023-02-05 19:46 ` Simon Glass [this message]
2023-02-05 19:46 ` [PATCH 09/11] video: Clear the vidconsole rather than the video Simon Glass
2023-02-05 19:46 ` [PATCH 10/11] efi: Add dhrystone, dcache and scroll lines to app Simon Glass
2023-02-05 19:46 ` [PATCH 11/11] video: Add a note about the broken implementation Simon Glass
2023-02-05 21:25   ` Heinrich Schuchardt
2023-02-06 17:12     ` Simon Glass
2023-02-05 21:15 ` [PATCH 00/11] video: efi: Improve the EFI-app video console Heinrich Schuchardt
2023-02-07 13:38   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230205194627.203961-9-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.