diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c index ab51b46f65..76d754d766 100644 --- a/fs/vfs/fs_epoll.c +++ b/fs/vfs/fs_epoll.c @@ -75,7 +75,7 @@ struct epoll_head_s struct list_node oneshot; /* The oneshot list, store all the epoll * node notified after epoll_wait and with * EPOLLONESHOT events, these oneshot epoll - * nodes can be reset by epoll_ctl (Move + * nodes can be reset by epoll_ctl (move * from oneshot list to the setup list). */ struct list_node free; /* The free list, store all the freed epoll @@ -733,18 +733,7 @@ retry: } else if (timeout > 0) { - clock_t ticks; -#if (MSEC_PER_TICK * USEC_PER_MSEC) != USEC_PER_TICK && \ - defined(CONFIG_HAVE_LONG_LONG) - ticks = (((unsigned long long)timeout * USEC_PER_MSEC) + - (USEC_PER_TICK - 1)) / - USEC_PER_TICK; -#else - ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) / - MSEC_PER_TICK; -#endif - - ret = nxsem_tickwait(&eph->sem, ticks); + ret = nxsem_tickwait(&eph->sem, MSEC2TICK(timeout)); } else { @@ -812,18 +801,7 @@ retry: } else if (timeout > 0) { - clock_t ticks; -#if (MSEC_PER_TICK * USEC_PER_MSEC) != USEC_PER_TICK && \ - defined(CONFIG_HAVE_LONG_LONG) - ticks = (((unsigned long long)timeout * USEC_PER_MSEC) + - (USEC_PER_TICK - 1)) / - USEC_PER_TICK; -#else - ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) / - MSEC_PER_TICK; -#endif - - ret = nxsem_tickwait(&eph->sem, ticks); + ret = nxsem_tickwait(&eph->sem, MSEC2TICK(timeout)); } else { diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c index 7c23197c47..ec2f13b68a 100644 --- a/fs/vfs/fs_poll.c +++ b/fs/vfs/fs_poll.c @@ -426,8 +426,6 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout) } else if (timeout > 0) { - clock_t ticks; - /* "Implementations may place limitations on the granularity of * timeout intervals. If the requested timeout interval requires * a finer granularity than the implementation supports, the @@ -437,16 +435,6 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout) * Round timeout up to next full tick. */ -#if (MSEC_PER_TICK * USEC_PER_MSEC) != USEC_PER_TICK && \ - defined(CONFIG_HAVE_LONG_LONG) - ticks = (((unsigned long long)timeout * USEC_PER_MSEC) + - (USEC_PER_TICK - 1)) / - USEC_PER_TICK; -#else - ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) / - MSEC_PER_TICK; -#endif - /* Either wait for either a poll event(s), for a signal to occur, * or for the specified timeout to elapse with no event. * @@ -455,7 +443,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout) * will return immediately. */ - ret = nxsem_tickwait(&sem, ticks); + ret = nxsem_tickwait(&sem, MSEC2TICK(timeout)); if (ret < 0) { if (ret == -ETIMEDOUT)