[PATCH v2 31/32] auxdisplay: charlcd: Do not print chars at end of line

From: poeschel
Date: Mon Sep 21 2020 - 10:48:17 EST


From: Lars Poeschel <poeschel@xxxxxxxxxxx>

Skip printing characters at the end of a display line. This fits to the
behaviour we already had, that the cursor is nailed to last position of
a line.

Signed-off-by: Lars Poeschel <poeschel@xxxxxxxxxxx>
---
drivers/auxdisplay/charlcd.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index cd3a304c08ec..1d5b3af9cca7 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -111,6 +111,9 @@ static void charlcd_home(struct charlcd *lcd)

static void charlcd_print(struct charlcd *lcd, char c)
{
+ if (lcd->addr.x >= lcd->width)
+ return;
+
if (lcd->char_conv)
c = lcd->char_conv[(unsigned char)c];

--
2.28.0