batman-adv: Rename batadv_hardif *_free_ref function to *_put
authorSven Eckelmann <sven@narfation.org>
Sun, 17 Jan 2016 10:01:10 +0000 (11:01 +0100)
committerAntonio Quartulli <a@unstable.cc>
Tue, 23 Feb 2016 05:48:24 +0000 (13:48 +0800)
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>
16 files changed:
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/distributed-arp-table.c
net/batman-adv/fragmentation.c
net/batman-adv/gateway_client.c
net/batman-adv/hard-interface.c
net/batman-adv/hard-interface.h
net/batman-adv/icmp_socket.c
net/batman-adv/main.c
net/batman-adv/network-coding.c
net/batman-adv/originator.c
net/batman-adv/routing.c
net/batman-adv/send.c
net/batman-adv/soft-interface.c
net/batman-adv/sysfs.c
net/batman-adv/translation-table.c

index 32df38bfff25f491132e30f441db6673fbf1e447..f01ee23e35e6c6a862397f98a5bdd1ba354f13ab 100644 (file)
@@ -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);
 }
 
 /**
@@ -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;
 }
 
@@ -711,9 +711,9 @@ out_nomem:
        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 */
@@ -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);
 }
 
 /**
index 49008d98a8aad418ad25a9e09c50799a4bb4b302..b7167cf3e907e0afd5618f4424a79b0430639e95 100644 (file)
@@ -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);
 }
 
 /**
@@ -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);
 }
 
 /**
@@ -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));
@@ -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 */
        }
