From patchwork Mon Jan 15 09:58:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 10163379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A381B60245 for ; Mon, 15 Jan 2018 09:58:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87E47265B9 for ; Mon, 15 Jan 2018 09:58:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C51D285BE; Mon, 15 Jan 2018 09:58:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 356B2265B9 for ; Mon, 15 Jan 2018 09:58:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933241AbeAOJ62 (ORCPT ); Mon, 15 Jan 2018 04:58:28 -0500 Received: from gofer.mess.org ([88.97.38.141]:55195 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932909AbeAOJ61 (ORCPT ); Mon, 15 Jan 2018 04:58:27 -0500 Received: by gofer.mess.org (Postfix, from userid 1000) id 3C8C160608; Mon, 15 Jan 2018 09:58:25 +0000 (GMT) From: Sean Young To: Miguel Ojeda Sandonis , linux-media@vger.kernel.org Subject: [PATCH 1/5] auxdisplay: charlcd: no need to call charlcd_gotoxy() if nothing changes Date: Mon, 15 Jan 2018 09:58:20 +0000 Message-Id: <0cb9a05c09295bcad4dd914ee44806ac6c244cbd.1516008708.git.sean@mess.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/auxdisplay/charlcd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c index 642afd88870b..45ec5ce697c4 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)