[PATCH 02/31] hwmon: (lm93) use 4-argument i2c_smbus_read_block_data()
From: Dmitry Torokhov
Date: Sat Oct 24 2026 - 23:06:22 EST
Pass the expected command length and destination buffer directly to
i2c_smbus_read_block_data() instead of using a static intermediate
buffer and memcpy.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/hwmon/lm93.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c
index d58a3c2a8593..2cbf0af22f61 100644
--- a/drivers/hwmon/lm93.c
+++ b/drivers/hwmon/lm93.c
@@ -871,8 +871,6 @@ static int lm93_write_word(struct i2c_client *client, u8 reg, u16 value)
return result;
}
-static u8 lm93_block_buffer[I2C_SMBUS_BLOCK_MAX];
-
/*
* read block data into values, retry if not expected length
* fbn => index to lm93_block_read_cmds table
@@ -884,7 +882,8 @@ static void lm93_read_block(struct i2c_client *client, u8 fbn, u8 *values)
for (i = 1; i <= MAX_RETRIES; i++) {
result = i2c_smbus_read_block_data(client,
- lm93_block_read_cmds[fbn].cmd, lm93_block_buffer);
+ lm93_block_read_cmds[fbn].cmd,
+ lm93_block_read_cmds[fbn].len, values);
if (result == lm93_block_read_cmds[fbn].len) {
break;
@@ -895,13 +894,6 @@ static void lm93_read_block(struct i2c_client *client, u8 fbn, u8 *values)
mdelay(i + 3);
}
}
-
- if (result == lm93_block_read_cmds[fbn].len) {
- memcpy(values, lm93_block_buffer,
- lm93_block_read_cmds[fbn].len);
- } else {
- /* <TODO> what to do in case of error? */
- }
}
static struct lm93_data *lm93_update_device(struct device *dev)
--
2.56.0.257.gf7497c7d27-goog