Skip to content

Commit

Permalink
batman-adv: Rename batadv_hardif *_free_ref function to *_put
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marek Lindner <[email protected]>
Signed-off-by: Antonio Quartulli <[email protected]>
  • Loading branch information
ecsv authored and ordex committed Feb 23, 2016
1 parent 5d96731 commit 82047ad
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 60 deletions.
10 changes: 5 additions & 5 deletions net/batman-adv/bat_iv_ogm.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet)

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
}

/**
Expand Down Expand Up @@ -617,7 +617,7 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet,

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
return res;
}

Expand Down Expand Up @@ -711,9 +711,9 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
if (!own_packet)
atomic_inc(&bat_priv->batman_queue_left);
out_free_outgoing:
batadv_hardif_free_ref(if_outgoing);
batadv_hardif_put(if_outgoing);
out_free_incoming:
batadv_hardif_free_ref(if_incoming);
batadv_hardif_put(if_incoming);
}

/* aggregate a new packet into the existing ogm packet */
Expand Down Expand Up @@ -958,7 +958,7 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
}

/**
Expand Down
18 changes: 9 additions & 9 deletions net/batman-adv/bridge_loop_avoidance.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
netif_rx(skb);
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
}

/**
Expand Down Expand Up @@ -1282,7 +1282,7 @@ void batadv_bla_status_update(struct net_device *net_dev)
* so just call that one.
*/
batadv_bla_update_orig_address(bat_priv, primary_if, primary_if);
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
}

/**
Expand Down Expand Up @@ -1356,7 +1356,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)
}
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);

queue_delayed_work(batadv_event_workqueue, &bat_priv->bla.work,
msecs_to_jiffies(BATADV_BLA_PERIOD_LENGTH));
Expand Down Expand Up @@ -1395,7 +1395,7 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
if (primary_if) {
crc = crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN);
bat_priv->bla.claim_dest.group = htons(crc);
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
} else {
bat_priv->bla.claim_dest.group = 0; /* will be set later */
}
Expand Down Expand Up @@ -1599,7 +1599,7 @@ void batadv_bla_free(struct batadv_priv *bat_priv)
bat_priv->bla.backbone_hash = NULL;
}
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
}

/**
Expand Down Expand Up @@ -1692,7 +1692,7 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
if (claim)
batadv_claim_free_ref(claim);
return ret;
Expand Down Expand Up @@ -1781,7 +1781,7 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
ret = 1;
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
if (claim)
batadv_claim_free_ref(claim);
return ret;
Expand Down Expand Up @@ -1839,7 +1839,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
}
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
return 0;
}

Expand Down Expand Up @@ -1904,6 +1904,6 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
}
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
return 0;
}
2 changes: 1 addition & 1 deletion net/batman-adv/distributed-arp-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/fragmentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ bool batadv_frag_send_packet(struct sk_buff *skb,

out_err:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);

return ret;
}
2 changes: 1 addition & 1 deletion net/batman-adv/gateway_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
return 0;
}

Expand Down
20 changes: 10 additions & 10 deletions net/batman-adv/hard-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static void batadv_primary_if_update_addr(struct batadv_priv *bat_priv,
batadv_bla_update_orig_address(bat_priv, primary_if, oldif);
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
}

static void batadv_primary_if_select(struct batadv_priv *bat_priv,
Expand All @@ -250,7 +250,7 @@ static void batadv_primary_if_select(struct batadv_priv *bat_priv,

out:
if (curr_hard_iface)
batadv_hardif_free_ref(curr_hard_iface);
batadv_hardif_put(curr_hard_iface);
}

static bool
Expand Down Expand Up @@ -409,7 +409,7 @@ batadv_hardif_activate_interface(struct batadv_hard_iface *hard_iface)

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
}

static void
Expand Down Expand Up @@ -562,7 +562,7 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
hard_iface->soft_iface = NULL;
dev_put(soft_iface);
err:
batadv_hardif_free_ref(hard_iface);
batadv_hardif_put(hard_iface);
return ret;
}

Expand Down Expand Up @@ -593,7 +593,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
batadv_primary_if_select(bat_priv, new_if);

if (new_if)
batadv_hardif_free_ref(new_if);
batadv_hardif_put(new_if);
}

bat_priv->bat_algo_ops->bat_iface_disable(hard_iface);
Expand All @@ -616,11 +616,11 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
}

hard_iface->soft_iface = NULL;
batadv_hardif_free_ref(hard_iface);
batadv_hardif_put(hard_iface);

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
}

/**
Expand All @@ -639,7 +639,7 @@ static void batadv_hardif_remove_interface_finish(struct work_struct *work)

batadv_debugfs_del_hardif(hard_iface);
batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
batadv_hardif_free_ref(hard_iface);
batadv_hardif_put(hard_iface);
}

static struct batadv_hard_iface *
Expand Down Expand Up @@ -794,10 +794,10 @@ static int batadv_hard_if_event(struct notifier_block *this,
}

hardif_put:
batadv_hardif_free_ref(hard_iface);
batadv_hardif_put(hard_iface);
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
return NOTIFY_DONE;
}

Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/hard-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ void batadv_update_min_mtu(struct net_device *soft_iface);
void batadv_hardif_release(struct kref *ref);

/**
* batadv_hardif_free_ref - decrement the hard interface refcounter and possibly
* batadv_hardif_put - decrement the hard interface refcounter and possibly
* release it
* @hard_iface: the hard interface to free
*/
static inline void batadv_hardif_free_ref(struct batadv_hard_iface *hard_iface)
static inline void batadv_hardif_put(struct batadv_hard_iface *hard_iface)
{
kref_put(&hard_iface->refcount, batadv_hardif_release);
}
Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/icmp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
kfree_skb(skb);
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
if (neigh_node)
batadv_neigh_node_free_ref(neigh_node);
if (orig_node)
Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ batadv_seq_print_text_primary_if_get(struct seq_file *seq)
seq_printf(seq,
"BATMAN mesh %s disabled - primary interface not active\n",
net_dev->name);
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
primary_if = NULL;

out:
Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/network-coding.c
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,7 @@ int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset)

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
return 0;
}

Expand Down
16 changes: 8 additions & 8 deletions net/batman-adv/originator.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static void batadv_neigh_ifinfo_release(struct kref *ref)
neigh_ifinfo = container_of(ref, struct batadv_neigh_ifinfo, refcount);

if (neigh_ifinfo->if_outgoing != BATADV_IF_DEFAULT)
batadv_hardif_free_ref(neigh_ifinfo->if_outgoing);
batadv_hardif_put(neigh_ifinfo->if_outgoing);

kfree_rcu(neigh_ifinfo, rcu);
}
Expand Down Expand Up @@ -227,7 +227,7 @@ static void batadv_hardif_neigh_release(struct kref *ref)
hlist_del_init_rcu(&hardif_neigh->list);
spin_unlock_bh(&hardif_neigh->if_incoming->neigh_list_lock);

batadv_hardif_free_ref(hardif_neigh->if_incoming);
batadv_hardif_put(hardif_neigh->if_incoming);
kfree_rcu(hardif_neigh, rcu);
}

Expand Down Expand Up @@ -273,7 +273,7 @@ static void batadv_neigh_node_release(struct kref *ref)
if (bao->bat_neigh_free)
bao->bat_neigh_free(neigh_node);

batadv_hardif_free_ref(neigh_node->if_incoming);
batadv_hardif_put(neigh_node->if_incoming);

kfree_rcu(neigh_node, rcu);
}
Expand Down Expand Up @@ -544,7 +544,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,

hardif_neigh = kzalloc(sizeof(*hardif_neigh), GFP_ATOMIC);
if (!hardif_neigh) {
batadv_hardif_free_ref(hard_iface);
batadv_hardif_put(hard_iface);
goto out;
}

Expand Down Expand Up @@ -707,7 +707,7 @@ int batadv_hardif_neigh_seq_print_text(struct seq_file *seq, void *offset)
primary_if->net_dev->dev_addr, net_dev->name,
bat_priv->bat_algo_ops->name);

batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);

if (!bat_priv->bat_algo_ops->bat_neigh_print) {
seq_puts(seq,
Expand All @@ -732,7 +732,7 @@ static void batadv_orig_ifinfo_release(struct kref *ref)
orig_ifinfo = container_of(ref, struct batadv_orig_ifinfo, refcount);

if (orig_ifinfo->if_outgoing != BATADV_IF_DEFAULT)
batadv_hardif_free_ref(orig_ifinfo->if_outgoing);
batadv_hardif_put(orig_ifinfo->if_outgoing);

/* this is the last reference to this object */
router = rcu_dereference_protected(orig_ifinfo->router, true);
Expand Down Expand Up @@ -1250,7 +1250,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
primary_if->net_dev->dev_addr, net_dev->name,
bat_priv->bat_algo_ops->name);

batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);

if (!bat_priv->bat_algo_ops->bat_orig_print) {
seq_puts(seq,
Expand Down Expand Up @@ -1306,7 +1306,7 @@ int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset)

out:
if (hard_iface)
batadv_hardif_free_ref(hard_iface);
batadv_hardif_put(hard_iface);
return 0;
}

Expand Down
8 changes: 4 additions & 4 deletions net/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static int batadv_recv_my_icmp_packet(struct batadv_priv *bat_priv,
}
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
if (orig_node)
batadv_orig_node_put(orig_node);
return ret;
Expand Down Expand Up @@ -317,7 +317,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv,

out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
if (orig_node)
batadv_orig_node_put(orig_node);
return ret;
Expand Down Expand Up @@ -702,7 +702,7 @@ batadv_reroute_unicast_packet(struct batadv_priv *bat_priv,
ret = true;
out:
if (primary_if)
batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);
if (orig_node)
batadv_orig_node_put(orig_node);

Expand Down Expand Up @@ -808,7 +808,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,

ether_addr_copy(unicast_packet->dest, primary_if->net_dev->dev_addr);

batadv_hardif_free_ref(primary_if);
batadv_hardif_put(primary_if);

unicast_packet->ttvn = curr_ttvn;

Expand Down
Loading

0 comments on commit 82047ad

Please sign in to comment.