diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2026-08-01 19:09:29 -0700 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-08-10 08:59:43 -0700 |
| commit | 84f3d13ca48ecd971d8f94ec5a6e4a39ef0296e1 (patch) | |
| tree | b06000c4fe83dbb26982898d04de1cd03512e371 /drivers/hwmon/pmbus | |
| parent | 9d91132f4c15acba1a5be069b52577cc784c7e18 (diff) | |
hwmon: (pmbus/ir36021) Use pmbus_read_smbus_i2c_block_data for block commands
The driver uses i2c_smbus_read_i2c_block_data() for PMBus block commands.
Use pmbus_read_smbus_i2c_block_data() instead to enable the driver to work
with I2C controllers which do not support i2c_smbus_read_i2c_block_data().
Drop the functionality check to get an explicit error message if the
required SMBus commands are not supported.
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/pmbus')
| -rw-r--r-- | drivers/hwmon/pmbus/ir36021.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/hwmon/pmbus/ir36021.c b/drivers/hwmon/pmbus/ir36021.c index 0dce4c3f666f..58d8c4aac0d1 100644 --- a/drivers/hwmon/pmbus/ir36021.c +++ b/drivers/hwmon/pmbus/ir36021.c @@ -31,21 +31,13 @@ static int ir36021_probe(struct i2c_client *client) u8 buf[I2C_SMBUS_BLOCK_MAX]; int ret; - if (!i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_BYTE_DATA - | I2C_FUNC_SMBUS_READ_WORD_DATA - | I2C_FUNC_SMBUS_READ_BLOCK_DATA)) - return -ENODEV; - - ret = i2c_smbus_read_i2c_block_data(client, PMBUS_MFR_MODEL, 2, buf); - if (ret < 0) { - dev_err(&client->dev, "Failed to read PMBUS_MFR_MODEL\n"); - return ret; - } - if (ret != 2 || buf[0] != 0x01 || buf[1] != 0x2d) { - dev_err(&client->dev, "MFR_MODEL unrecognised\n"); - return -ENODEV; - } + ret = pmbus_read_smbus_i2c_block_data(client, PMBUS_MFR_MODEL, buf); + if (ret < 0) + return dev_err_probe(&client->dev, ret, + "Failed to read PMBUS_MFR_MODEL\n"); + if (ret != 1 || buf[0] != 0x2d) + return dev_err_probe(&client->dev, -ENODEV, + "MFR_MODEL unrecognised\n"); return pmbus_do_probe(client, &ir36021_info); } |
