From patchwork Fri Aug 20 09:50:41 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: 120606 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 o7K9qtU3025222 for ; Fri, 20 Aug 2010 09:52:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751361Ab0HTJvy (ORCPT ); Fri, 20 Aug 2010 05:51:54 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:61686 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346Ab0HTJvw (ORCPT ); Fri, 20 Aug 2010 05:51:52 -0400 Received: from eu_spt1 (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 <0L7G00HZT3EET1@mailout1.w1.samsung.com>; Fri, 20 Aug 2010 10:51:50 +0100 (BST) Received: from pikus.localdomain ([10.89.8.241]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0L7G008IB3CR4S@spt1.w1.samsung.com>; Fri, 20 Aug 2010 10:51:50 +0100 (BST) Date: Fri, 20 Aug 2010 11:50:41 +0200 From: Michal Nazarewicz Subject: [PATCH/RFCv4 1/6] lib: rbtree: rb_root_init() function added In-reply-to: To: linux-mm@kvack.org Cc: Daniel Walker , FUJITA Tomonori , Hans Verkuil , Jonathan Corbet , Konrad Rzeszutek Wilk , Kyungmin Park , Marek Szyprowski , Mark Brown , Pawel Osciak , Russell King , Zach Pfeffer , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Message-id: <0b02e05fc21e70a3af39e65e628d117cd89d70a1.1282286941.git.m.nazarewicz@samsung.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 (demeter.kernel.org [140.211.167.41]); Fri, 20 Aug 2010 09:52:56 +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)