From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965414AbcFMIqi (ORCPT ); Mon, 13 Jun 2016 04:46:38 -0400 Received: from www.linutronix.de ([62.245.132.108]:55246 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965355AbcFMImz (ORCPT ); Mon, 13 Jun 2016 04:42:55 -0400 Message-Id: <20160613075929.097956101@linutronix.de> User-Agent: quilt/0.63-1 Date: Mon, 13 Jun 2016 08:40:58 -0000 From: Thomas Gleixner To: LKML Cc: Ingo Molnar , Peter Zijlstra , "Paul E. McKenney" , Eric Dumazet , Frederic Weisbecker , Chris Mason , Arjan van de Ven , rt@linutronix.de Subject: [patch 11/20] hlist: Add hlist_is_last_node() helper References: <20160613070440.950649741@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=hlist--Add-hlist_is_last_node()-helper.patch X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Required to figure out whether the entry is the last one in the hlist. Signed-off-by: Thomas Gleixner --- include/linux/list.h | 10 ++++++++++ 1 file changed, 10 insertions(+) Index: b/include/linux/list.h =================================================================== --- a/include/linux/list.h +++ b/include/linux/list.h @@ -679,6 +679,16 @@ static inline bool hlist_fake(struct hli } /* + * Check whether the node is the last node of the head without + * accessing head. + */ +static inline bool hlist_is_last_node(struct hlist_node *n, + struct hlist_head *h) +{ + return !n->next && n->pprev == &h->first; +} + +/* * Move a list from one list head to another. Fixup the pprev * reference of the first entry if it exists. */