On Tue, Nov 14, 2017 at 11:44:17AM -0500, Michael J. Ruhl wrote: > static inline int event_wait(event_t *e, int timeout) > { > - struct timeval curtime; > struct timespec wait; > int ret; > > - gettimeofday(&curtime, NULL); > - wait.tv_sec = curtime.tv_sec + ((unsigned) timeout) / 1000; > - wait.tv_nsec = (curtime.tv_usec + (((unsigned) timeout) % 1000) * 1000) * 1000; > + clock_gettime(CLOCK_MONOTONIC, &wait); > + wait.tv_sec = wait.tv_sec + ((unsigned int) timeout) / 1000; > + wait.tv_nsec = (wait.tv_nsec + (((unsigned int) timeout) % 1000) * 1000000); since timeout must be positive just declare it as 'unsigned int' in the function signature and all the ugly casts go away and the function argument range is now documented.. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html