Commit 044fa3ae authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli

batman-adv: Rename batadv_neigh_ifinfo *_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: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: default avatarAntonio Quartulli <a@unstable.cc>
parent 25bb2509
...@@ -1026,7 +1026,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, ...@@ -1026,7 +1026,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
neigh_ifinfo->bat_iv.tq_avg = tq_avg; neigh_ifinfo->bat_iv.tq_avg = tq_avg;
spin_unlock_bh(&tmp_neigh_node->ifinfo_lock); spin_unlock_bh(&tmp_neigh_node->ifinfo_lock);
batadv_neigh_ifinfo_free_ref(neigh_ifinfo); batadv_neigh_ifinfo_put(neigh_ifinfo);
neigh_ifinfo = NULL; neigh_ifinfo = NULL;
} }
...@@ -1120,9 +1120,9 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, ...@@ -1120,9 +1120,9 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
if (router) if (router)
batadv_neigh_node_put(router); batadv_neigh_node_put(router);
if (neigh_ifinfo) if (neigh_ifinfo)
batadv_neigh_ifinfo_free_ref(neigh_ifinfo); batadv_neigh_ifinfo_put(neigh_ifinfo);
if (router_ifinfo) if (router_ifinfo)
batadv_neigh_ifinfo_free_ref(router_ifinfo); batadv_neigh_ifinfo_put(router_ifinfo);
} }
/** /**
...@@ -1192,7 +1192,7 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, ...@@ -1192,7 +1192,7 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
neigh_ifinfo = batadv_neigh_ifinfo_new(neigh_node, if_outgoing); neigh_ifinfo = batadv_neigh_ifinfo_new(neigh_node, if_outgoing);
if (neigh_ifinfo) { if (neigh_ifinfo) {
neigh_rq_count = neigh_ifinfo->bat_iv.real_packet_count; neigh_rq_count = neigh_ifinfo->bat_iv.real_packet_count;
batadv_neigh_ifinfo_free_ref(neigh_ifinfo); batadv_neigh_ifinfo_put(neigh_ifinfo);
} else { } else {
neigh_rq_count = 0; neigh_rq_count = 0;
} }
...@@ -1353,7 +1353,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, ...@@ -1353,7 +1353,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
packet_count = bitmap_weight(bitmap, packet_count = bitmap_weight(bitmap,
BATADV_TQ_LOCAL_WINDOW_SIZE); BATADV_TQ_LOCAL_WINDOW_SIZE);
neigh_ifinfo->bat_iv.real_packet_count = packet_count; neigh_ifinfo->bat_iv.real_packet_count = packet_count;
batadv_neigh_ifinfo_free_ref(neigh_ifinfo); batadv_neigh_ifinfo_put(neigh_ifinfo);
} }
rcu_read_unlock(); rcu_read_unlock();
...@@ -1566,7 +1566,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset, ...@@ -1566,7 +1566,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset,
batadv_orig_node_put(orig_neigh_node); batadv_orig_node_put(orig_neigh_node);
out: out:
if (router_ifinfo) if (router_ifinfo)
batadv_neigh_ifinfo_free_ref(router_ifinfo); batadv_neigh_ifinfo_put(router_ifinfo);
if (router) if (router)
batadv_neigh_node_put(router); batadv_neigh_node_put(router);
if (router_router) if (router_router)
...@@ -1805,7 +1805,7 @@ batadv_iv_ogm_orig_print_neigh(struct batadv_orig_node *orig_node, ...@@ -1805,7 +1805,7 @@ batadv_iv_ogm_orig_print_neigh(struct batadv_orig_node *orig_node,
neigh_node->addr, neigh_node->addr,
n_ifinfo->bat_iv.tq_avg); n_ifinfo->bat_iv.tq_avg);
batadv_neigh_ifinfo_free_ref(n_ifinfo); batadv_neigh_ifinfo_put(n_ifinfo);
} }
} }
...@@ -1870,7 +1870,7 @@ static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv, ...@@ -1870,7 +1870,7 @@ static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv,
next: next:
batadv_neigh_node_put(neigh_node); batadv_neigh_node_put(neigh_node);
if (n_ifinfo) if (n_ifinfo)
batadv_neigh_ifinfo_free_ref(n_ifinfo); batadv_neigh_ifinfo_put(n_ifinfo);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -1964,9 +1964,9 @@ static int batadv_iv_ogm_neigh_cmp(struct batadv_neigh_node *neigh1, ...@@ -1964,9 +1964,9 @@ static int batadv_iv_ogm_neigh_cmp(struct batadv_neigh_node *neigh1,
out: out:
if (neigh1_ifinfo) if (neigh1_ifinfo)
batadv_neigh_ifinfo_free_ref(neigh1_ifinfo); batadv_neigh_ifinfo_put(neigh1_ifinfo);
if (neigh2_ifinfo) if (neigh2_ifinfo)
batadv_neigh_ifinfo_free_ref(neigh2_ifinfo); batadv_neigh_ifinfo_put(neigh2_ifinfo);
return diff; return diff;
} }
...@@ -2007,9 +2007,9 @@ batadv_iv_ogm_neigh_is_sob(struct batadv_neigh_node *neigh1, ...@@ -2007,9 +2007,9 @@ batadv_iv_ogm_neigh_is_sob(struct batadv_neigh_node *neigh1,
out: out:
if (neigh1_ifinfo) if (neigh1_ifinfo)
batadv_neigh_ifinfo_free_ref(neigh1_ifinfo); batadv_neigh_ifinfo_put(neigh1_ifinfo);
if (neigh2_ifinfo) if (neigh2_ifinfo)
batadv_neigh_ifinfo_free_ref(neigh2_ifinfo); batadv_neigh_ifinfo_put(neigh2_ifinfo);
return ret; return ret;
} }
......
...@@ -237,7 +237,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv) ...@@ -237,7 +237,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
next: next:
batadv_neigh_node_put(router); batadv_neigh_node_put(router);
if (router_ifinfo) if (router_ifinfo)
batadv_neigh_ifinfo_free_ref(router_ifinfo); batadv_neigh_ifinfo_put(router_ifinfo);
} }
rcu_read_unlock(); rcu_read_unlock();
...@@ -354,7 +354,7 @@ void batadv_gw_election(struct batadv_priv *bat_priv) ...@@ -354,7 +354,7 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
if (router) if (router)
batadv_neigh_node_put(router); batadv_neigh_node_put(router);
if (router_ifinfo) if (router_ifinfo)
batadv_neigh_ifinfo_free_ref(router_ifinfo); batadv_neigh_ifinfo_put(router_ifinfo);
} }
void batadv_gw_check_election(struct batadv_priv *bat_priv, void batadv_gw_check_election(struct batadv_priv *bat_priv,
...@@ -421,9 +421,9 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv, ...@@ -421,9 +421,9 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv,
if (router_orig) if (router_orig)
batadv_neigh_node_put(router_orig); batadv_neigh_node_put(router_orig);
if (router_gw_tq) if (router_gw_tq)
batadv_neigh_ifinfo_free_ref(router_gw_tq); batadv_neigh_ifinfo_put(router_gw_tq);
if (router_orig_tq) if (router_orig_tq)
batadv_neigh_ifinfo_free_ref(router_orig_tq); batadv_neigh_ifinfo_put(router_orig_tq);
} }
/** /**
...@@ -624,7 +624,7 @@ static int batadv_write_buffer_text(struct batadv_priv *bat_priv, ...@@ -624,7 +624,7 @@ static int batadv_write_buffer_text(struct batadv_priv *bat_priv,
batadv_gw_node_free_ref(curr_gw); batadv_gw_node_free_ref(curr_gw);
out: out:
if (router_ifinfo) if (router_ifinfo)
batadv_neigh_ifinfo_free_ref(router_ifinfo); batadv_neigh_ifinfo_put(router_ifinfo);
if (router) if (router)
batadv_neigh_node_put(router); batadv_neigh_node_put(router);
return ret; return ret;
...@@ -857,7 +857,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, ...@@ -857,7 +857,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
goto out; goto out;
curr_tq_avg = curr_ifinfo->bat_iv.tq_avg; curr_tq_avg = curr_ifinfo->bat_iv.tq_avg;
batadv_neigh_ifinfo_free_ref(curr_ifinfo); batadv_neigh_ifinfo_put(curr_ifinfo);
break; break;
case BATADV_GW_MODE_OFF: case BATADV_GW_MODE_OFF:
...@@ -875,7 +875,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, ...@@ -875,7 +875,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
if ((curr_tq_avg - old_ifinfo->bat_iv.tq_avg) > BATADV_GW_THRESHOLD) if ((curr_tq_avg - old_ifinfo->bat_iv.tq_avg) > BATADV_GW_THRESHOLD)
out_of_range = true; out_of_range = true;
batadv_neigh_ifinfo_free_ref(old_ifinfo); batadv_neigh_ifinfo_put(old_ifinfo);
out: out:
if (orig_dst_node) if (orig_dst_node)
......
...@@ -1232,9 +1232,9 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv, ...@@ -1232,9 +1232,9 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
if (router_coding) if (router_coding)
batadv_neigh_node_put(router_coding); batadv_neigh_node_put(router_coding);
if (router_neigh_ifinfo) if (router_neigh_ifinfo)
batadv_neigh_ifinfo_free_ref(router_neigh_ifinfo); batadv_neigh_ifinfo_put(router_neigh_ifinfo);
if (router_coding_ifinfo) if (router_coding_ifinfo)
batadv_neigh_ifinfo_free_ref(router_coding_ifinfo); batadv_neigh_ifinfo_put(router_coding_ifinfo);
return res; return res;
} }
......
...@@ -202,11 +202,11 @@ static void batadv_neigh_ifinfo_release(struct kref *ref) ...@@ -202,11 +202,11 @@ static void batadv_neigh_ifinfo_release(struct kref *ref)
} }
/** /**
* batadv_neigh_ifinfo_free_ref - decrement the refcounter and possibly release * batadv_neigh_ifinfo_put - decrement the refcounter and possibly release
* the neigh_ifinfo * the neigh_ifinfo
* @neigh_ifinfo: the neigh_ifinfo object to release * @neigh_ifinfo: the neigh_ifinfo object to release
*/ */
void batadv_neigh_ifinfo_free_ref(struct batadv_neigh_ifinfo *neigh_ifinfo) void batadv_neigh_ifinfo_put(struct batadv_neigh_ifinfo *neigh_ifinfo)
{ {
kref_put(&neigh_ifinfo->refcount, batadv_neigh_ifinfo_release); kref_put(&neigh_ifinfo->refcount, batadv_neigh_ifinfo_release);
} }
...@@ -259,7 +259,7 @@ static void batadv_neigh_node_release(struct kref *ref) ...@@ -259,7 +259,7 @@ static void batadv_neigh_node_release(struct kref *ref)
hlist_for_each_entry_safe(neigh_ifinfo, node_tmp, hlist_for_each_entry_safe(neigh_ifinfo, node_tmp,
&neigh_node->ifinfo_list, list) { &neigh_node->ifinfo_list, list) {
batadv_neigh_ifinfo_free_ref(neigh_ifinfo); batadv_neigh_ifinfo_put(neigh_ifinfo);
} }
hardif_neigh = batadv_hardif_neigh_get(neigh_node->if_incoming, hardif_neigh = batadv_hardif_neigh_get(neigh_node->if_incoming,
...@@ -966,7 +966,7 @@ batadv_purge_neigh_ifinfo(struct batadv_priv *bat_priv, ...@@ -966,7 +966,7 @@ batadv_purge_neigh_ifinfo(struct batadv_priv *bat_priv,
neigh->addr, if_outgoing->net_dev->name); neigh->addr, if_outgoing->net_dev->name);
hlist_del_rcu(&neigh_ifinfo->list); hlist_del_rcu(&neigh_ifinfo->list);
batadv_neigh_ifinfo_free_ref(neigh_ifinfo); batadv_neigh_ifinfo_put(neigh_ifinfo);
} }
spin_unlock_bh(&neigh->ifinfo_lock); spin_unlock_bh(&neigh->ifinfo_lock);
......
...@@ -59,7 +59,7 @@ batadv_neigh_ifinfo_new(struct batadv_neigh_node *neigh, ...@@ -59,7 +59,7 @@ batadv_neigh_ifinfo_new(struct batadv_neigh_node *neigh,
struct batadv_neigh_ifinfo * struct batadv_neigh_ifinfo *
batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh, batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh,
struct batadv_hard_iface *if_outgoing); struct batadv_hard_iface *if_outgoing);
void batadv_neigh_ifinfo_free_ref(struct batadv_neigh_ifinfo *neigh_ifinfo); void batadv_neigh_ifinfo_put(struct batadv_neigh_ifinfo *neigh_ifinfo);
int batadv_hardif_neigh_seq_print_text(struct seq_file *seq, void *offset); int batadv_hardif_neigh_seq_print_text(struct seq_file *seq, void *offset);
......
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