On Sunday 19 April 2015 16:15:11 Ksenija Stanojevic wrote:
32-bit systems using struct timeval will break in the year 2038, so we have to replace that code with more appropriate types. ktime_get() is better than using do_gettimeofday(), because it uses the monotonic clock.
Please check again where the time value is actually used, I suspect that this driver actually requires real time, not monotonic time.
- if (!timeval_buf || (buf_len < 8))
- if (!timeval_buf || (buf_len < 4)) return;
- do_gettimeofday(&tv);
- us = ktime_to_us(ktime_get());
- timeval_buf[0] = (u8)(tv.tv_sec >> 24);
- timeval_buf[1] = (u8)(tv.tv_sec >> 16);
- timeval_buf[2] = (u8)(tv.tv_sec >> 8);
- timeval_buf[3] = (u8)(tv.tv_sec);
- timeval_buf[4] = (u8)(tv.tv_usec >> 24);
- timeval_buf[5] = (u8)(tv.tv_usec >> 16);
- timeval_buf[6] = (u8)(tv.tv_usec >> 8);
- timeval_buf[7] = (u8)(tv.tv_usec);
- timeval_buf[0] = (u8)(us >> 24);
- timeval_buf[1] = (u8)(us >> 16);
- timeval_buf[2] = (u8)(us >> 8);
- timeval_buf[3] = (u8)(us);
}
Here you change the code to return only four bytes instead of eight bytes. Are you sure this is a valid interface change? 32-bit microseconds overflow every 71 minutes, so that looks worse than overflowing in 23 years from now at first.
Arnd