EFM32 I2C: Fix timeout calculation

This commit is contained in:
Masayuki Ishikawa 2017-04-06 17:12:13 +09:00
parent 34b9be8d01
commit f5b6ae627d

View File

@ -553,7 +553,7 @@ static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
#ifdef CONFIG_EFM32_I2C_DYNTIMEO
abstime.tv_nsec += 1000 * efm32_i2c_tousecs(priv->msgc, priv->msgv);
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;
@ -561,7 +561,7 @@ static inline int efm32_i2c_sem_waitdone(FAR struct efm32_i2c_priv_s *priv)
#elif CONFIG_EFM32_I2CTIMEOMS > 0
abstime.tv_nsec += CONFIG_EFM32_I2CTIMEOMS * 1000 * 1000;
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;