Skip to contentSkip to conversation

net: sfp: return the number of written bytes for smbus single byte access

PATCH Applied Maxime Chevallier 3 participants 3 messages Jan 5 – Jan 7

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sfp: return the number of written bytes for smbus single byte access

We expect the SFP write accessors to return the number of written bytes. We fail to do so for single-byte smbus accesses, which may cause errors when setting a module's high-power state and for some cotsworks modules.

Let's return the amount of written bytes, as expected.

Fixes 7662abf4db94 ("net: phy: sfp: Add support for SMBus module access")
---
 drivers/net/phy/sfp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/sfp.c +1 -1
index 6166e9196364..84bef5099dda 100644
@@ -765,7 +765,7 @@ static int sfp_smbus_byte_write(struct sfp *sfp, bool a2, u8 dev_addr,
 		dev_addr++;
 	}
 
-	return 0;
+	return data - (u8 *)buf;
 }
 
 static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c)
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Maxime Chevallier

We expect the SFP write accessors to return the number of written bytes. We fail to do so for single-byte smbus accesses, which may cause errors when setting a module's high-power state and for some cotsworks modules.

Let's return the amount of written bytes, as expected.

Fixes 7662abf4db94 ("net: phy: sfp: Add support for SMBus module access")

Andrew

#2 lore raw
In reply to Maxime Chevallier
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 5 Jan 2026 16:18:39 +0100 you wrote:

We expect the SFP write accessors to return the number of written bytes. We fail to do so for single-byte smbus accesses, which may cause errors when setting a module's high-power state and for some cotsworks modules.

Let's return the amount of written bytes, as expected.

Fixes 7662abf4db94 ("net: phy: sfp: Add support for SMBus module access")

[...]

Here is the summary with links:
- [net] net: sfp: return the number of written bytes for smbus single byte access

    https://git.kernel.org/netdev/net/c/13ff3e724207

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html