public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: OaroraEtimis <oaroraetimis@gmail.com>
Cc: sudipm.mukherjee@gmail.com, teddy.wang@siliconmotion.com,
	linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] staging: sm750fb: Replace busy-wait loop with udelay()
Date: Mon, 16 Mar 2026 09:16:53 +0100	[thread overview]
Message-ID: <2026031644-astronaut-unable-ac49@gregkh> (raw)
In-Reply-To: <495a2eb6-619e-4ad8-b550-678f7334819e@gmail.com>

On Mon, Mar 16, 2026 at 03:42:04PM +0800, OaroraEtimis wrote:
> Hi Greg,
> 
> Thanks for the review. Sorry for dropping the historical comment in v2. My
> only goal was to fix the -Wunused-but-set-variable warning and prevent the
> loop from being optimized away by the compiler.
> 
> I will definitely restore the comment.
> 
> 
> On Mon, Mar 16, 2026 at 14:11, Greg KH wrote:
> 
> > How is "2" the same as this busy loop?
> 
> It was a rough estimation. A 600-iteration empty loop on older CPUs
> (~500MHz) took about 2 to 3 microseconds.
> 
> 
> > And why not fix this properly, as the comment states?
> 
> The comment suggests writing to VGA ports (0x3ce/0x3cf) to force a delay. I
> didn't implement this because I don't have the specific hardware or
> datasheets to test it.
> 
> I was afraid that introducing direct VGA I/O just to fix a compiler warning
> might cause unexpected hardware regressions *or compatibility issues across
> different platforms.*
> 
> Given that I can't test hardware I/O, how would you prefer I handle this in
> v3?

Don't do any logical change that testing without hardware can not be
verified (i.e. whitespace changes).

> 1. Keep the original loop but add cpu_relax() inside to prevent compiler
> optimization. (Safest for the hardware)

Are you sure?  Can you sleep at that point in time?  What does the
performance of the device then look like?

> 2. Use udelay(2) (or ndelay) and restore the historical comment.
> 3. Migrate the driver to the standard i2c-algo-bit framework (a much heavier
> refactoring).

Number 3 is the best way.

good luck!

greg k-h

      reply	other threads:[~2026-03-16  8:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-15 23:20 [PATCH v2 1/2] staging: sm750fb: Replace busy-wait loop with udelay() Oarora Etimis
2026-03-16  6:11 ` Greg KH
2026-03-16  7:42   ` OaroraEtimis
2026-03-16  8:16     ` Greg KH [this message]

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=2026031644-astronaut-unable-ac49@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=oaroraetimis@gmail.com \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=teddy.wang@siliconmotion.com \
    /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