From: Sean Young Date: Mon, 15 Jan 2018 09:43:48 +0000 (+0000) Subject: auxdisplay: charlcd: no need to call charlcd_gotoxy() if nothing changes X-Git-Tag: v4.18-rc1~102^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54bc937f0cc2a7b9cb9802b9992f936259d015a1;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Geert Uytterhoeven Signed-off-by: Miguel Ojeda --- diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c index 642afd88870ba..45ec5ce697c41 100644 --- a/drivers/auxdisplay/charlcd.c +++ b/drivers/auxdisplay/charlcd.c @@ -192,10 +192,11 @@ static void charlcd_print(struct charlcd *lcd, char c) c = lcd->char_conv[(unsigned char)c]; lcd->ops->write_data(lcd, c); priv->addr.x++; + + /* prevents the cursor from wrapping onto the next line */ + if (priv->addr.x == lcd->bwidth) + charlcd_gotoxy(lcd); } - /* prevents the cursor from wrapping onto the next line */ - if (priv->addr.x == lcd->bwidth) - charlcd_gotoxy(lcd); } static void charlcd_clear_fast(struct charlcd *lcd)