public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Jian Zhang <zhangjian.3032@bytedance.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: slave-eeprom: add latch mode
Date: Mon, 19 May 2025 19:03:04 +0200	[thread overview]
Message-ID: <aCtkSBZfkc2k1jnb@shikoro> (raw)
In-Reply-To: <20241209060422.1021512-1-zhangjian.3032@bytedance.com>

[-- Attachment #1: Type: text/plain, Size: 984 bytes --]

On Mon, Dec 09, 2024 at 02:04:21PM +0800, Jian Zhang wrote:
> The read operation is locked by byte, while the write operation is
> locked by block (or based on the amount of data written). If we need to
> ensure the integrity of a "block" of data that the other end can read,
> then we need a latch mode, lock the buffer when a read operation is
> requested.

I don't really understand what you want to fix here. Does this patch
really fix your issue because...

>  	switch (event) {
>  	case I2C_SLAVE_WRITE_RECEIVED:
> +		if (eeprom->latch) {
> +			spin_lock(&eeprom->buffer_lock);
> +			memcpy(eeprom->buffer_latch, eeprom->buffer, eeprom->bin.size);
> +			spin_unlock(&eeprom->buffer_lock);
> +		}

... what advantage brings you this memcpy of the buffer to a latch after
every single byte is received?

> +	if (of_property_read_bool(client->adapter->dev.of_node, "use-latch")) {

If there really is a problem, we don't need a binding for it but should
use the fix in all cases.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-05-19 17:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09  6:04 [PATCH] i2c: slave-eeprom: add latch mode Jian Zhang
2025-05-19 17:03 ` Wolfram Sang [this message]
2025-05-20  3:01   ` [External] " Zhang Jian

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=aCtkSBZfkc2k1jnb@shikoro \
    --to=wsa+renesas@sang-engineering.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhangjian.3032@bytedance.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