diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-12-16 01:05:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-17 16:32:30 -0500 |
commit | 1aee6cc2a5193aa9963ea49b0d452723c1d493d8 (patch) | |
tree | fcf736be5536980161f34e429ccabd1261145689 /net/hsr | |
parent | 7271174fbcbba04aa4f9a0822bedf0faa42d2f38 (diff) |
net/hsr: using kfree_rcu() to simplify the code
The callback function of call_rcu() just calls a kfree(), so we
can use kfree_rcu() instead of call_rcu() + callback function.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Arvid Brodin <arvid.brodin@alten.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/hsr')
-rw-r--r-- | net/hsr/hsr_framereg.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 4bdab1521878..327060c6c874 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c | |||
@@ -127,11 +127,6 @@ int hsr_create_self_node(struct list_head *self_node_db, | |||
127 | return 0; | 127 | return 0; |
128 | } | 128 | } |
129 | 129 | ||
130 | static void node_entry_reclaim(struct rcu_head *rh) | ||
131 | { | ||
132 | kfree(container_of(rh, struct node_entry, rcu_head)); | ||
133 | } | ||
134 | |||
135 | 130 | ||
136 | /* Add/merge node to the database of nodes. 'skb' must contain an HSR | 131 | /* Add/merge node to the database of nodes. 'skb' must contain an HSR |
137 | * supervision frame. | 132 | * supervision frame. |
@@ -175,7 +170,7 @@ struct node_entry *hsr_merge_node(struct hsr_priv *hsr_priv, | |||
175 | if (node && !ether_addr_equal(node->MacAddressA, hsr_sp->MacAddressA)) { | 170 | if (node && !ether_addr_equal(node->MacAddressA, hsr_sp->MacAddressA)) { |
176 | /* Node has changed its AddrA, frame was received from SlaveB */ | 171 | /* Node has changed its AddrA, frame was received from SlaveB */ |
177 | list_del_rcu(&node->mac_list); | 172 | list_del_rcu(&node->mac_list); |
178 | call_rcu(&node->rcu_head, node_entry_reclaim); | 173 | kfree_rcu(node, rcu_head); |
179 | node = NULL; | 174 | node = NULL; |
180 | } | 175 | } |
181 | 176 | ||
@@ -183,7 +178,7 @@ struct node_entry *hsr_merge_node(struct hsr_priv *hsr_priv, | |||
183 | !ether_addr_equal(node->MacAddressB, hsr_ethsup->ethhdr.h_source)) { | 178 | !ether_addr_equal(node->MacAddressB, hsr_ethsup->ethhdr.h_source)) { |
184 | /* Cables have been swapped */ | 179 | /* Cables have been swapped */ |
185 | list_del_rcu(&node->mac_list); | 180 | list_del_rcu(&node->mac_list); |
186 | call_rcu(&node->rcu_head, node_entry_reclaim); | 181 | kfree_rcu(node, rcu_head); |
187 | node = NULL; | 182 | node = NULL; |
188 | } | 183 | } |
189 | 184 | ||
@@ -192,7 +187,7 @@ struct node_entry *hsr_merge_node(struct hsr_priv *hsr_priv, | |||
192 | !ether_addr_equal(node->MacAddressA, hsr_ethsup->ethhdr.h_source)) { | 187 | !ether_addr_equal(node->MacAddressA, hsr_ethsup->ethhdr.h_source)) { |
193 | /* Cables have been swapped */ | 188 | /* Cables have been swapped */ |
194 | list_del_rcu(&node->mac_list); | 189 | list_del_rcu(&node->mac_list); |
195 | call_rcu(&node->rcu_head, node_entry_reclaim); | 190 | kfree_rcu(node, rcu_head); |
196 | node = NULL; | 191 | node = NULL; |
197 | } | 192 | } |
198 | 193 | ||
@@ -417,7 +412,7 @@ void hsr_prune_nodes(struct hsr_priv *hsr_priv) | |||
417 | hsr_nl_nodedown(hsr_priv, node->MacAddressA); | 412 | hsr_nl_nodedown(hsr_priv, node->MacAddressA); |
418 | list_del_rcu(&node->mac_list); | 413 | list_del_rcu(&node->mac_list); |
419 | /* Note that we need to free this entry later: */ | 414 | /* Note that we need to free this entry later: */ |
420 | call_rcu(&node->rcu_head, node_entry_reclaim); | 415 | kfree_rcu(node, rcu_head); |
421 | } | 416 | } |
422 | } | 417 | } |
423 | rcu_read_unlock(); | 418 | rcu_read_unlock(); |