[PATCH 4/4] elevator: use list_is_{first,last}

From: Geliang Tang
Date: Thu Dec 10 2015 - 09:23:09 EST


For better readability, use list_is_{first,last}() instead of open-coded.

Signed-off-by: Geliang Tang <geliangtang@xxxxxxx>
---
block/noop-iosched.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/noop-iosched.c b/block/noop-iosched.c
index a163c48..d44326e 100644
--- a/block/noop-iosched.c
+++ b/block/noop-iosched.c
@@ -44,7 +44,7 @@ noop_former_request(struct request_queue *q, struct request *rq)
{
struct noop_data *nd = q->elevator->elevator_data;

- if (rq->queuelist.prev == &nd->queue)
+ if (list_is_first(&rq->queuelist, &nd->queue))
return NULL;
return list_prev_entry(rq, queuelist);
}
@@ -54,7 +54,7 @@ noop_latter_request(struct request_queue *q, struct request *rq)
{
struct noop_data *nd = q->elevator->elevator_data;

- if (rq->queuelist.next == &nd->queue)
+ if (list_is_last(&rq->queuelist, &nd->queue))
return NULL;
return list_next_entry(rq, queuelist);
}
--
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/