From: Thomas Richard <thomas.richard@bootlin.com>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: Lee Jones <lee@kernel.org>,
mfd@lists.linux.dev, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Markus Haberlander <markus.haberlander@rosenberger.com>
Subject: Re: [PATCH] i2c: cgbc: Fetch the status of a write transfer
Date: Thu, 26 Nov 2026 21:18:07 +0100 [thread overview]
Message-ID: <b0d32861-c123-4f4f-8bac-aa0e7e48c719@bootlin.com> (raw)
In-Reply-To: <awgwO98qx3zX4MaY@zenone.zhora.eu>
On 11/26/26 2:14 PM, Andi Shyti wrote:
> Hi Thomas and Markus,
>
>>> diff --git a/drivers/i2c/busses/i2c-cgbc.c b/drivers/i2c/busses/i2c-cgbc.c
>>> index dfdb9ffc6447..2361591a1e31 100644
>>> --- a/drivers/i2c/busses/i2c-cgbc.c
>>> +++ b/drivers/i2c/busses/i2c-cgbc.c
>>> @@ -254,6 +254,22 @@ static int cgbc_i2c_xfer_msg(struct i2c_adapter *adap)
>>> ret = cgbc_command(cgbc, &cmd, cmd_len, NULL, 0, NULL);
>>> if (ret)
>>> goto err;
>>> +
>>> + ret = read_poll_timeout(cgbc_i2c_get_status, status,
>>> + status != CGBC_I2C_STAT_BUSY, 0,
>>> + 2 * algo_data->read_maxtime_us, false, adap);
>
> would it make sense use USEC_PER_SEC here to preserve the
> existing one-second timeout between write chunks?
read_maxtime_us was computed based on the bus frequency and the maximum
amount of data that can be read by one transfer.
CGBC_I2C_WRITE_MAX_LEN is 32 whereas CGBC_I2C_READ_MAX_LEN is 31, but
multiplied by 2 we should be safe.
If I'm not mistaken, USEC_PER_SEC is only used if master_xfer returns
-EGAIN (arbitration loss), else __i2c_transfer() directly returns so no
1s timeout. And we never return -EAGAIN.
So why should we wait 1s?
Maybe I did not get your point.
Best Regards,
Thomas
prev parent reply other threads:[~2026-11-26 20:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 12:33 Markus Haberlander via B4 Relay
2026-11-26 10:19 ` Thomas Richard (congatec GmbH)
2026-11-26 13:14 ` Andi Shyti
2026-11-26 17:49 ` Andi Shyti
2026-11-26 18:04 ` Thomas Richard
2026-11-26 18:28 ` Lee Jones
2026-11-26 20:18 ` Thomas Richard [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=b0d32861-c123-4f4f-8bac-aa0e7e48c719@bootlin.com \
--to=thomas.richard@bootlin.com \
--cc=andi.shyti@kernel.org \
--cc=lee@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.haberlander@rosenberger.com \
--cc=mfd@lists.linux.dev \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®