batman-adv: Rename batadv_gw_node *_free_ref function to *_put

The batman-adv source code is the only place in the kernel which uses the
*_free_ref naming scheme for the *_put functions. Changing it to *_put
makes it more consistent and makes it easier to understand the connection
to the *_get functions.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
This commit is contained in:
Sven Eckelmann 2016-01-17 11:01:18 +01:00 committed by Antonio Quartulli
parent a6416f9ffc
commit 3a01743ddf
1 changed files with 17 additions and 18 deletions

View File

@ -76,11 +76,10 @@ static void batadv_gw_node_release(struct kref *ref)
} }
/** /**
* batadv_gw_node_free_ref - decrement the gw_node refcounter and possibly * batadv_gw_node_put - decrement the gw_node refcounter and possibly release it
* release it
* @gw_node: gateway node to free * @gw_node: gateway node to free
*/ */
static void batadv_gw_node_free_ref(struct batadv_gw_node *gw_node) static void batadv_gw_node_put(struct batadv_gw_node *gw_node)
{ {
kref_put(&gw_node->refcount, batadv_gw_node_release); kref_put(&gw_node->refcount, batadv_gw_node_release);
} }
@ -125,7 +124,7 @@ unlock:
rcu_read_unlock(); rcu_read_unlock();
out: out:
if (gw_node) if (gw_node)
batadv_gw_node_free_ref(gw_node); batadv_gw_node_put(gw_node);
return orig_node; return orig_node;
} }
@ -143,7 +142,7 @@ static void batadv_gw_select(struct batadv_priv *bat_priv,
rcu_assign_pointer(bat_priv->gw.curr_gw, new_gw_node); rcu_assign_pointer(bat_priv->gw.curr_gw, new_gw_node);
if (curr_gw_node) if (curr_gw_node)
batadv_gw_node_free_ref(curr_gw_node); batadv_gw_node_put(curr_gw_node);
spin_unlock_bh(&bat_priv->gw.list_lock); spin_unlock_bh(&bat_priv->gw.list_lock);
} }
@ -204,7 +203,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
((tmp_gw_factor == max_gw_factor) && ((tmp_gw_factor == max_gw_factor) &&
(tq_avg > max_tq))) { (tq_avg > max_tq))) {
if (curr_gw) if (curr_gw)
batadv_gw_node_free_ref(curr_gw); batadv_gw_node_put(curr_gw);
curr_gw = gw_node; curr_gw = gw_node;
kref_get(&curr_gw->refcount); kref_get(&curr_gw->refcount);
} }
@ -219,7 +218,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
*/ */
if (tq_avg > max_tq) { if (tq_avg > max_tq) {
if (curr_gw) if (curr_gw)
batadv_gw_node_free_ref(curr_gw); batadv_gw_node_put(curr_gw);
curr_gw = gw_node; curr_gw = gw_node;
kref_get(&curr_gw->refcount); kref_get(&curr_gw->refcount);
} }
@ -232,7 +231,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
if (tmp_gw_factor > max_gw_factor) if (tmp_gw_factor > max_gw_factor)
max_gw_factor = tmp_gw_factor; max_gw_factor = tmp_gw_factor;
batadv_gw_node_free_ref(gw_node); batadv_gw_node_put(gw_node);
next: next:
batadv_neigh_node_put(router); batadv_neigh_node_put(router);
@ -273,7 +272,7 @@ void batadv_gw_check_client_stop(struct batadv_priv *bat_priv)
*/ */
batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_DEL, NULL); batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_DEL, NULL);
batadv_gw_node_free_ref(curr_gw); batadv_gw_node_put(curr_gw);
} }
void batadv_gw_election(struct batadv_priv *bat_priv) void batadv_gw_election(struct batadv_priv *bat_priv)
@ -348,9 +347,9 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
out: out:
if (curr_gw) if (curr_gw)
batadv_gw_node_free_ref(curr_gw); batadv_gw_node_put(curr_gw);
if (next_gw) if (next_gw)
batadv_gw_node_free_ref(next_gw); batadv_gw_node_put(next_gw);
if (router) if (router)
batadv_neigh_node_put(router); batadv_neigh_node_put(router);
if (router_ifinfo) if (router_ifinfo)
@ -547,7 +546,7 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
spin_lock_bh(&bat_priv->gw.list_lock); spin_lock_bh(&bat_priv->gw.list_lock);
if (!hlist_unhashed(&gw_node->list)) { if (!hlist_unhashed(&gw_node->list)) {
hlist_del_init_rcu(&gw_node->list); hlist_del_init_rcu(&gw_node->list);
batadv_gw_node_free_ref(gw_node); batadv_gw_node_put(gw_node);
} }
spin_unlock_bh(&bat_priv->gw.list_lock); spin_unlock_bh(&bat_priv->gw.list_lock);
@ -556,12 +555,12 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
batadv_gw_reselect(bat_priv); batadv_gw_reselect(bat_priv);
if (curr_gw) if (curr_gw)
batadv_gw_node_free_ref(curr_gw); batadv_gw_node_put(curr_gw);
} }
out: out:
if (gw_node) if (gw_node)
batadv_gw_node_free_ref(gw_node); batadv_gw_node_put(gw_node);
} }
void batadv_gw_node_delete(struct batadv_priv *bat_priv, void batadv_gw_node_delete(struct batadv_priv *bat_priv,
@ -584,7 +583,7 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
hlist_for_each_entry_safe(gw_node, node_tmp, hlist_for_each_entry_safe(gw_node, node_tmp,
&bat_priv->gw.list, list) { &bat_priv->gw.list, list) {
hlist_del_init_rcu(&gw_node->list); hlist_del_init_rcu(&gw_node->list);
batadv_gw_node_free_ref(gw_node); batadv_gw_node_put(gw_node);
} }
spin_unlock_bh(&bat_priv->gw.list_lock); spin_unlock_bh(&bat_priv->gw.list_lock);
} }
@ -621,7 +620,7 @@ static int batadv_write_buffer_text(struct batadv_priv *bat_priv,
ret = seq_has_overflowed(seq) ? -1 : 0; ret = seq_has_overflowed(seq) ? -1 : 0;
if (curr_gw) if (curr_gw)
batadv_gw_node_free_ref(curr_gw); batadv_gw_node_put(curr_gw);
out: out:
if (router_ifinfo) if (router_ifinfo)
batadv_neigh_ifinfo_put(router_ifinfo); batadv_neigh_ifinfo_put(router_ifinfo);
@ -881,9 +880,9 @@ out:
if (orig_dst_node) if (orig_dst_node)
batadv_orig_node_put(orig_dst_node); batadv_orig_node_put(orig_dst_node);
if (curr_gw) if (curr_gw)
batadv_gw_node_free_ref(curr_gw); batadv_gw_node_put(curr_gw);
if (gw_node) if (gw_node)
batadv_gw_node_free_ref(gw_node); batadv_gw_node_put(gw_node);
if (neigh_old) if (neigh_old)
batadv_neigh_node_put(neigh_old); batadv_neigh_node_put(neigh_old);
if (neigh_curr) if (neigh_curr)