The patch

   regmap: use rb_entry()

has been applied to the regmap tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 671a911bb9aea07360cb253e98acb4b7e6fbdd07 Mon Sep 17 00:00:00 2001
From: Geliang Tang <geliangt...@gmail.com>
Date: Mon, 19 Dec 2016 22:40:25 +0800
Subject: [PATCH] regmap: use rb_entry()

To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangt...@gmail.com>
Signed-off-by: Mark Brown <broo...@kernel.org>
---
 drivers/base/regmap/regcache-rbtree.c | 7 +++----
 drivers/base/regmap/regmap.c          | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/base/regmap/regcache-rbtree.c 
b/drivers/base/regmap/regcache-rbtree.c
index b11af3f2c1db..b1e9aae9a5d0 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -81,7 +81,7 @@ static struct regcache_rbtree_node 
*regcache_rbtree_lookup(struct regmap *map,
 
        node = rbtree_ctx->root.rb_node;
        while (node) {
-               rbnode = container_of(node, struct regcache_rbtree_node, node);
+               rbnode = rb_entry(node, struct regcache_rbtree_node, node);
                regcache_rbtree_get_base_top_reg(map, rbnode, &base_reg,
                                                 &top_reg);
                if (reg >= base_reg && reg <= top_reg) {
@@ -108,8 +108,7 @@ static int regcache_rbtree_insert(struct regmap *map, 
struct rb_root *root,
        parent = NULL;
        new = &root->rb_node;
        while (*new) {
-               rbnode_tmp = container_of(*new, struct regcache_rbtree_node,
-                                         node);
+               rbnode_tmp = rb_entry(*new, struct regcache_rbtree_node, node);
                /* base and top registers of the current rbnode */
                regcache_rbtree_get_base_top_reg(map, rbnode_tmp, &base_reg_tmp,
                                                 &top_reg_tmp);
@@ -152,7 +151,7 @@ static int rbtree_show(struct seq_file *s, void *ignored)
 
        for (node = rb_first(&rbtree_ctx->root); node != NULL;
             node = rb_next(node)) {
-               n = container_of(node, struct regcache_rbtree_node, node);
+               n = rb_entry(node, struct regcache_rbtree_node, node);
                mem_size += sizeof(*n);
                mem_size += (n->blklen * map->cache_word_size);
                mem_size += BITS_TO_LONGS(n->blklen) * sizeof(long);
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ae63bb0875ea..900a319f626e 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -459,7 +459,7 @@ static bool _regmap_range_add(struct regmap *map,
 
        while (*new) {
                struct regmap_range_node *this =
-                       container_of(*new, struct regmap_range_node, node);
+                       rb_entry(*new, struct regmap_range_node, node);
 
                parent = *new;
                if (data->range_max < this->range_min)
@@ -483,7 +483,7 @@ static struct regmap_range_node 
*_regmap_range_lookup(struct regmap *map,
 
        while (node) {
                struct regmap_range_node *this =
-                       container_of(node, struct regmap_range_node, node);
+                       rb_entry(node, struct regmap_range_node, node);
 
                if (reg < this->range_min)
                        node = node->rb_left;
-- 
2.11.0

Reply via email to