When an epoll_event, that has the EPOLLWAKEUP flag set, is ready, awakeup_source will be active to prevent suspend. This can be used tohandle wakeup events from a driver that support poll, e.g. input, ifthat driver wakes up the waitqueue passed to epoll before allowingsuspend.

/* If this file is already in the ready list we exit soon */- if (!ep_is_linked(&epi->rdllink))+ if (!ep_is_linked(&epi->rdllink)) { list_add_tail(&epi->rdllink, &ep->rdllist);+ __pm_stay_awake(epi->ws);+ }

+/*+ * Request the handling of system wakeup events so as to prevent automatic+ * system suspends from happening while those events are being processed.+ *+ * Assuming neither EPOLLET nor EPOLLONESHOT is set, automatic system suspends+ * will not be re-allowed until epoll_wait is called again after consuming the+ * wakeup event(s).+ *+ * Requires CAP_EPOLLWAKEUP+ */+#define EPOLLWAKEUP (1 << 29)+ /* Set the One Shot behaviour for the target file descriptor */ #define EPOLLONESHOT (1 << 30)