Skip to content

Commit c0a421c

Browse files
elmo9999henrikbrixandersen
authored andcommitted
drivers: i2c_dw: Avoid spamming NACK error messages
NACK message now log with LOG_ERR_RATELIMIT instead of LOG_ERR to reduce log noise. When scanning I2C device, receiving a NACK is expected behavior and not necessarily an error. Logging it at LOG_ERR causes unnecessary clutter in the logs. Therefore, the log level is change to LOG_ERR_RATELIMIT for NACK cases. Signed-off-by: Elmo Lan <[email protected]>
1 parent 1f3ce81 commit c0a421c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/i2c/i2c_dw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static int i2c_dw_error_chk(const struct device *dev)
128128
/* check 7bit NACK Tx Abort */
129129
if (ic_txabrt_src.bits.ADDR7BNACK) {
130130
dw->state |= I2C_DW_NACK;
131-
LOG_ERR("NACK on %s", dev->name);
131+
LOG_ERR_RATELIMIT("NACK on %s", dev->name);
132132
}
133133
/* check SDA stuck low Tx abort, need to do bus recover */
134134
if (ic_txabrt_src.bits.SDASTUCKLOW) {
@@ -147,7 +147,7 @@ static int i2c_dw_error_chk(const struct device *dev)
147147
#if CONFIG_I2C_ALLOW_NO_STOP_TRANSACTIONS
148148
dw->need_setup = true;
149149
#endif
150-
LOG_ERR("IO Fail on %s", dev->name);
150+
LOG_ERR_RATELIMIT("IO Fail on %s", dev->name);
151151
return -EIO;
152152
}
153153
return 0;

0 commit comments

Comments
 (0)