linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Sun Jian <sun.jian.kdev@gmail.com>
Cc: linux-staging@lists.linux.dev, sudipm.mukherjee@gmail.com,
	teddy.wang@siliconmotion.com, linux-fbdev@vger.kernel.org
Subject: Re: [PATCH v2] staging: sm750fb: fix unused tmp in sw_i2c_wait
Date: Mon, 5 Jan 2026 09:05:15 +0100	[thread overview]
Message-ID: <2026010505-surging-resurface-a7d3@gregkh> (raw)
In-Reply-To: <20260105074917.607201-1-sun.jian.kdev@gmail.com>

On Mon, Jan 05, 2026 at 03:49:17PM +0800, Sun Jian wrote:
> clang W=1 warns that 'tmp' is set but not used in sw_i2c_wait().
> 
> sw_i2c_wait() provides the delay between bit-banged I2C GPIO transitions.
> Replace the loop-count delay with a time-based udelay(1) to avoid CPU-
> dependent timing and fix the warning.

Why is udelay(1) the same here?

> Compile-tested with clang W=1; no hardware available to validate timing.

That's going to prevent us from being able to take this, sorry :(


> 
> Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
> ---
> v2:
> - Replace cpu_relax() delay loop with time-based udelay(1) to avoid
>   CPU-dependent timing (per Greg's feedback).
> 
> v1:
> - Used cpu_relax() in the loop to silence -Wunused-but-set-variable.
> ---
>  drivers/staging/sm750fb/ddk750_swi2c.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
> index 0ef8d4ff2ef9..d5843fa69bfa 100644
> --- a/drivers/staging/sm750fb/ddk750_swi2c.c
> +++ b/drivers/staging/sm750fb/ddk750_swi2c.c
> @@ -11,6 +11,7 @@
>  #include "ddk750_reg.h"
>  #include "ddk750_swi2c.h"
>  #include "ddk750_power.h"
> +#include <linux/delay.h>

Shouldn't this be at the top of the include lines?

>  
>  /*
>   * I2C Software Master Driver:
> @@ -92,12 +93,7 @@ static void sw_i2c_wait(void)
>       * it's more reliable than counter loop ..
>       * write 0x61 to 0x3ce and read from 0x3cf
>       */
> -	int i, tmp;
> -
> -	for (i = 0; i < 600; i++) {
> -		tmp = i;
> -		tmp += i;
> -	}
> +	udelay(1);

You are ignoring the comments in this function.

Also, if you reduce this to a single call, shouldn't this whole function
be removed?

thanks,

greg k-h

  reply	other threads:[~2026-01-05  8:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  2:10 [PATCH] staging: sm750fb: fix unused tmp in sw_i2c_wait Sun Jian
2026-01-05  6:28 ` Greg KH
2026-01-05  7:49 ` [PATCH v2] " Sun Jian
2026-01-05  8:05   ` Greg KH [this message]
2026-01-05  8:57     ` sun jian
2026-01-05  9:12       ` Greg KH

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=2026010505-surging-resurface-a7d3@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=sun.jian.kdev@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;
as well as URLs for NNTP newsgroup(s).