Skip to content

Commit 992991c

Browse files
Davidlohr Buesotorvalds
authored andcommitted
fs/eventpoll.c: simplify ep_is_linked() callers
Instead of having each caller pass the rdllink explicitly, just have ep_is_linked() pass it while the callers just need the epi pointer. This helper is all about the rdllink, and this change, furthermore, improves the function's self documentation. Link: http://lkml.kernel.org/r/20180727053432.16679-3-dave@stgolabs.net Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Jason Baron <jbaron@akamai.com> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 679abf3 commit 992991c

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎fs/eventpoll.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ static inline int ep_cmp_ffd(struct epoll_filefd *p1,
336336
}
337337

338338
/* Tells us if the item is currently linked */
339-
static inline int ep_is_linked(struct list_head *p)
339+
static inline int ep_is_linked(struct epitem *epi)
340340
{
341-
return !list_empty(p);
341+
return !list_empty(&epi->rdllink);
342342
}
343343

344344
static inline struct eppoll_entry *ep_pwq_from_wait(wait_queue_entry_t *p)
@@ -721,7 +721,7 @@ static __poll_t ep_scan_ready_list(struct eventpoll *ep,
721721
* queued into ->ovflist but the "txlist" might already
722722
* contain them, and the list_splice() below takes care of them.
723723
*/
724-
if (!ep_is_linked(&epi->rdllink)) {
724+
if (!ep_is_linked(epi)) {
725725
list_add_tail(&epi->rdllink, &ep->rdllist);
726726
ep_pm_stay_awake(epi);
727727
}
@@ -790,7 +790,7 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi)
790790
rb_erase_cached(&epi->rbn, &ep->rbr);
791791

792792
spin_lock_irq(&ep->wq.lock);
793-
if (ep_is_linked(&epi->rdllink))
793+
if (ep_is_linked(epi))
794794
list_del_init(&epi->rdllink);
795795
spin_unlock_irq(&ep->wq.lock);
796796

@@ -1171,7 +1171,7 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v
11711171
}
11721172

11731173
/* If this file is already in the ready list we exit soon */
1174-
if (!ep_is_linked(&epi->rdllink)) {
1174+
if (!ep_is_linked(epi)) {
11751175
list_add_tail(&epi->rdllink, &ep->rdllist);
11761176
ep_pm_stay_awake_rcu(epi);
11771177
}
@@ -1495,7 +1495,7 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
14951495
ep_set_busy_poll_napi_id(epi);
14961496

14971497
/* If the file is already "ready" we drop it inside the ready list */
1498-
if (revents && !ep_is_linked(&epi->rdllink)) {
1498+
if (revents && !ep_is_linked(epi)) {
14991499
list_add_tail(&epi->rdllink, &ep->rdllist);
15001500
ep_pm_stay_awake(epi);
15011501

@@ -1533,7 +1533,7 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
15331533
* And ep_insert() is called with "mtx" held.
15341534
*/
15351535
spin_lock_irq(&ep->wq.lock);
1536-
if (ep_is_linked(&epi->rdllink))
1536+
if (ep_is_linked(epi))
15371537
list_del_init(&epi->rdllink);
15381538
spin_unlock_irq(&ep->wq.lock);
15391539

@@ -1601,7 +1601,7 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi,
16011601
*/
16021602
if (ep_item_poll(epi, &pt, 1)) {
16031603
spin_lock_irq(&ep->wq.lock);
1604-
if (!ep_is_linked(&epi->rdllink)) {
1604+
if (!ep_is_linked(epi)) {
16051605
list_add_tail(&epi->rdllink, &ep->rdllist);
16061606
ep_pm_stay_awake(epi);
16071607

0 commit comments

Comments
 (0)