Commit 5274cd68 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli

batman-adv: Add lockdep_asserts for documented external locks

Some functions already have documentation about locks they require inside
their kerneldoc header. These can be directly tested during runtime using
the lockdep asserts.
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
parent 2c72d655
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/lockdep.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/pkt_sched.h> #include <linux/pkt_sched.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
...@@ -112,6 +113,8 @@ static int batadv_frag_size_limit(void) ...@@ -112,6 +113,8 @@ static int batadv_frag_size_limit(void)
static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain, static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
u16 seqno) u16 seqno)
{ {
lockdep_assert_held(&chain->lock);
if (chain->seqno == seqno) if (chain->seqno == seqno)
return false; return false;
......
...@@ -609,6 +609,8 @@ static void batadv_mcast_want_unsnoop_update(struct batadv_priv *bat_priv, ...@@ -609,6 +609,8 @@ static void batadv_mcast_want_unsnoop_update(struct batadv_priv *bat_priv,
struct hlist_node *node = &orig->mcast_want_all_unsnoopables_node; struct hlist_node *node = &orig->mcast_want_all_unsnoopables_node;
struct hlist_head *head = &bat_priv->mcast.want_all_unsnoopables_list; struct hlist_head *head = &bat_priv->mcast.want_all_unsnoopables_list;
lockdep_assert_held(&orig->mcast_handler_lock);
/* switched from flag unset to set */ /* switched from flag unset to set */
if (mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES && if (mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES &&
!(orig->mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES)) { !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES)) {
...@@ -652,6 +654,8 @@ static void batadv_mcast_want_ipv4_update(struct batadv_priv *bat_priv, ...@@ -652,6 +654,8 @@ static void batadv_mcast_want_ipv4_update(struct batadv_priv *bat_priv,
struct hlist_node *node = &orig->mcast_want_all_ipv4_node; struct hlist_node *node = &orig->mcast_want_all_ipv4_node;
struct hlist_head *head = &bat_priv->mcast.want_all_ipv4_list; struct hlist_head *head = &bat_priv->mcast.want_all_ipv4_list;
lockdep_assert_held(&orig->mcast_handler_lock);
/* switched from flag unset to set */ /* switched from flag unset to set */
if (mcast_flags & BATADV_MCAST_WANT_ALL_IPV4 && if (mcast_flags & BATADV_MCAST_WANT_ALL_IPV4 &&
!(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV4)) { !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV4)) {
...@@ -695,6 +699,8 @@ static void batadv_mcast_want_ipv6_update(struct batadv_priv *bat_priv, ...@@ -695,6 +699,8 @@ static void batadv_mcast_want_ipv6_update(struct batadv_priv *bat_priv,
struct hlist_node *node = &orig->mcast_want_all_ipv6_node; struct hlist_node *node = &orig->mcast_want_all_ipv6_node;
struct hlist_head *head = &bat_priv->mcast.want_all_ipv6_list; struct hlist_head *head = &bat_priv->mcast.want_all_ipv6_list;
lockdep_assert_held(&orig->mcast_handler_lock);
/* switched from flag unset to set */ /* switched from flag unset to set */
if (mcast_flags & BATADV_MCAST_WANT_ALL_IPV6 && if (mcast_flags & BATADV_MCAST_WANT_ALL_IPV6 &&
!(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV6)) { !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV6)) {
......
...@@ -3271,6 +3271,8 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) ...@@ -3271,6 +3271,8 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
*/ */
static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv) static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv)
{ {
lockdep_assert_held(&bat_priv->tt.commit_lock);
/* Update multicast addresses in local translation table */ /* Update multicast addresses in local translation table */
batadv_mcast_mla_update(bat_priv); batadv_mcast_mla_update(bat_priv);
......
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