Commit 433ff98f authored by Marek Lindner's avatar Marek Lindner Committed by Antonio Quartulli

batman-adv: update kernel doc of batadv_tt_global_del_orig_entry()

The updated kernel doc & additional comment shall prevent accidental
copy & paste errors or calling the function without the required
precautions.
Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
parent 4f248cff
...@@ -1658,20 +1658,26 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) ...@@ -1658,20 +1658,26 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
} }
/** /**
* batadv_tt_global_del_orig_entry - remove and free an orig_entry * _batadv_tt_global_del_orig_entry - remove and free an orig_entry
* @tt_global_entry: the global entry to remove the orig_entry from * @tt_global_entry: the global entry to remove the orig_entry from
* @orig_entry: the orig entry to remove and free * @orig_entry: the orig entry to remove and free
* *
* Remove an orig_entry from its list in the given tt_global_entry and * Remove an orig_entry from its list in the given tt_global_entry and
* free this orig_entry afterwards. * free this orig_entry afterwards.
*
* Caller must hold tt_global_entry->list_lock and ensure orig_entry->list is
* part of a list.
*/ */
static void static void
batadv_tt_global_del_orig_entry(struct batadv_tt_global_entry *tt_global_entry, _batadv_tt_global_del_orig_entry(struct batadv_tt_global_entry *tt_global_entry,
struct batadv_tt_orig_list_entry *orig_entry) struct batadv_tt_orig_list_entry *orig_entry)
{ {
batadv_tt_global_size_dec(orig_entry->orig_node, batadv_tt_global_size_dec(orig_entry->orig_node,
tt_global_entry->common.vid); tt_global_entry->common.vid);
atomic_dec(&tt_global_entry->orig_list_count); atomic_dec(&tt_global_entry->orig_list_count);
/* requires holding tt_global_entry->list_lock and orig_entry->list
* being part of a list
*/
hlist_del_rcu(&orig_entry->list); hlist_del_rcu(&orig_entry->list);
batadv_tt_orig_list_entry_free_ref(orig_entry); batadv_tt_orig_list_entry_free_ref(orig_entry);
} }
...@@ -1687,7 +1693,7 @@ batadv_tt_global_del_orig_list(struct batadv_tt_global_entry *tt_global_entry) ...@@ -1687,7 +1693,7 @@ batadv_tt_global_del_orig_list(struct batadv_tt_global_entry *tt_global_entry)
spin_lock_bh(&tt_global_entry->list_lock); spin_lock_bh(&tt_global_entry->list_lock);
head = &tt_global_entry->orig_list; head = &tt_global_entry->orig_list;
hlist_for_each_entry_safe(orig_entry, safe, head, list) hlist_for_each_entry_safe(orig_entry, safe, head, list)
batadv_tt_global_del_orig_entry(tt_global_entry, orig_entry); _batadv_tt_global_del_orig_entry(tt_global_entry, orig_entry);
spin_unlock_bh(&tt_global_entry->list_lock); spin_unlock_bh(&tt_global_entry->list_lock);
} }
...@@ -1722,8 +1728,8 @@ batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv, ...@@ -1722,8 +1728,8 @@ batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv,
orig_node->orig, orig_node->orig,
tt_global_entry->common.addr, tt_global_entry->common.addr,
BATADV_PRINT_VID(vid), message); BATADV_PRINT_VID(vid), message);
batadv_tt_global_del_orig_entry(tt_global_entry, _batadv_tt_global_del_orig_entry(tt_global_entry,
orig_entry); orig_entry);
} }
} }
spin_unlock_bh(&tt_global_entry->list_lock); spin_unlock_bh(&tt_global_entry->list_lock);
......
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