From: Jonas Jelonek <jelonek.jonas@gmail.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"Bjørn Mork" <bjorn@mork.no>,
"Maxime Chevallier" <maxime.chevallier@bootlin.com>
Subject: Re: [PATCH v2] net: sfp: add SMBus I2C block support
Date: Mon, 5 Jan 2026 17:19:27 +0100 [thread overview]
Message-ID: <f976d637-defd-4e32-8a82-6705e69246d2@gmail.com> (raw)
In-Reply-To: <aVvjyWzKuczNf3lt@shell.armlinux.org.uk>
Hi Russell,
On 05.01.26 17:16, Russell King (Oracle) wrote:
> On Mon, Jan 05, 2026 at 03:46:53PM +0000, Jonas Jelonek wrote:
>> @@ -765,26 +794,70 @@ static int sfp_smbus_byte_write(struct sfp *sfp, bool a2, u8 dev_addr,
>> dev_addr++;
>> }
>>
>> + return data - (u8 *)buf;
> A separate fix is being submitted for this.
>
>> +}
>> +
>> +static int sfp_smbus_block_write(struct sfp *sfp, bool a2, u8 dev_addr,
>> + void *buf, size_t len)
>> +{
>> + size_t block_size = sfp->i2c_block_size;
>> + union i2c_smbus_data smbus_data;
>> + u8 bus_addr = a2 ? 0x51 : 0x50;
>> + u8 *data = buf;
>> + u8 this_len;
>> + int ret;
>> +
>> + while (len) {
>> + this_len = min(len, block_size);
>> +
>> + smbus_data.block[0] = this_len;
>> + memcpy(&smbus_data.block[1], data, this_len);
>> + ret = i2c_smbus_xfer(sfp->i2c, bus_addr, 0,
>> + I2C_SMBUS_WRITE, dev_addr,
>> + I2C_SMBUS_I2C_BLOCK_DATA, &smbus_data);
>> + if (ret)
>> + return ret;
>> +
>> + len -= this_len;
>> + data += this_len;
>> + dev_addr += this_len;
>> + }
>> +
>> return 0;
> This is wrong. As already said, the I2C accessors return the number of
> bytes successfully transferred. Zero means no bytes were transferred,
> which is an error.
>
> All callers to sfp_write() validate that the expected number of bytes
> were written. Thus, returning zero will cause failures.
>
yes. I totally messed up v2 but already pushed out a v3 that fixes that, and
has the separate fix as a prerequisite.
Sorry for the confusion.
Best,
Jonas
prev parent reply other threads:[~2026-01-05 16:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 15:46 [PATCH v2] net: sfp: add SMBus I2C block support Jonas Jelonek
2026-01-05 15:49 ` Jonas Jelonek
2026-01-05 16:16 ` Russell King (Oracle)
2026-01-05 16:19 ` Jonas Jelonek [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=f976d637-defd-4e32-8a82-6705e69246d2@gmail.com \
--to=jelonek.jonas@gmail.com \
--cc=andrew@lunn.ch \
--cc=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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