drivers: video: common: avoid dead code in functions with retry
Avoid k_sleep() never being called when video_write_reg_retry() and video_read_reg_retry() have a number of retry set to zero (default). The default number of retries being controlled by CONFIG_VIDEO_I2C_RETRY_NUM. Signed-off-by: Josuah Demangeon <me@josuah.net>
This commit is contained in:
parent
c8fd14ecab
commit
a3728d71e9
1 changed files with 6 additions and 4 deletions
|
@ -204,8 +204,9 @@ static int video_read_reg_retry(const struct i2c_dt_spec *i2c, uint8_t *buf_w, s
|
|||
LOG_HEXDUMP_ERR(buf_w, size_w, "failed to write-read to I2C register");
|
||||
return ret;
|
||||
}
|
||||
|
||||
k_sleep(K_MSEC(1));
|
||||
if (CONFIG_VIDEO_I2C_RETRY_NUM > 0) {
|
||||
k_sleep(K_MSEC(1));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -274,8 +275,9 @@ static int video_write_reg_retry(const struct i2c_dt_spec *i2c, uint8_t *buf_w,
|
|||
LOG_HEXDUMP_ERR(buf_w, size, "failed to write to I2C register");
|
||||
return ret;
|
||||
}
|
||||
|
||||
k_sleep(K_MSEC(1));
|
||||
if (CONFIG_VIDEO_I2C_RETRY_NUM > 0) {
|
||||
k_sleep(K_MSEC(1));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue