From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Marek Lindner <mareklindner@neomailbox.ch>,
Antonio Quartulli <antonio@meshcoding.com>
Subject: [B.A.T.M.A.N.] [PATCH 04/15] batman-adv: update kernel doc of batadv_tt_global_del_orig_entry()
Date: Tue, 25 Aug 2015 13:02:28 +0200 [thread overview]
Message-ID: <1440500559-28368-5-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1440500559-28368-1-git-send-email-antonio@meshcoding.com>
From: Marek Lindner <mareklindner@neomailbox.ch>
The updated kernel doc & additional comment shall prevent accidental
copy & paste errors or calling the function without the required
precautions.
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
net/batman-adv/translation-table.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 7e34901..6b5f718 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1658,20 +1658,26 @@ out:
}
/**
- * 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
* @orig_entry: the orig entry to remove and free
*
* Remove an orig_entry from its list in the given tt_global_entry and
* 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
-batadv_tt_global_del_orig_entry(struct batadv_tt_global_entry *tt_global_entry,
- struct batadv_tt_orig_list_entry *orig_entry)
+_batadv_tt_global_del_orig_entry(struct batadv_tt_global_entry *tt_global_entry,
+ struct batadv_tt_orig_list_entry *orig_entry)
{
batadv_tt_global_size_dec(orig_entry->orig_node,
tt_global_entry->common.vid);
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);
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)
spin_lock_bh(&tt_global_entry->list_lock);
head = &tt_global_entry->orig_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);
}
@@ -1722,8 +1728,8 @@ batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv,
orig_node->orig,
tt_global_entry->common.addr,
BATADV_PRINT_VID(vid), message);
- 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);
--
2.5.0
next prev parent reply other threads:[~2015-08-25 11:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 11:02 [B.A.T.M.A.N.] pull request: batman-adv 20150825 Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 01/15] batman-adv: Replace C99 int types with kernel type Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 02/15] batman-adv: Fix kerneldoc over 80 column lines Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 03/15] batman-adv: Remove multiple assignment per line Antonio Quartulli
2015-08-25 11:02 ` Antonio Quartulli [this message]
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 05/15] batman-adv: rename batadv_new_tt_req_node to batadv_tt_req_node_new Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 06/15] batman-adv: Remove batadv_ types forward declarations Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 07/15] batman-adv: convert orig_node->vlan_list to hlist Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 08/15] batman-adv: prevent potential hlist double deletion Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 09/15] batman-adv: Return EINVAL on invalid gw_bandwidth change Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 10/15] batman-adv: Fix gw_bandwidth calculation on 32 bit systems Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 11/15] batman-adv: convert bat_priv->tt.req_list to hlist Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 12/15] batman-adv: Annotate deleting functions with external lock via lockdep Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 13/15] batman-adv: Add lockdep_asserts for documented external locks Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 14/15] batman-adv: Fix conditional statements indentation Antonio Quartulli
2015-08-25 11:02 ` [B.A.T.M.A.N.] [PATCH 15/15] batman-adv: beautify supported routing algorithm list Antonio Quartulli
2015-08-25 23:21 ` [B.A.T.M.A.N.] pull request: batman-adv 20150825 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440500559-28368-5-git-send-email-antonio@meshcoding.com \
--to=antonio@meshcoding.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=mareklindner@neomailbox.ch \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox