From: Bryan O'Donoghue <pure.logic@nexus-software.ie>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-i2c@vger.kernel.org
Cc: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Andi Shyti <andi.shyti@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 12/15] i2c: qcom-geni: use 'time_left' variable with wait_for_completion_timeout()
Date: Mon, 29 Apr 2024 11:52:45 +0100 [thread overview]
Message-ID: <0703c962-727f-439c-ba56-ff70288f7224@nexus-software.ie> (raw)
In-Reply-To: <20240427203611.3750-13-wsa+renesas@sang-engineering.com>
On 27/04/2024 21:36, 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.
>
> Fix to the proper variable type 'unsigned long' while here.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> drivers/i2c/busses/i2c-qcom-geni.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index 090b4846ed62..0a8b95ce35f7 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -586,7 +586,8 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i
> {
> struct dma_slave_config config = {};
> struct gpi_i2c_config peripheral = {};
> - int i, ret = 0, timeout;
> + int i, ret = 0;
> + unsigned long time_left;
> dma_addr_t tx_addr, rx_addr;
> void *tx_buf = NULL, *rx_buf = NULL;
> const struct geni_i2c_clk_fld *itr = gi2c->clk_fld;
> @@ -629,8 +630,8 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i
>
> dma_async_issue_pending(gi2c->tx_c);
>
> - timeout = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT);
> - if (!timeout)
> + time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT);
> + if (!time_left)
> gi2c->err = -ETIMEDOUT;
>
> if (gi2c->err) {
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
next prev parent reply other threads:[~2024-04-29 10:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-27 20:35 [PATCH 00/15] i2c: use 'time_left' with wait_for_* Wolfram Sang
2024-04-27 20:35 ` [PATCH 01/15] i2c: amd-mp2-plat: use 'time_left' variable with wait_for_completion_timeout() Wolfram Sang
2024-04-27 20:35 ` [PATCH 02/15] i2c: digicolor: " Wolfram Sang
2024-04-28 4:38 ` Baruch Siach
2024-04-27 20:35 ` [PATCH 03/15] i2c: exynos5: " Wolfram Sang
2024-04-27 20:35 ` [PATCH 04/15] i2c: hix5hd2: " Wolfram Sang
2024-04-27 20:35 ` [PATCH 05/15] i2c: imx-lpi2c: " Wolfram Sang
2024-04-28 1:45 ` Peng Fan
2024-04-27 20:35 ` [PATCH 06/15] i2c: omap: " Wolfram Sang
2024-04-27 20:35 ` [PATCH 07/15] i2c: st: " Wolfram Sang
2024-04-28 12:15 ` Uwe Kleine-König
2024-04-27 20:36 ` [PATCH 08/15] i2c: stm32f4: " Wolfram Sang
2024-04-27 20:36 ` [PATCH 09/15] i2c: stm32f7: " Wolfram Sang
2024-04-27 20:36 ` [PATCH 10/15] i2c: synquacer: " Wolfram Sang
2024-04-29 6:56 ` Ard Biesheuvel
2024-04-27 20:36 ` [PATCH 11/15] i2c: jz4780: " Wolfram Sang
2024-04-30 12:43 ` Philippe Mathieu-Daudé
2024-04-30 12:49 ` Paul Cercueil
2024-04-27 20:36 ` [PATCH 12/15] i2c: qcom-geni: " Wolfram Sang
2024-04-29 10:52 ` Bryan O'Donoghue [this message]
2024-04-30 2:10 ` Bjorn Andersson
2024-04-27 20:36 ` [PATCH 13/15] i2c: rk3x: use 'time_left' variable with wait_event_timeout() Wolfram Sang
2024-04-27 20:36 ` [PATCH 14/15] i2c: s3c2410: " Wolfram Sang
2024-04-27 20:36 ` [PATCH 15/15] i2c: pxa: " Wolfram Sang
2024-04-30 0:07 ` [PATCH 00/15] i2c: use 'time_left' with wait_for_* Andi Shyti
2024-05-02 11:29 ` Andi Shyti
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=0703c962-727f-439c-ba56-ff70288f7224@nexus-software.ie \
--to=pure.logic@nexus-software.ie \
--cc=andersson@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.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