From patchwork Mon Sep 6 06:33:51 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: 157411 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 o866ZaDj009750 for ; Mon, 6 Sep 2010 06:35:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753721Ab0IFGe3 (ORCPT ); Mon, 6 Sep 2010 02:34:29 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:24570 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746Ab0IFGe2 (ORCPT ); Mon, 6 Sep 2010 02:34:28 -0400 Received: from eu_spt2 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0L8B002XABLE60@mailout1.w1.samsung.com>; Mon, 06 Sep 2010 07:34:26 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0L8B00EKHBLD32@spt2.w1.samsung.com>; Mon, 06 Sep 2010 07:34:26 +0100 (BST) Received: from pikus.localdomain (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id C421527004B; Mon, 06 Sep 2010 08:31:09 +0200 (CEST) Date: Mon, 06 Sep 2010 08:33:51 +0200 From: Michal Nazarewicz Subject: [RFCv5 1/9] lib: rbtree: rb_root_init() function added In-reply-to: To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , Daniel Walker , FUJITA Tomonori , Hans Verkuil , Jonathan Corbet , KAMEZAWA Hiroyuki , Konrad Rzeszutek Wilk , Kyungmin Park , Marek Szyprowski , Mel Gorman , Minchan Kim , Pawel Osciak , Peter Zijlstra , Russell King , Zach Pfeffer , linux-kernel@vger.kernel.org Message-id: <77e08b611d45c8b830d59a7d111105d3a597fc5c.1283749231.git.mina86@mina86.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.1 Content-type: TEXT/PLAIN Content-transfer-encoding: 7BIT 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]); Mon, 06 Sep 2010 06:35:36 +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)