Skip to content

Commit 54bc937

Browse files
seanyoungojeda
authored andcommitted
auxdisplay: charlcd: no need to call charlcd_gotoxy() if nothing changes
If the line extends beyond the width to the screen, nothing changes. The existing code will call charlcd_gotoxy every time for this case. Signed-off-by: Sean Young <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 7223310 commit 54bc937

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/auxdisplay/charlcd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,11 @@ static void charlcd_print(struct charlcd *lcd, char c)
192192
c = lcd->char_conv[(unsigned char)c];
193193
lcd->ops->write_data(lcd, c);
194194
priv->addr.x++;
195+
196+
/* prevents the cursor from wrapping onto the next line */
197+
if (priv->addr.x == lcd->bwidth)
198+
charlcd_gotoxy(lcd);
195199
}
196-
/* prevents the cursor from wrapping onto the next line */
197-
if (priv->addr.x == lcd->bwidth)
198-
charlcd_gotoxy(lcd);
199200
}
200201

201202
static void charlcd_clear_fast(struct charlcd *lcd)

0 commit comments

Comments
 (0)