From 9a429c4983deae020f1e757ecc8f547b6d4e2f2b Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Tue, 1 Jan 2008 21:58:02 -0800 Subject: [NET]: Add some acquires/releases sparse annotations. Add __acquires() and __releases() annotations to suppress some sparse warnings. example of warnings : net/ipv4/udp.c:1555:14: warning: context imbalance in 'udp_seq_start' - wrong count at exit net/ipv4/udp.c:1571:13: warning: context imbalance in 'udp_seq_stop' - unexpected unlock Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- net/core/dev.c | 2 ++ net/core/dev_mcast.c | 2 ++ net/core/gen_stats.c | 1 + net/core/neighbour.c | 2 ++ net/core/sock.c | 2 ++ 5 files changed, 9 insertions(+) (limited to 'net/core') diff --git a/net/core/dev.c b/net/core/dev.c index 7153e94f50ad..eee774243097 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2368,6 +2368,7 @@ static int dev_ifconf(struct net *net, char __user *arg) * in detail. */ void *dev_seq_start(struct seq_file *seq, loff_t *pos) + __acquires(dev_base_lock) { struct net *net = seq_file_net(seq); loff_t off; @@ -2394,6 +2395,7 @@ void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) } void dev_seq_stop(struct seq_file *seq, void *v) + __releases(dev_base_lock) { read_unlock(&dev_base_lock); } diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index 63f0b33d7ced..cadbfbf7e7f5 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c @@ -186,6 +186,7 @@ EXPORT_SYMBOL(dev_mc_unsync); #ifdef CONFIG_PROC_FS static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos) + __acquires(dev_base_lock) { struct net *net = seq_file_net(seq); struct net_device *dev; @@ -206,6 +207,7 @@ static void *dev_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos) } static void dev_mc_seq_stop(struct seq_file *seq, void *v) + __releases(dev_base_lock) { read_unlock(&dev_base_lock); } diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index bcc25591d8ac..8073561f7c63 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c @@ -55,6 +55,7 @@ rtattr_failure: int gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type, int xstats_type, spinlock_t *lock, struct gnet_dump *d) + __acquires(lock) { memset(d, 0, sizeof(*d)); diff --git a/net/core/neighbour.c b/net/core/neighbour.c index bd899d557737..802493327a87 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -2313,6 +2313,7 @@ static void *neigh_get_idx_any(struct seq_file *seq, loff_t *pos) } void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl, unsigned int neigh_seq_flags) + __acquires(tbl->lock) { struct neigh_seq_state *state = seq->private; loff_t pos_minus_one; @@ -2356,6 +2357,7 @@ out: EXPORT_SYMBOL(neigh_seq_next); void neigh_seq_stop(struct seq_file *seq, void *v) + __releases(tbl->lock) { struct neigh_seq_state *state = seq->private; struct neigh_table *tbl = state->tbl; diff --git a/net/core/sock.c b/net/core/sock.c index 3804e7df626b..3d7757ee2fc8 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2025,6 +2025,7 @@ EXPORT_SYMBOL(proto_unregister); #ifdef CONFIG_PROC_FS static void *proto_seq_start(struct seq_file *seq, loff_t *pos) + __acquires(proto_list_lock) { read_lock(&proto_list_lock); return seq_list_start_head(&proto_list, *pos); @@ -2036,6 +2037,7 @@ static void *proto_seq_next(struct seq_file *seq, void *v, loff_t *pos) } static void proto_seq_stop(struct seq_file *seq, void *v) + __releases(proto_list_lock) { read_unlock(&proto_list_lock); } -- cgit v1.2.3