@@ -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);
 }
 
 /**
@@ -1692,7 +1692,7 @@ handled:
 
 out:
        if (primary_if)
-               batadv_hardif_free_ref(primary_if);
+               batadv_hardif_put(primary_if);
        if (claim)
                batadv_claim_free_ref(claim);
        return ret;
@@ -1781,7 +1781,7 @@ handled:
        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;
@@ -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;
 }
 
@@ -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;
 }
index 8f466e782bc7afba1741df461af6b0ee5e1deb3a..00408d6231b66186552921208d416fc21a80935a 100644 (file)
@@ -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;
 }
 
index 67cb224981fb325149988c4cf8c1a101a64d2d0f..d13c5b601b67ebd7fb00691ec2c878c9b60bac6e 100644 (file)
@@ -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;
 }
index 9cb098f791550fb58b0983db1c241a65beedd081..7bf84c136205a5757a0e1d7713e2af486e14c8de 100644 (file)
@@ -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;
 }
 
index e2aaa4cc39a7405c94c5c5f467b1c5f0591a0ddd..b22b2775a0a5ff706c17ea06c39c9bb092da1f9a 100644 (file)
@@ -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,
@@ -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
@@ -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
@@ -562,7 +562,7 @@ err_dev:
        hard_iface->soft_iface = NULL;
        dev_put(soft_iface);
 err:
-       batadv_hardif_free_ref(hard_iface);
+       batadv_hardif_put(hard_iface);
        return ret;
 }
 
@@ -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);
@@ -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);
 }
 
 /**
@@ -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 *
@@ -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;
 }
 
index 5cecc6bc1b1ec2493bc866bd93d35cbd09a88331..d74f1983f33e1d430dbc332da510f6d24247aab7 100644 (file)
@@ -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);
 }
index 7d944af59ef08a35bc73ee6a678b82183bfa72ba..292a648c2f0902b029f273289a5daf5d1d127e31 100644 (file)
@@ -288,7 +288,7 @@ free_skb:
        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)
index 5b573d1c8fcc4750e33641b57162efa639278c33..476554b3adce76711d78c94a26bbd966c6f215e9 100644 (file)
@@ -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:
index 00f74d40d81ae67170e4b2b72ce4b6a07d2bcfd1..3a42e26b22407fe0563b355d6d51616c1f0d41c5 100644 (file)
@@ -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;
 }
 
index 4df9be4235838f0a6bfed2357623e079456ebb9a..3e959f48f84519db81610309fffb1c78a834ff5b 100644 (file)
@@ -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);
 }
@@ -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);
 }
 
@@ -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);
 }
@@ -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;
        }
 
@@ -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,
@@ -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);
@@ -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,
@@ -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;
 }
 
index d2c490df963b39af13142b1916572cfd490a0717..a14ca42e927eae6e2ea28aba27619b08372bba6e 100644 (file)
@@ -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;
@@ -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;
@@ -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);
 
@@ -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;
 
index 261309ea5fec206c3529ab08e129a9d3496c591b..c9cafc0f2d1b6002896151bb0189871ccaddfc86 100644 (file)
@@ -246,7 +246,7 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv,
        ret = true;
 out:
        if (primary_if)
-               batadv_hardif_free_ref(primary_if);
+               batadv_hardif_put(primary_if);
        return ret;
 }
 
@@ -409,9 +409,9 @@ static void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet)
 {
        kfree_skb(forw_packet->skb);
        if (forw_packet->if_incoming)
-               batadv_hardif_free_ref(forw_packet->if_incoming);
+               batadv_hardif_put(forw_packet->if_incoming);
        if (forw_packet->if_outgoing)
-               batadv_hardif_free_ref(forw_packet->if_outgoing);
+               batadv_hardif_put(forw_packet->if_outgoing);
        kfree(forw_packet);
 }
 
@@ -497,7 +497,7 @@ out_and_inc:
        atomic_inc(&bat_priv->bcast_queue_left);
 out:
        if (primary_if)
-               batadv_hardif_free_ref(primary_if);
+               batadv_hardif_put(primary_if);
        return NETDEV_TX_BUSY;
 }
 
index d4490ff75edd6494bf188cf622bfc2b367e450f8..ca8fa4e28d4fe52f7ee26f4f93369ff48254e29a 100644 (file)
@@ -377,7 +377,7 @@ dropped_freed:
        batadv_inc_counter(bat_priv, BATADV_CNT_TX_DROPPED);
 end:
        if (primary_if)
-               batadv_hardif_free_ref(primary_if);
+               batadv_hardif_put(primary_if);
        return NETDEV_TX_OK;
 }
 
@@ -878,7 +878,7 @@ static int batadv_softif_slave_add(struct net_device *dev,
 
 out:
        if (hard_iface)
-               batadv_hardif_free_ref(hard_iface);
+               batadv_hardif_put(hard_iface);
        return ret;
 }
 
@@ -905,7 +905,7 @@ static int batadv_softif_slave_del(struct net_device *dev,
 
 out:
        if (hard_iface)
-               batadv_hardif_free_ref(hard_iface);
+               batadv_hardif_put(hard_iface);
        return ret;
 }
 
index ab4382ba3855ebbe1464e8c773e396677ee8657a..0db7591a000fcbd893f1081b942cfae1f310ee6c 100644 (file)
@@ -771,7 +771,7 @@ static ssize_t batadv_show_mesh_iface(struct kobject *kobj,
 
        length = sprintf(buff, "%s\n", ifname);
 
-       batadv_hardif_free_ref(hard_iface);
+       batadv_hardif_put(hard_iface);
 
        return length;
 }
@@ -795,7 +795,7 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj,
        if (strlen(buff) >= IFNAMSIZ) {
                pr_err("Invalid parameter for 'mesh_iface' setting received: interface name too long '%s'\n",
                       buff);
-               batadv_hardif_free_ref(hard_iface);
+               batadv_hardif_put(hard_iface);
                return -EINVAL;
        }
 
@@ -829,7 +829,7 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj,
 unlock:
        rtnl_unlock();
 out:
-       batadv_hardif_free_ref(hard_iface);
+       batadv_hardif_put(hard_iface);
        return ret;
 }
 
@@ -863,7 +863,7 @@ static ssize_t batadv_show_iface_status(struct kobject *kobj,
                break;
        }
 
-       batadv_hardif_free_ref(hard_iface);
+       batadv_hardif_put(hard_iface);
 
        return length;
 }
index 107532c32c577179114a23c3b09f3b84d7cdc04b..c6c633828bc89cf3b4952e8163b13bea05745812 100644 (file)
@@ -1060,7 +1060,7 @@ int batadv_tt_local_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;
 }
 
@@ -1725,7 +1725,7 @@ int batadv_tt_global_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;
 }
 
@@ -2638,7 +2638,7 @@ static int batadv_send_tt_request(struct batadv_priv *bat_priv,
 
 out:
        if (primary_if)
-               batadv_hardif_free_ref(primary_if);
+               batadv_hardif_put(primary_if);
        if (ret && tt_req_node) {
                spin_lock_bh(&bat_priv->tt.req_list_lock);
                /* hlist_del_init() verifies tt_req_node still is in the list */
@@ -2895,7 +2895,7 @@ out:
        if (orig_node)
                batadv_orig_node_put(orig_node);
        if (primary_if)
-               batadv_hardif_free_ref(primary_if);
+               batadv_hardif_put(primary_if);
        kfree(tvlv_tt_data);
        /* The packet was for this host, so it doesn't need to be re-routed */
        return true;
@@ -3218,7 +3218,7 @@ static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client,
 
 out:
        if (primary_if)
-               batadv_hardif_free_ref(primary_if);
+               batadv_hardif_put(primary_if);
 }
 
 static void batadv_tt_purge(struct work_struct *work)