aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/batman-adv/hard-interface.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven.eckelmann@gmx.de>2010-09-18 21:01:18 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-09-20 16:29:49 -0700
commit16f9530e99f5eb35dd1adafbae854dd94f8d3751 (patch)
treeff66e8898d8475721357ea7287418b4220c2cb08 /drivers/staging/batman-adv/hard-interface.c
parent952c699c06f562b07dba4b1f91dfc02de928545d (diff)
Staging: batman-adv: Use synchronize_rcu instead of call_rcu
It is recommended [1] to use synchronize_rcu to simplify the code - especially when otherwise extra locking is needed to protect other code from picking stale elements. It also protects us for emitting to many callbacks which may results in OOM conditions. The only reason not to use it, would be in performance critical sections or when we are not allowed to block. [1] Documentation/RCU/checklist.txt Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/hard-interface.c')
-rw-r--r--drivers/staging/batman-adv/hard-interface.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/staging/batman-adv/hard-interface.c b/drivers/staging/batman-adv/hard-interface.c
index 35b198c6bad..376ac488bf5 100644
--- a/drivers/staging/batman-adv/hard-interface.c
+++ b/drivers/staging/batman-adv/hard-interface.c
@@ -418,13 +418,6 @@ out:
return NULL;
}
-static void hardif_free_interface(struct rcu_head *rcu)
-{
- struct batman_if *batman_if = container_of(rcu, struct batman_if, rcu);
-
- kfree(batman_if);
-}
-
static void hardif_remove_interface(struct batman_if *batman_if)
{
/* first deactivate interface */
@@ -438,9 +431,10 @@ static void hardif_remove_interface(struct batman_if *batman_if)
/* caller must take if_list_lock */
list_del_rcu(&batman_if->list);
+ synchronize_rcu();
sysfs_del_hardif(&batman_if->hardif_obj);
dev_put(batman_if->net_dev);
- call_rcu(&batman_if->rcu, hardif_free_interface);
+ kfree(batman_if);
}
void hardif_remove_interfaces(void)