From patchwork Fri Aug 6 13:22:07 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: 117808 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o76DNU7a025784 for ; Fri, 6 Aug 2010 13:23:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933842Ab0HFNUq (ORCPT ); Fri, 6 Aug 2010 09:20:46 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:14489 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933059Ab0HFNUq (ORCPT ); Fri, 6 Aug 2010 09:20:46 -0400 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 <0L6Q00897FQJYO90@mailout4.w1.samsung.com>; Fri, 06 Aug 2010 14:20:43 +0100 (BST) 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 <0L6Q00FHBFQJCP@spt1.w1.samsung.com>; Fri, 06 Aug 2010 14:20:43 +0100 (BST) Received: from pikus.digital.local (unknown [106.116.48.169]) by linux.samsung.com (Postfix) with ESMTP id 9C0FB27008E; Fri, 06 Aug 2010 15:18:21 +0200 (CEST) Date: Fri, 06 Aug 2010 15:22:07 +0200 From: Michal Nazarewicz Subject: [PATCH/RFCv3 1/6] lib: rbtree: rb_root_init() function added In-reply-to: To: linux-mm@kvack.org Cc: Hans Verkuil , Marek Szyprowski , Daniel Walker , Jonathan Corbet , Pawel Osciak , Mark Brown , Hiremath Vaibhav , FUJITA Tomonori , Kyungmin Park , Zach Pfeffer , Russell King , jaeryul.oh@samsung.com, kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Nazarewicz Message-id: <743102607e2c5fb20e3c0676fadbcb93d501a78e.1281100495.git.m.nazarewicz@samsung.com> X-Mailer: git-send-email 1.7.1 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 (demeter.kernel.org [140.211.167.41]); Fri, 06 Aug 2010 13:23:31 +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)