From patchwork Fri Nov 19 15:57:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHDheKAmiBOYXphcmV3aWN6?= X-Patchwork-Id: 339971 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAJFwZb6027294 for ; Fri, 19 Nov 2010 15:58:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755353Ab0KSP61 (ORCPT ); Fri, 19 Nov 2010 10:58:27 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:31934 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755321Ab0KSP60 (ORCPT ); Fri, 19 Nov 2010 10:58:26 -0500 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Received: from eu_spt1 ([210.118.77.14]) by mailout4.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0LC5000A931CI620@mailout4.w1.samsung.com>; Fri, 19 Nov 2010 15:58:24 +0000 (GMT) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LC50012A31B14@spt1.w1.samsung.com>; Fri, 19 Nov 2010 15:58:24 +0000 (GMT) Received: from pikus.digital.local (unknown [106.116.48.169]) by linux.samsung.com (Postfix) with ESMTP id E76282700E9; Fri, 19 Nov 2010 16:58:22 +0100 (CET) Date: Fri, 19 Nov 2010 16:57:59 +0100 From: Michal Nazarewicz Subject: [RFCv6 01/13] lib: rbtree: rb_root_init() function added In-reply-to: To: mina86@mina86.com Cc: Andrew Morton , Ankita Garg , Bryan Huntsman , Daniel Walker , FUJITA Tomonori , Hans Verkuil , Johan Mossberg , Jonathan Corbet , KAMEZAWA Hiroyuki , Konrad Rzeszutek Wilk , Marcus LORENTZON , Marek Szyprowski , Mark Brown , Mel Gorman , Pawel Osciak , Russell King , Vaidyanathan Srinivasan , Zach Pfeffer , dipankar@in.ibm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mm@kvack.org Message-id: X-Mailer: git-send-email 1.7.2.3 References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 19 Nov 2010 15:58:35 +0000 (UTC) diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index 7066acb..5b6dc66 100644 --- a/include/linux/rbtree.h +++ b/include/linux/rbtree.h @@ -130,6 +130,17 @@ static inline void rb_set_color(struct rb_node *rb, int color) } #define RB_ROOT (struct rb_root) { NULL, } + +static inline void rb_root_init(struct rb_root *root, struct rb_node *node) +{ + root->rb_node = node; + if (node) { + node->rb_parent_color = RB_BLACK; /* black, no parent */ + node->rb_left = NULL; + node->rb_right = NULL; + } +} + #define rb_entry(ptr, type, member) container_of(ptr, type, member) #define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)