From patchwork Thu Dec 10 14:17:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 555155 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 925061402BD for ; Fri, 11 Dec 2015 01:21:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=163.com header.i=@163.com header.b=IHB24IV4; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753296AbbLJOV1 (ORCPT ); Thu, 10 Dec 2015 09:21:27 -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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=HYRN8H+hpYVBexxmmb INHzytXmGfEDsQTwKG6Z3CG7g=; b=IHB24IV4y1Lh/aItl/2ly9xUHhQ9SqVQgz aINOMHvtZEwraU1/WYwBAu4WYphppbu0Si2KTNnlR3IT1awOWKn5LKehMqPzJadB U9NZBLFE17azUwqR9vcgndKrdCX80BD50EwSTVjKELQ2wmc9NTJW4T83llTFJHy/ DDt3PsjIs= Received: from localhost (unknown [116.77.128.176]) by smtp5 (Coremail) with SMTP id D9GowADnvHVziWlWaOq0AA--.1567S3; Thu, 10 Dec 2015 22:17:25 +0800 (CST) 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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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