[PATCH 03/31] hwmon: (pt5161l) use 4-argument i2c_smbus_read_block_data()

From: Dmitry Torokhov

Date: Sat Oct 24 2026 - 23:06:37 EST


Pass the chunk length and destination buffer directly to
i2c_smbus_read_block_data() instead of copying through an intermediate
buffer.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/hwmon/pt5161l.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/pt5161l.c b/drivers/hwmon/pt5161l.c
index 1638f54f8eae..b38b1f63627a 100644
--- a/drivers/hwmon/pt5161l.c
+++ b/drivers/hwmon/pt5161l.c
@@ -121,7 +121,7 @@ static int pt5161l_read_block_data(struct pt5161l_data *data, u32 address,
int ret, tries;
u8 remain_len = len;
u8 curr_len;
- u8 wbuf[16], rbuf[I2C_SMBUS_BLOCK_MAX];
+ u8 wbuf[16];
u8 cmd = 0x08; /* [7]:pec_en, [4:2]:func, [1]:start, [0]:end */
u8 config = 0x00; /* [6]:cfg_type, [4:1]:burst_len, [0]:address bit16 */

@@ -146,14 +146,13 @@ static int pt5161l_read_block_data(struct pt5161l_data *data, u32 address,
return ret;

ret = i2c_smbus_read_block_data(client, (cmd | 0x1),
- rbuf);
+ curr_len, val);
if (ret == curr_len)
break;
}
if (tries >= 3)
return ret < 0 ? ret : -EIO;

- memcpy(val, rbuf, curr_len);
val += curr_len;
address += curr_len;
}

--
2.56.0.257.gf7497c7d27-goog