diff options
author | Joe Perches <joe@perches.com> | 2012-06-03 13:41:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-04 11:45:11 -0400 |
commit | e3192690a3c889767d1161b228374f4926d92af0 (patch) | |
tree | a2acbe06cc2efedb6002055f9d4ffd7f2ba6ec75 /net/ipv4/fib_trie.c | |
parent | 29a6b6c060445eb46528785d51a2d8b0e6d898c4 (diff) |
net: Remove casts to same type
Adding casts of objects to the same type is unnecessary
and confusing for a human reader.
For example, this cast:
int y;
int *p = (int *)&y;
I used the coccinelle script below to find and remove these
unnecessary casts. I manually removed the conversions this
script produces of casts with __force and __user.
@@
type T;
T *p;
@@
- (T *)p
+ p
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r-- | net/ipv4/fib_trie.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 30b88d7b4bd6..18cbc15b20d5 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1007,9 +1007,9 @@ static void trie_rebalance(struct trie *t, struct tnode *tn) | |||
1007 | while (tn != NULL && (tp = node_parent((struct rt_trie_node *)tn)) != NULL) { | 1007 | while (tn != NULL && (tp = node_parent((struct rt_trie_node *)tn)) != NULL) { |
1008 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); | 1008 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); |
1009 | wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); | 1009 | wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); |
1010 | tn = (struct tnode *) resize(t, (struct tnode *)tn); | 1010 | tn = (struct tnode *)resize(t, tn); |
1011 | 1011 | ||
1012 | tnode_put_child_reorg((struct tnode *)tp, cindex, | 1012 | tnode_put_child_reorg(tp, cindex, |
1013 | (struct rt_trie_node *)tn, wasfull); | 1013 | (struct rt_trie_node *)tn, wasfull); |
1014 | 1014 | ||
1015 | tp = node_parent((struct rt_trie_node *) tn); | 1015 | tp = node_parent((struct rt_trie_node *) tn); |
@@ -1024,7 +1024,7 @@ static void trie_rebalance(struct trie *t, struct tnode *tn) | |||
1024 | 1024 | ||
1025 | /* Handle last (top) tnode */ | 1025 | /* Handle last (top) tnode */ |
1026 | if (IS_TNODE(tn)) | 1026 | if (IS_TNODE(tn)) |
1027 | tn = (struct tnode *)resize(t, (struct tnode *)tn); | 1027 | tn = (struct tnode *)resize(t, tn); |
1028 | 1028 | ||
1029 | rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); | 1029 | rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); |
1030 | tnode_free_flush(); | 1030 | tnode_free_flush(); |
@@ -1125,7 +1125,7 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) | |||
1125 | node_set_parent((struct rt_trie_node *)l, tp); | 1125 | node_set_parent((struct rt_trie_node *)l, tp); |
1126 | 1126 | ||
1127 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); | 1127 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); |
1128 | put_child(t, (struct tnode *)tp, cindex, (struct rt_trie_node *)l); | 1128 | put_child(t, tp, cindex, (struct rt_trie_node *)l); |
1129 | } else { | 1129 | } else { |
1130 | /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ | 1130 | /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ |
1131 | /* | 1131 | /* |
@@ -1160,8 +1160,7 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) | |||
1160 | 1160 | ||
1161 | if (tp) { | 1161 | if (tp) { |
1162 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); | 1162 | cindex = tkey_extract_bits(key, tp->pos, tp->bits); |
1163 | put_child(t, (struct tnode *)tp, cindex, | 1163 | put_child(t, tp, cindex, (struct rt_trie_node *)tn); |
1164 | (struct rt_trie_node *)tn); | ||
1165 | } else { | 1164 | } else { |
1166 | rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); | 1165 | rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); |
1167 | tp = tn; | 1166 | tp = tn; |
@@ -1620,7 +1619,7 @@ static void trie_leaf_remove(struct trie *t, struct leaf *l) | |||
1620 | 1619 | ||
1621 | if (tp) { | 1620 | if (tp) { |
1622 | t_key cindex = tkey_extract_bits(l->key, tp->pos, tp->bits); | 1621 | t_key cindex = tkey_extract_bits(l->key, tp->pos, tp->bits); |
1623 | put_child(t, (struct tnode *)tp, cindex, NULL); | 1622 | put_child(t, tp, cindex, NULL); |
1624 | trie_rebalance(t, tp); | 1623 | trie_rebalance(t, tp); |
1625 | } else | 1624 | } else |
1626 | RCU_INIT_POINTER(t->trie, NULL); | 1625 | RCU_INIT_POINTER(t->trie, NULL); |