linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jean-François Lessard" <jefflessard3@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Andy Shevchenko <andy@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] auxdisplay: linedisp: display static message when length <= display size
Date: Tue, 02 Sep 2025 13:12:00 -0400	[thread overview]
Message-ID: <8821938C-2C77-49CA-B2F5-E2A7F0B95449@gmail.com> (raw)
In-Reply-To: <aLbA1Ma9Cig3gbWV@smile.fi.intel.com>

Le 2 septembre 2025 06 h 03 min 00 s HAE, Andy Shevchenko <andriy.shevchenko@intel.com> a écrit :
>On Sun, Aug 31, 2025 at 10:00:26PM -0400, Jean-François Lessard wrote:
>> 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.
>
>...
>
>>  /**
>>   * linedisp_scroll() - scroll the display by a character
>>   * @t: really a pointer to the private data structure
>
>>  	linedisp->scroll_pos %= linedisp->message_len;
>>  
>>  	/* rearm the timer */
>> -	if (linedisp->message_len > num_chars && linedisp->scroll_rate)
>> +	if (should_scroll(linedisp))
>>  		mod_timer(&linedisp->timer, jiffies + linedisp->scroll_rate);
>>  }
>>  
>
>...
>
>>  	linedisp->message_len = count;
>>  	linedisp->scroll_pos = 0;
>>  
>> -	/* 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);
>> +	}
>
>Hmm... But it seems the linedisp_scroll already has a check, why do we need
>an additional one here? Perhaps we need to pad a message somewhere else and
>guarantee it won't ever be less than num_chars?
>

Semantically, linedisp_scroll should scroll. I think it's better to have two
distinct paths with their specific logic:
1. Scroll: circular display and rearm the timer
2. Static: padding and direct update

But you're absolutely right. Given the explicit should_scroll() conditional
outside, the check inside linedisp_scroll() is now redundant. I'll remove it
after testing to streamline the code paths and eliminate the duplication.



  reply	other threads:[~2025-09-02 17:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01  2:00 [PATCH 0/5] auxdisplay: linedisp: support attribute attachment to auxdisplay devices Jean-François Lessard
2025-09-01  2:00 ` [PATCH 1/5] auxdisplay: linedisp: encapsulate container_of usage within to_linedisp Jean-François Lessard
2025-09-01  2:00 ` [PATCH 2/5] auxdisplay: linedisp: display static message when length <= display size Jean-François Lessard
2025-09-02 10:03   ` Andy Shevchenko
2025-09-02 17:12     ` Jean-François Lessard [this message]
2025-09-01  2:00 ` [PATCH 3/5] auxdisplay: linedisp: add num_chars sysfs attribute Jean-François Lessard
2025-09-02 10:04   ` Andy Shevchenko
2025-09-02 17:15     ` Jean-François Lessard
2025-09-01  2:00 ` [PATCH 4/5] auxdisplay: linedisp: support attribute attachment to auxdisplay devices Jean-François Lessard
2025-09-02 10:18   ` Andy Shevchenko
2025-09-02 17:37     ` Jean-François Lessard
2025-09-03 10:18       ` Andy Shevchenko
2025-09-03 11:31         ` Jean-François Lessard
2025-09-01  2:00 ` [PATCH 5/5] docs: ABI: auxdisplay: document linedisp library sysfs attributes Jean-François Lessard
2025-09-02 10:59   ` Andy Shevchenko
2025-09-02 17:42     ` Jean-François Lessard
2025-09-02 11:00 ` [PATCH 0/5] auxdisplay: linedisp: support attribute attachment to auxdisplay devices Andy Shevchenko
2025-09-02 17:44   ` Jean-François Lessard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8821938C-2C77-49CA-B2F5-E2A7F0B95449@gmail.com \
    --to=jefflessard3@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).