Re: [PATCH v7] iio: humidity: ens210: Extend I2C functionality check

From: Jonathan Cameron

Date: Sun May 17 2026 - 07:44:40 EST


On Sun, 17 May 2026 12:38:22 +0500
Stepan Ionichev <sozdayvek@xxxxxxxxx> wrote:

> On Fri, May 16, 2026, Jonathan Cameron wrote:
> > Sashiko pointed this out... Take a look at definition of I2C_FUNC_SMBUS_BYTE_DATA
> > and consider if the line above makes sense. Check for other instances of
> > this.
>
> grep across the driver shows what actually gets called:
>
> i2c_smbus_read_byte_data -> I2C_FUNC_SMBUS_READ_BYTE_DATA
> i2c_smbus_write_byte_data -> I2C_FUNC_SMBUS_WRITE_BYTE_DATA
> i2c_smbus_read_word_data -> I2C_FUNC_SMBUS_READ_WORD_DATA
> i2c_smbus_read_i2c_block_data -> I2C_FUNC_SMBUS_READ_I2C_BLOCK
>
> i2c_smbus_write_byte() (without _data) is not called anywhere in the
> driver, so the WRITE_BYTE flag in the current mask is dead. WORD_DATA
> asks for both read and write word data, but only the read side is used.
>
> Minimal correct mask:
>
> I2C_FUNC_SMBUS_BYTE_DATA | /* read + write byte data */
> I2C_FUNC_SMBUS_READ_WORD_DATA |
> I2C_FUNC_SMBUS_READ_I2C_BLOCK
Yes.
>
> Stepan
>