From patchwork Mon Jul 26 14:11: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: 114281 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 o6QEBo6J029247 for ; Mon, 26 Jul 2010 14:11:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754350Ab0GZOKe (ORCPT ); Mon, 26 Jul 2010 10:10:34 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:21019 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754291Ab0GZOKd (ORCPT ); Mon, 26 Jul 2010 10:10:33 -0400 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Received: from eu_spt1 ([210.118.77.13]) by mailout3.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0L6600LVZ4PEJ530@mailout3.w1.samsung.com>; Mon, 26 Jul 2010 15:10:27 +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 <0L660011W4PE13@spt1.w1.samsung.com>; Mon, 26 Jul 2010 15:10:26 +0100 (BST) Received: from pikus.digital.local (unknown [106.116.48.169]) by linux.samsung.com (Postfix) with ESMTP id 4703A27004B; Mon, 26 Jul 2010 16:08:26 +0200 (CEST) Date: Mon, 26 Jul 2010 16:11:41 +0200 From: Michal Nazarewicz Subject: [PATCHv2 1/4] lib: rbtree: rb_root_init() function added In-reply-to: To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk, Hiremath Vaibhav , Marek Szyprowski , Pawel Osciak , Mark Brown , Daniel Walker , Jonathan Corbet , FUJITA Tomonori , Zach Pfeffer , Kyungmin Park , Michal Nazarewicz Message-id: <743102607e2c5fb20e3c0676fadbcb93d501a78e.1280151963.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]); Mon, 26 Jul 2010 14:11:51 +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)