linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: ajayg@nvidia.com,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"open list:I2C CONTROLLER DRIVER FOR NVIDIA GPU" 
	<linux-i2c@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i2c: nvidia-gpu: Handle timeout correctly in gpu_i2c_check_status()
Date: Tue, 24 Mar 2020 19:12:13 +0800	[thread overview]
Message-ID: <9771BC92-1785-4E9A-81C7-E72C2C65CE22@canonical.com> (raw)
In-Reply-To: <20200324110930.GH1134@ninjato>

Hi Wolfram,

> On Mar 24, 2020, at 19:09, Wolfram Sang <wsa@the-dreams.de> wrote:
> 
> 
>> 	} while (time_is_after_jiffies(target));
>> 
>> -	if (time_is_before_jiffies(target)) {
>> +	if (time_is_before_eq_jiffies(target)) {
> 
> While unlikely, there is a tiny race between the time_is_* calls,
> jiffies could update inbetween them.
> 
> So, for the sake of good programming practice, I'd recommend to set a
> flag in the do_while-loop and the have the logic above solely based on
> the flag.
> 

Ok, I'll send a v2 based on your suggestion.

Kai-Heng


      reply	other threads:[~2020-03-24 11:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 16:58 [PATCH] i2c: nvidia-gpu: Handle timeout correctly in gpu_i2c_check_status() Kai-Heng Feng
2020-03-23  5:38 ` Kai-Heng Feng
2020-03-23 16:47   ` Ajay Gupta
2020-03-23 17:20     ` Kai-Heng Feng
2020-03-24  3:51       ` Ajay Gupta
2020-03-24 11:09 ` Wolfram Sang
2020-03-24 11:12   ` Kai-Heng Feng [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=9771BC92-1785-4E9A-81C7-E72C2C65CE22@canonical.com \
    --to=kai.heng.feng@canonical.com \
    --cc=ajayg@nvidia.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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).