lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250321190017.04f6acbc@fedora.home>
Date: Fri, 21 Mar 2025 19:00:17 +0100
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: davem@...emloft.net, Andrew Lunn <andrew@...n.ch>, Jakub Kicinski
 <kuba@...nel.org>, Eric Dumazet <edumazet@...gle.com>, Russell King
 <linux@...linux.org.uk>, Heiner Kallweit <hkallweit1@...il.com>,
 netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
 thomas.petazzoni@...tlin.com, Florian Fainelli <f.fainelli@...il.com>,
 Köry Maincent <kory.maincent@...tlin.com>, Simon Horman
 <horms@...nel.org>, Romain Gantois <romain.gantois@...tlin.com>, Antoine
 Tenart <atenart@...nel.org>, Marek Behún <kabel@...nel.org>,
 Sean Anderson <sean.anderson@...ux.dev>, Bjørn Mork
 <bjorn@...k.no>
Subject: Re: [PATCH net-next v3 1/2] net: phy: sfp: Add support for SMBus
 module access

Hi Paolo,

On Fri, 21 Mar 2025 18:50:54 +0100
Paolo Abeni <pabeni@...hat.com> wrote:

> On 3/14/25 5:23 PM, Maxime Chevallier wrote:
> > @@ -691,14 +692,71 @@ static int sfp_i2c_write(struct sfp *sfp, bool a2, u8 dev_addr, void *buf,
> >  	return ret == ARRAY_SIZE(msgs) ? len : 0;
> >  }
> >  
> > -static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c)
> > +static int sfp_smbus_byte_read(struct sfp *sfp, bool a2, u8 dev_addr,
> > +			       void *buf, size_t len)
> >  {
> > -	if (!i2c_check_functionality(i2c, I2C_FUNC_I2C))
> > -		return -EINVAL;
> > +	u8 bus_addr = a2 ? 0x51 : 0x50;
> > +	union i2c_smbus_data smbus_data;  
> 
> Minor nit: please respect the reverse christmas tree order above.
> 
> > +	u8 *data = buf;
> > +	int ret;
> > +
> > +	while (len) {
> > +		ret = i2c_smbus_xfer(sfp->i2c, bus_addr, 0,
> > +				     I2C_SMBUS_READ, dev_addr,
> > +				     I2C_SMBUS_BYTE_DATA, &smbus_data);
> > +		if (ret < 0)
> > +			return ret;
> > +
> > +		*data = smbus_data.byte;
> > +
> > +		len--;
> > +		data++;
> > +		dev_addr++;
> > +	}
> > +
> > +	return data - (u8 *)buf;
> > +}
> > +
> > +static int sfp_smbus_byte_write(struct sfp *sfp, bool a2, u8 dev_addr,
> > +				void *buf, size_t len)
> > +{
> > +	u8 bus_addr = a2 ? 0x51 : 0x50;
> > +	union i2c_smbus_data smbus_data;  
> 
> same here.

Missed it indeed, I'll address that.

Maxime


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