From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ACF79C4345F for ; Sun, 28 Apr 2024 04:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-reply-to: Date:Subject:Cc:To:From:References:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2NdtlcQI27Q+PS9q7avCsM2ApN7wBL1r6o4hbu06GQo=; b=bb7LFJpcvNBBdn dFU/h39CxKv6Xpi9xa6G3jbfTgNgoq6zS0c/0AGzj/S4gA9rxxGblHMBABs93NE141cdNdx0UN6zk 4BC3qpZHAVdrjwZIkjCTUsc5EEJTfV45h4JE+kBcqq/QxAVMxVaEvPXuc6IscppvN4x5zfChNkACf ScjQf8nKHaCb/VW3Kf8/oxBVUa1o+iwo26H465tZYB9Jws+T6OIqUdMLyIzsRwW8WA4IBzBRxT5sJ Ij4bSxJcQXqelZvW3ojwKfSJoNHYnjhAqHGcRCAOsrx42J/tSzZxL3NounKL3DHKbqGtuElGpd0Gt UyrKh4mBKfjoGaHJYJ/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0wJj-0000000Goi7-2qsZ; Sun, 28 Apr 2024 04:39:11 +0000 Received: from wiki.tkos.co.il ([84.110.109.230] helo=mail.tkos.co.il) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0wJf-0000000Gogo-0cZY for linux-arm-kernel@lists.infradead.org; Sun, 28 Apr 2024 04:39:09 +0000 Received: from localhost (unknown [10.0.8.2]) by mail.tkos.co.il (Postfix) with ESMTP id 18C2E4402B5; Sun, 28 Apr 2024 07:38:39 +0300 (IDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tkos.co.il; s=default; t=1714279119; bh=giGSOh0yZ6SkerlyT8081TSZgFdl+fSuhiMJkcK3yEA=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=dtBw+nzbBW/SPrP3jdj8JLTvfbDR1shk0ID14OjUgR6ZPFOfp8L9GNK7ngjk+UHRh qrPj1effwEV39fvkPWFv1tKU3NEHO+R3Snv5/9oXUOx8+LeDTNLSqybLfJ8E8GyFF1 MLtCbu+qCPiQSRt0o1oUITQZArubOkwFm3J5rIiayhRJvhcfJ3Hg9+H11EJv8boboM 82CAamc8CjprveDVKieQXW/b/yMKZpUP8lYh8xLuxhHchIHDCRM7wyLfFIk9DXclbf QLoKQLvk12uGOSHmVPl9OQp+IBRMyLl7rsSMWHkKdt4BVTSVa56d8ltKmMbi1a8RT1 3qrDVAl+uf26Q== References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> <20240427203611.3750-3-wsa+renesas@sang-engineering.com> User-agent: mu4e 1.10.8; emacs 29.2 From: Baruch Siach To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, Andi Shyti , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/15] i2c: digicolor: use 'time_left' variable with wait_for_completion_timeout() Date: Sun, 28 Apr 2024 07:38:00 +0300 In-reply-to: <20240427203611.3750-3-wsa+renesas@sang-engineering.com> Message-ID: <87il02cd9a.fsf@tarshish> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240427_213907_701635_1708A133 X-CRM114-Status: GOOD ( 16.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Wolfram, On Sat, Apr 27 2024, Wolfram Sang wrote: > There is a confusing pattern in the kernel to use a variable named 'timeout' to > store the result of wait_for_completion_timeout() causing patterns like: > > timeout = wait_for_completion_timeout(...) > if (!timeout) return -ETIMEDOUT; > > with all kinds of permutations. Use 'time_left' as a variable to make the code > self explaining. > > Signed-off-by: Wolfram Sang Acked-by: Baruch Siach Thanks, baruch > --- > drivers/i2c/busses/i2c-digicolor.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-digicolor.c b/drivers/i2c/busses/i2c-digicolor.c > index 3462f2bc0fa8..737604ae11fc 100644 > --- a/drivers/i2c/busses/i2c-digicolor.c > +++ b/drivers/i2c/busses/i2c-digicolor.c > @@ -213,7 +213,7 @@ static irqreturn_t dc_i2c_irq(int irq, void *dev_id) > static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i2c_msg *msg, int first, > int last) > { > - unsigned long timeout = msecs_to_jiffies(TIMEOUT_MS); > + unsigned long time_left = msecs_to_jiffies(TIMEOUT_MS); > unsigned long flags; > > spin_lock_irqsave(&i2c->lock, flags); > @@ -227,9 +227,9 @@ static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i2c_msg *msg, int first, > dc_i2c_start_msg(i2c, first); > spin_unlock_irqrestore(&i2c->lock, flags); > > - timeout = wait_for_completion_timeout(&i2c->done, timeout); > + time_left = wait_for_completion_timeout(&i2c->done, time_left); > dc_i2c_set_irq(i2c, 0); > - if (timeout == 0) { > + if (time_left == 0) { > i2c->state = STATE_IDLE; > return -ETIMEDOUT; > } -- ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il - _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel