From nobody Thu Oct 2 10:38:59 2025 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64E1B2F83B4 for ; Thu, 18 Sep 2025 12:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758197622; cv=none; b=NQwVgfGnq4UgorKJb8h9OmKb03lgRpdP/VSxaDPkWhODKdO1fAq61WNQgvN51uQM9J516K1k4v8hABv0iBKqEHG6S7ItxhCP+Oa7s/jP0Zumm0OXwLi27w1Yf3DG+arf593eWlv1Vpbw+MvFEIABMJhRB41PvTkM/t/beCN1GCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758197622; c=relaxed/simple; bh=24Be7G8WgfefB3rgK007NjGcnBPNBuN2h6zVyr5c2XM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kmzwQsp9uA9f//Pfob1XFCeOuSzZ1G4Zgfl+oifmSHeZ+eEGlBCq1gBGRKfXPWV5O3x7nG7oPuBKImpJGizlBeeikJAOcM1Cb2EzEXWFPeTkx3IwTRW2iFRG5RH+kjfUsoR+66atK5WDpgae6xv05jX20J490InjhsmIf9xDuRo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YrZFleHB; arc=none smtp.client-ip=209.85.219.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YrZFleHB" Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-78d73eef306so7975266d6.0 for ; Thu, 18 Sep 2025 05:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758197620; x=1758802420; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+oA1EqdG3ZaYUrig5a2R7esA1n5VsBIXfb4bGmd5S/8=; b=YrZFleHBy8/bgTEpDA7xyXMfKrdv0cSs3VbwCIk/eppFatQaj/QzFQtYhouAu2+WF3 i7f4OVZ2q3brVJXlR87ooD8ipqwSXiBNmQbxcRraN/qdlycrEmMT+5cnkLe/K3wlqBif zsJZd2+/2Gn2XKN3CX5jvxvDesKr7kaDxhLbvwsrY11b/6+z5XHQHsbpl56YrpaIeph6 K9+I7L8Wjdi/reaF9Z5nt0+QyUP4dQaPIOZ9le66gu93hsWQKujmhoCHtEF27Ir21Je8 juZNJBEJuVfiK79y9MlGOB0OwiJu5HZXcRo8Uw/gr1jQrwoke8/NFYhMVNSohNeqU1MK euwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758197620; x=1758802420; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+oA1EqdG3ZaYUrig5a2R7esA1n5VsBIXfb4bGmd5S/8=; b=gp6CrHm840/xvx/98bCd0RmjpHiiS87KtCdbkJLns8DtfdfaGW5GCTeV06iKFdcaE/ 81lguL5cUUq9Q5abLaI02LQNlv0dLlnmQcEjx/VFmcn+V/gUtT8LzfNy4f+WfzV3tTqT NaJmM64YQIHricmkeJfSLhMHHXhnm1OwtcOF6G+8PhYBe8ZXCxb8LJfkq8hwoMFMumvR qbeTwCO+ImRMRBjmuzwnhVye9f/B7RhJWRybI2z5S8deW0tPBEo0dmsxNiBwEVxriOhF 1f5Mrr1AbVuhK7y/5brddTHYk9xRo3LdZpxP7+3yh2DKM0Mwy5sgK2zB/3VDpq5bcpn/ d5Tw== X-Gm-Message-State: AOJu0YxBXtAeWTWp/sHMwMHqZFJGUsGW8qXsJ9QC6PrYcxY2pxNnrNnX 3Et5vU8Fmu7nfOKkjBmQW36f1kQZ95rj8SbC8SC4a7W5XTmupPKoxSVc X-Gm-Gg: ASbGncsmGCZb2YwK0HlexFe+5IORV1XYIZ9yjalDaUfwCJk6d+tU6vHiWI/VjuQROyU FUrkUTU3zf+3b5y9BMwItCARdbCD/PcN6ZHmSV5X/E7PjNzDTBIAe7i9E0TkU70JtHMjvLTWZgj 0AExR3kX5oGhXxJwl1adW6Bb7nYD4GKg9pOKu/Et5BqlA1qt/UrB02s/f1HWq7hThgim6nj9YhV qJGiae5JoVhjVw3PEkIUA52vmOnjySQ7Xj28iE8itmDQRYE/LjJBbNrTigFloJug6Fe9NtoCMkL rbkb8KZvi9BMAWtQICc68GV8GdOKSpJZxFfrlgNn80XiyTseA+BHLbH2Gb5Gv333cjaRGk2eUJq jWI4pm1GEYAVA99hb0V9/vmz0IJZ6B6hI+6Zc6FQPsrn99RVpxa4aG1QIvAZXX4EXPxom5lpb8k +jfkHZpIgJfpc17k4wRCpCcQ== X-Google-Smtp-Source: AGHT+IHaWs43hwNebF+u8cDrbsFeSgHWNax7eCOWWpmAddYVM297Sxy9MwpRWX7qWPKmSvWLnNvLKA== X-Received: by 2002:a05:6214:5099:b0:773:7118:306f with SMTP id 6a1803df08f44-78ece369c41mr74027136d6.39.1758197620095; Thu, 18 Sep 2025 05:13:40 -0700 (PDT) Received: from localhost (modemcable197.17-162-184.mc.videotron.ca. [184.162.17.197]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-79354c9f26esm12044236d6.62.2025.09.18.05.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Sep 2025 05:13:39 -0700 (PDT) From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Lessard?= To: Andy Shevchenko , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] auxdisplay: linedisp: display static message when length <= display size Date: Thu, 18 Sep 2025 08:13:13 -0400 Message-ID: <20250918121321.116248-4-jefflessard3@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250918121321.116248-1-jefflessard3@gmail.com> References: <20250918121321.116248-1-jefflessard3@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Currently, when a message shorter than the display size is written, the content wraps around (e.g., "123" on a 4-digit display shows "1231") without scrolling, which is confusing and unintuitive. Change behavior to display short messages statically with space padding (e.g. "123 ") while only scrolling messages longer than the display width. This provides more natural behavior that aligns with user expectations and current linedisp_display() kernel-doc. The scroll logic is also consolidated into a helper function for clarity. No API changes are introduced. Signed-off-by: Jean-Fran=C3=A7ois Lessard --- drivers/auxdisplay/line-display.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-di= splay.c index e44341b1ea22..73e4e77ea4f9 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -36,6 +36,11 @@ static struct linedisp *to_linedisp(struct device *dev) return container_of(dev, struct linedisp, dev); } =20 +static inline bool should_scroll(struct linedisp *linedisp) +{ + return linedisp->message_len > linedisp->num_chars && linedisp->scroll_ra= te; +} + /** * linedisp_scroll() - scroll the display by a character * @t: really a pointer to the private data structure @@ -67,8 +72,7 @@ static void linedisp_scroll(struct timer_list *t) linedisp->scroll_pos %=3D linedisp->message_len; =20 /* rearm the timer */ - if (linedisp->message_len > num_chars && linedisp->scroll_rate) - mod_timer(&linedisp->timer, jiffies + linedisp->scroll_rate); + mod_timer(&linedisp->timer, jiffies + linedisp->scroll_rate); } =20 /** @@ -118,8 +122,16 @@ static int linedisp_display(struct linedisp *linedisp,= const char *msg, linedisp->message_len =3D count; linedisp->scroll_pos =3D 0; =20 - /* update the display */ - linedisp_scroll(&linedisp->timer); + if (should_scroll(linedisp)) { + /* display scrolling message */ + linedisp_scroll(&linedisp->timer); + } else { + /* display static message */ + memset(linedisp->buf, ' ', linedisp->num_chars); + memcpy(linedisp->buf, linedisp->message, + umin(linedisp->num_chars, linedisp->message_len)); + linedisp->ops->update(linedisp); + } =20 return 0; } @@ -186,12 +198,12 @@ static ssize_t scroll_step_ms_store(struct device *de= v, if (err) return err; =20 + timer_delete_sync(&linedisp->timer); + linedisp->scroll_rate =3D msecs_to_jiffies(ms); - if (linedisp->message && linedisp->message_len > linedisp->num_chars) { - timer_delete_sync(&linedisp->timer); - if (linedisp->scroll_rate) - linedisp_scroll(&linedisp->timer); - } + + if (should_scroll(linedisp)) + linedisp_scroll(&linedisp->timer); =20 return count; } --=20 2.43.0