Commit 21026059 authored by Antonio Quartulli's avatar Antonio Quartulli Committed by Antonio Quartulli

batman-adv: don't use call_rcu if not needed

batadv_tt_global_entry_free_ref uses call_rcu to schedule a
function which will only free the global entry itself.

For this reason call_rcu is useless and kfree_rcu can be
used to simplify the code.
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
parent d7ee88d0
...@@ -117,25 +117,17 @@ batadv_tt_local_entry_free_ref(struct batadv_tt_local_entry *tt_local_entry) ...@@ -117,25 +117,17 @@ batadv_tt_local_entry_free_ref(struct batadv_tt_local_entry *tt_local_entry)
kfree_rcu(tt_local_entry, common.rcu); kfree_rcu(tt_local_entry, common.rcu);
} }
static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu) /**
{ * batadv_tt_global_entry_free_ref - decrement the refcounter for a
struct batadv_tt_common_entry *tt_common_entry; * tt_global_entry and possibly free it
struct batadv_tt_global_entry *tt_global_entry; * @tt_global_entry: the object to free
*/
tt_common_entry = container_of(rcu, struct batadv_tt_common_entry, rcu);
tt_global_entry = container_of(tt_common_entry,
struct batadv_tt_global_entry, common);
kfree(tt_global_entry);
}
static void static void
batadv_tt_global_entry_free_ref(struct batadv_tt_global_entry *tt_global_entry) batadv_tt_global_entry_free_ref(struct batadv_tt_global_entry *tt_global_entry)
{ {
if (atomic_dec_and_test(&tt_global_entry->common.refcount)) { if (atomic_dec_and_test(&tt_global_entry->common.refcount)) {
batadv_tt_global_del_orig_list(tt_global_entry); batadv_tt_global_del_orig_list(tt_global_entry);
call_rcu(&tt_global_entry->common.rcu, kfree_rcu(tt_global_entry, common.rcu);
batadv_tt_global_entry_free_rcu);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment