[PATCH 1/3] i2c_tools: cosmetic: Avoid hardcoded values

2025-10-24 Thread Olliver Schinagl
From: Olliver Schinagl 

There is a define that indicates the needed value properly, so we should
use that.

Signed-off-by: Olliver Schinagl 
---
 miscutils/i2c_tools.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index 5f41a72ec..e0ca9fe41 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -252,7 +252,7 @@ static int32_t i2c_smbus_read_i2c_block_data(int fd, 
uint8_t cmd,
data.block[0] = len;
 
err = i2c_smbus_access(fd, I2C_SMBUS_READ, cmd,
-  len == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN :
+  len == I2C_SMBUS_BLOCK_MAX ? 
I2C_SMBUS_I2C_BLOCK_BROKEN :
   I2C_SMBUS_I2C_BLOCK_DATA, &data);
if (err < 0)
return err;
-- 
2.51.1.dirty

___
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox


[PATCH 1/3] i2c_tools: cosmetic: Avoid hardcoded values

2023-05-12 Thread Olliver Schinagl
From: Olliver Schinagl 

There is a define that indicates the needed value properly, so we should
use that.

Signed-off-by: Olliver Schinagl 
---
 miscutils/i2c_tools.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index da26f5e19..3a7df3b1e 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -252,7 +252,7 @@ static int32_t i2c_smbus_read_i2c_block_data(int fd, 
uint8_t cmd,
data.block[0] = len;
 
err = i2c_smbus_access(fd, I2C_SMBUS_READ, cmd,
-  len == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN :
+  len == I2C_SMBUS_BLOCK_MAX ? 
I2C_SMBUS_I2C_BLOCK_BROKEN :
   I2C_SMBUS_I2C_BLOCK_DATA, &data);
if (err < 0)
return err;
-- 
2.40.1

___
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox