Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753340AbbLJOV2 (ORCPT ); Thu, 10 Dec 2015 09:21:28 -0500 Received: from m50-135.163.com ([123.125.50.135]:51388 "EHLO m50-135.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752213AbbLJOVY (ORCPT ); Thu, 10 Dec 2015 09:21:24 -0500 From: Geliang Tang To: "Paul E. McKenney" , Jan Kara , Josef Bacik , Josh Triplett Cc: Geliang Tang , Josh Poimboeuf , Seth Jennings , Jiri Kosina , Vojtech Pavlik , Pablo Neira Ayuso , Patrick McHardy , Jozsef Kadlecsik , "David S. Miller" , Jens Axboe , live-patching@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] list: introduce list_is_first() Date: Thu, 10 Dec 2015 22:17:15 +0800 Message-Id: <305feb971ae11e192f35f25d66bb7b2e28e06c39.1449755818.git.geliangtang@163.com> X-Mailer: git-send-email 2.5.0 X-CM-TRANSID: D9GowADnvHVziWlWaOq0AA--.1567S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrKF47ur45ZFyrZryUXrW8Zwb_yoWfuFXE93 43J3ykAr40qFWYqa18GF92gr9xGry3XF1kXrn2qr1UAr98KF4Y9as7XFn5J34kWw43Jry3 Ar1rWryI9w1UGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjdMa5UUUUU== X-Originating-IP: [116.77.128.176] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiJRXMmVUL8tLeVgAAsT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1184 Lines: 40 We already have list_is_last(), it makes sense to also add list_is_first() for consistency. This list utility function to check for first element in a list. Signed-off-by: Geliang Tang --- include/linux/list.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/list.h b/include/linux/list.h index 5356f4d..2c43ef4 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -170,6 +170,17 @@ static inline void list_move_tail(struct list_head *list, } /** + * list_is_first - tests whether @list is the first entry in list @head + * @list: the entry to test + * @head: the head of the list + */ +static inline int list_is_first(const struct list_head *list, + const struct list_head *head) +{ + return list->prev == head; +} + +/** * list_is_last - tests whether @list is the last entry in list @head * @list: the entry to test * @head: the head of the list -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/