Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4720769ybb; Tue, 24 Mar 2020 04:10:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vswjHuc28tb77JrPSp4/+RNxexVy85a++H5RKYIxV0LAVhs3cdUIOqWPSkCakMZu9PVoC1B X-Received: by 2002:aca:5652:: with SMTP id k79mr2947593oib.15.1585048208841; Tue, 24 Mar 2020 04:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585048208; cv=none; d=google.com; s=arc-20160816; b=O2jxbb13JhqIBs37s5WygMG5B+XbUewsNaChOvomwabWEZzVLR4ojZeSYQnkB+a7Al cvfOOEiu3YDwT4kSQSeLb7d9SSCXf3Kv/3p6vDRKDFFSwPjUz9gCodfRrwWbk+GnNmW3 cFqR0wPfg9gwrkmuJtpDfWE1J6nxW2dLchWi9PoTLKe8lfzHpqSuB003bd/F/I/keWwn lY/hWPybdDr4ea7S2um8K2Otp0SNT895M3lRgill732U/B8SUhEMC2PnWiszvqxblpBQ +tF4wrBgk33MRuTwHNfbUOBtzL2UAgNT+Pyi9IaWKIitY/7f+IjkW1lTyi24Q11eXe/v Z4/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KSKhZY5IpnTi2JYcmFPwE8wNSaGYsBbmLf/pxdPHjEQ=; b=oxgUCp3v1lb2s0G3SZSN1cFK3hJtIuexiqiJIGSnnQ1PGhXDruFBD+ToFmgajbs1cS +aKo9RRAuCzGlASKZ35CdmYR+7AK9lwzRvL2ZwK/UqfdyoREjg/95fTo6XImnL5g6pll 08Gm9kcDX6gS54jdP0AZhvDftSCT78oOHmB1iffZ0f/BM/PfJIp9+AkI+akv6lZMmkix PyCtukgaPbEi5P/NQ3ZK2zdC2KhBMBqloBiuF/tlvtZ18HltgVYbYV75EZbjwRlL5Jl0 4fO5Ofnz4KezIeipc4tJuDkzWhenSyD3QmJGE9qhkOyhlmMlFD37/scuJXyFFGGivjfR 5cJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22si9047260otn.56.2020.03.24.04.09.55; Tue, 24 Mar 2020 04:10:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727186AbgCXLJd (ORCPT + 99 others); Tue, 24 Mar 2020 07:09:33 -0400 Received: from sauhun.de ([88.99.104.3]:49250 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726524AbgCXLJd (ORCPT ); Tue, 24 Mar 2020 07:09:33 -0400 Received: from localhost (p54B3339A.dip0.t-ipconnect.de [84.179.51.154]) by pokefinder.org (Postfix) with ESMTPSA id 45E942C08EF; Tue, 24 Mar 2020 12:09:31 +0100 (CET) Date: Tue, 24 Mar 2020 12:09:30 +0100 From: Wolfram Sang To: Kai-Heng Feng Cc: ajayg@nvidia.com, Andy Shevchenko , "open list:I2C CONTROLLER DRIVER FOR NVIDIA GPU" , open list Subject: Re: [PATCH] i2c: nvidia-gpu: Handle timeout correctly in gpu_i2c_check_status() Message-ID: <20200324110930.GH1134@ninjato> References: <20200311165806.12365-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="y0Ed1hDcWxc3B7cn" Content-Disposition: inline In-Reply-To: <20200311165806.12365-1-kai.heng.feng@canonical.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --y0Ed1hDcWxc3B7cn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > } while (time_is_after_jiffies(target)); > =20 > - 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. --y0Ed1hDcWxc3B7cn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl556l4ACgkQFA3kzBSg KbY/wBAAscToS9q+QNPmVqqgKttmfAF0VSLyRHwM1Tkhfh80JIsC7Q/KEgmY4Qce tRTx+oTMfoUx10VGuwKqGOGUbdoAnDJa0JjNYFW0BXUBV4buVTgnvPZ3LWJFBFv7 cstLgkuwIINFUTLPMDr/07M4TMHLYHbUxwToMsCRtNKWij2u6fQBIhBpFB8nOJ1d vh457vsQLX8ZyR6fbGRVduSDvjmtnE0Z9sw4npphx1gl+Wij4IJmNUmSKOXGEM7a 2Y37hy86NXJN3pveDTmu41XmOFNdEYVjn3TlEAfIZnCIrjC7h3x5FdUP79jomd/h 5PzJXSDRohg/lfH8yVw4xsXO0SchC6atNOB8awXy1JDYiWe3mil8BhvT6BwcI4kB QyBH5pmDDDaTDOd0CGegSWY7SWClCn3sdHGVq7oCunS9UECsCxXX0tD82ACE4alR PQt2vlzy+OsP7sfVD6ZTptOxEt5qwRNbEJwim8BtnwiomjP6KSvS7GNwonSZRMDu NRrRtn5BoHlJG4X45DZwxySSBRwidIn5NdCVURN6rx2yes4yakBP4I/GYpRlFzAF SqEcDqlJBVrftSuS+Xu0qyO5MB8bOKCpAjVBZ1fDte/IYD7KQZ9Mc77alF7anuC1 McYwgeYKFHRwNgOeSixaIg4dIGdHQnQkXimk1sXhIbholsUcJ2Y= =1uKn -----END PGP SIGNATURE----- --y0Ed1hDcWxc3B7cn--