Skip to content

Commit e98920d

Browse files
GTLin08jhedberg
authored andcommitted
drivers/i2c: it51xxx: Fix build assert to check port number instead of inst
Currently the build assert checks the number of I2C instances as the available I2C target mode, which is incorrect. This patch updates the build assert to check the I2C port_num instead, since IT51xxx only supports I2C target mode on ports 0 to 2. Signed-off-by: Tim Lin <[email protected]>
1 parent 637082e commit e98920d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/i2c/i2c_ite_it51xxx.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,8 +1946,9 @@ static int i2c_it51xxx_init(const struct device *dev)
19461946
(DT_INST_PROP(inst, clock_frequency) == I2C_BITRATE_FAST) || \
19471947
(DT_INST_PROP(inst, clock_frequency) == I2C_BITRATE_FAST_PLUS), \
19481948
"Not support I2C bit rate value"); \
1949-
BUILD_ASSERT(!(DT_INST_PROP(inst, target_enable) && (inst > SMB_CHANNEL_C)), \
1950-
"Only instances 0~2 can enable target-enable"); \
1949+
BUILD_ASSERT(!(DT_INST_PROP(inst, target_enable) && \
1950+
(DT_INST_PROP(inst, port_num) > SMB_CHANNEL_C)), \
1951+
"Only ports 0~2 support I2C target mode"); \
19511952
static const struct i2c_it51xxx_config i2c_it51xxx_cfg_##inst = { \
19521953
.i2cbase = DT_REG_ADDR_BY_IDX(DT_NODELABEL(i2cbase), 0), \
19531954
.i2cbase_mapping = DT_REG_ADDR_BY_IDX(DT_NODELABEL(i2cbase), 1), \

0 commit comments

Comments
 (0)