public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jonas Jelonek <jelonek.jonas@gmail.com>
Cc: "Russell King" <linux@armlinux.org.uk>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Bjørn Mork" <bjorn@mork.no>
Subject: Re: [PATCH] net: sfp: add SMBus I2C block support
Date: Sun, 4 Jan 2026 08:05:34 -0800	[thread overview]
Message-ID: <20260104080534.769d4f87@kernel.org> (raw)
In-Reply-To: <20251228213331.472887-1-jelonek.jonas@gmail.com>

On Sun, 28 Dec 2025 21:33:31 +0000 Jonas Jelonek wrote:
> +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;
> +}

AI code review says:

 Should this return the number of bytes written instead of 0?

 The existing sfp_i2c_write() returns the byte count on success, and several
 callers depend on this return value:

 sfp_cotsworks_fixup_check() checks:
    err = sfp_write(sfp, false, SFP_PHYS_ID, &id->base, 3);
    if (err != 3) { ... error path ... }

 sfp_sm_mod_hpower() via sfp_modify_u8() checks:
    if (err != sizeof(u8)) { ... error path ... }

 With this function returning 0 on success, these checks will always fail,
 causing high-power SFP modules to fail initialization with "failed to enable
 high power" errors, and Cotsworks module EEPROM fixups to fail with "Failed
 to rewrite module EEPROM" errors.

Either way, you'll need to repost, net-next was closed when you posted.
-- 
pw-bot: cr

  reply	other threads:[~2026-01-04 16:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-28 21:33 [PATCH] net: sfp: add SMBus I2C block support Jonas Jelonek
2026-01-04 16:05 ` Jakub Kicinski [this message]
2026-01-05  8:29   ` Maxime Chevallier

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=20260104080534.769d4f87@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=jelonek.jonas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --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