Merge branch 'master' of git://1984.lsi.us.es/nf
[cascardo/linux.git] / net / batman-adv / vis.c
index 22d2785..c053244 100644 (file)
@@ -97,7 +97,6 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data)
 {
        struct batadv_hashtable *hash = bat_priv->vis.hash;
        struct hlist_head *head;
-       struct hlist_node *node;
        struct batadv_vis_info *vis_info, *vis_info_tmp = NULL;
        uint32_t index;
 
@@ -108,8 +107,8 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data)
        head = &hash->table[index];
 
        rcu_read_lock();
-       hlist_for_each_entry_rcu(vis_info, node, head, hash_entry) {
-               if (!batadv_vis_info_cmp(node, data))
+       hlist_for_each_entry_rcu(vis_info, head, hash_entry) {
+               if (!batadv_vis_info_cmp(&vis_info->hash_entry, data))
                        continue;
 
                vis_info_tmp = vis_info;
@@ -128,9 +127,8 @@ static void batadv_vis_data_insert_interface(const uint8_t *interface,
                                             bool primary)
 {
        struct batadv_vis_if_list_entry *entry;
-       struct hlist_node *pos;
 
-       hlist_for_each_entry(entry, pos, if_list, list) {
+       hlist_for_each_entry(entry, if_list, list) {
                if (batadv_compare_eth(entry->addr, interface))
                        return;
        }
@@ -148,9 +146,8 @@ static void batadv_vis_data_read_prim_sec(struct seq_file *seq,
                                          const struct hlist_head *if_list)
 {
        struct batadv_vis_if_list_entry *entry;
-       struct hlist_node *pos;
 
-       hlist_for_each_entry(entry, pos, if_list, list) {
+       hlist_for_each_entry(entry, if_list, list) {
                if (entry->primary)
                        seq_printf(seq, "PRIMARY, ");
                else
@@ -198,9 +195,8 @@ static void batadv_vis_data_read_entries(struct seq_file *seq,
 {
        int i;
        struct batadv_vis_if_list_entry *entry;
-       struct hlist_node *pos;
 
-       hlist_for_each_entry(entry, pos, list, list) {
+       hlist_for_each_entry(entry, list, list) {
                seq_printf(seq, "%pM,", entry->addr);
 
                for (i = 0; i < packet->entries; i++)
@@ -218,17 +214,16 @@ static void batadv_vis_data_read_entries(struct seq_file *seq,
 static void batadv_vis_seq_print_text_bucket(struct seq_file *seq,
                                             const struct hlist_head *head)
 {
-       struct hlist_node *node;
        struct batadv_vis_info *info;
        struct batadv_vis_packet *packet;
        uint8_t *entries_pos;
        struct batadv_vis_info_entry *entries;
        struct batadv_vis_if_list_entry *entry;
-       struct hlist_node *pos, *n;
+       struct hlist_node *n;
 
        HLIST_HEAD(vis_if_list);
 
-       hlist_for_each_entry_rcu(info, node, head, hash_entry) {
+       hlist_for_each_entry_rcu(info, head, hash_entry) {
                packet = (struct batadv_vis_packet *)info->skb_packet->data;
                entries_pos = (uint8_t *)packet + sizeof(*packet);
                entries = (struct batadv_vis_info_entry *)entries_pos;
@@ -240,7 +235,7 @@ static void batadv_vis_seq_print_text_bucket(struct seq_file *seq,
                batadv_vis_data_read_entries(seq, &vis_if_list, packet,
                                             entries);
 
-               hlist_for_each_entry_safe(entry, pos, n, &vis_if_list, list) {
+               hlist_for_each_entry_safe(entry, n, &vis_if_list, list) {
                        hlist_del(&entry->list);
                        kfree(entry);
                }
@@ -519,7 +514,6 @@ static int batadv_find_best_vis_server(struct batadv_priv *bat_priv,
 {
        struct batadv_hashtable *hash = bat_priv->orig_hash;
        struct batadv_neigh_node *router;
-       struct hlist_node *node;
        struct hlist_head *head;
        struct batadv_orig_node *orig_node;
        struct batadv_vis_packet *packet;
@@ -532,7 +526,7 @@ static int batadv_find_best_vis_server(struct batadv_priv *bat_priv,
                head = &hash->table[i];
 
                rcu_read_lock();
-               hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
+               hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
                        router = batadv_orig_node_get_router(orig_node);
                        if (!router)
                                continue;
@@ -571,7 +565,6 @@ static bool batadv_vis_packet_full(const struct batadv_vis_info *info)
 static int batadv_generate_vis_packet(struct batadv_priv *bat_priv)
 {
        struct batadv_hashtable *hash = bat_priv->orig_hash;
-       struct hlist_node *node;
        struct hlist_head *head;
        struct batadv_orig_node *orig_node;
        struct batadv_neigh_node *router;
@@ -605,7 +598,7 @@ static int batadv_generate_vis_packet(struct batadv_priv *bat_priv)
                head = &hash->table[i];
 
                rcu_read_lock();
-               hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
+               hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
                        router = batadv_orig_node_get_router(orig_node);
                        if (!router)
                                continue;
@@ -644,7 +637,7 @@ next:
                head = &hash->table[i];
 
                rcu_read_lock();
-               hlist_for_each_entry_rcu(tt_common_entry, node, head,
+               hlist_for_each_entry_rcu(tt_common_entry, head,
                                         hash_entry) {
                        packet_pos = skb_put(info->skb_packet, sizeof(*entry));
                        entry = (struct batadv_vis_info_entry *)packet_pos;
@@ -673,14 +666,14 @@ static void batadv_purge_vis_packets(struct batadv_priv *bat_priv)
 {
        uint32_t i;
        struct batadv_hashtable *hash = bat_priv->vis.hash;
-       struct hlist_node *node, *node_tmp;
+       struct hlist_node *node_tmp;
        struct hlist_head *head;
        struct batadv_vis_info *info;
 
        for (i = 0; i < hash->size; i++) {
                head = &hash->table[i];
 
-               hlist_for_each_entry_safe(info, node, node_tmp,
+               hlist_for_each_entry_safe(info, node_tmp,
                                          head, hash_entry) {
                        /* never purge own data. */
                        if (info == bat_priv->vis.my_info)
@@ -688,7 +681,7 @@ static void batadv_purge_vis_packets(struct batadv_priv *bat_priv)
 
                        if (batadv_has_timed_out(info->first_seen,
                                                 BATADV_VIS_TIMEOUT)) {
-                               hlist_del(node);
+                               hlist_del(&info->hash_entry);
                                batadv_send_list_del(info);
                                kref_put(&info->refcount, batadv_free_info);
                        }
@@ -700,7 +693,6 @@ static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv,
                                        struct batadv_vis_info *info)
 {
        struct batadv_hashtable *hash = bat_priv->orig_hash;
-       struct hlist_node *node;
        struct hlist_head *head;
        struct batadv_orig_node *orig_node;
        struct batadv_vis_packet *packet;
@@ -715,7 +707,7 @@ static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv,
                head = &hash->table[i];
 
                rcu_read_lock();
-               hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
+               hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
                        /* if it's a vis server and reachable, send it. */
                        if (!(orig_node->flags & BATADV_VIS_SERVER))
                                continue;