From 063f3ed9faf38e41449838bb3258a7d00f75c5d1 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Fri, 10 Mar 2023 17:07:54 +0100 Subject: Move ep_take_care_of_epollwakeup() to fs/eventpoll.c This doesn't make any sense to expose to userspace, so it's been moved to the one user. This was introduced by commit 95f19f658ce1 ("epoll: drop EPOLLWAKEUP if PM_SLEEP is disabled"). Signed-off-by: Palmer Dabbelt Reviewed-by: Andrew Waterman Reviewed-by: Albert Ou Message-Id: <1447119071-19392-7-git-send-email-palmer@dabbelt.com> [thuth: Rebased to fix contextual conflicts] Reviewed-by: Arnd Bergmann Reviewed-by: Christoph Hellwig Signed-off-by: Thomas Huth Signed-off-by: Arnd Bergmann --- fs/eventpoll.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'fs/eventpoll.c') diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 64659b110973..e2a5d2cc9051 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -2042,6 +2042,19 @@ SYSCALL_DEFINE1(epoll_create, int, size) return do_epoll_create(0); } +#ifdef CONFIG_PM_SLEEP +static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev) +{ + if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND)) + epev->events &= ~EPOLLWAKEUP; +} +#else +static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev) +{ + epev->events &= ~EPOLLWAKEUP; +} +#endif + static inline int epoll_mutex_lock(struct mutex *mutex, int depth, bool nonblock) { -- cgit v1.2.3