Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

elevator: use list_{first,prev,next}_entry

To make the intention clearer, use list_{first,prev,next}_entry
instead of list_entry.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Jens Axboe <axboe@fb.com>

authored by

Geliang Tang and committed by
Jens Axboe
4736346b d09f9581

+5 -5
+5 -5
block/noop-iosched.c
··· 21 21 static int noop_dispatch(struct request_queue *q, int force) 22 22 { 23 23 struct noop_data *nd = q->elevator->elevator_data; 24 + struct request *rq; 24 25 25 - if (!list_empty(&nd->queue)) { 26 - struct request *rq; 27 - rq = list_entry(nd->queue.next, struct request, queuelist); 26 + rq = list_first_entry_or_null(&nd->queue, struct request, queuelist); 27 + if (rq) { 28 28 list_del_init(&rq->queuelist); 29 29 elv_dispatch_sort(q, rq); 30 30 return 1; ··· 46 46 47 47 if (rq->queuelist.prev == &nd->queue) 48 48 return NULL; 49 - return list_entry(rq->queuelist.prev, struct request, queuelist); 49 + return list_prev_entry(rq, queuelist); 50 50 } 51 51 52 52 static struct request * ··· 56 56 57 57 if (rq->queuelist.next == &nd->queue) 58 58 return NULL; 59 - return list_entry(rq->queuelist.next, struct request, queuelist); 59 + return list_next_entry(rq, queuelist); 60 60 } 61 61 62 62 static int noop_init_queue(struct request_queue *q, struct elevator_type *e)