net: add sparse annotation to ptype_seq_start/stop
Subsystems (2)
PATCH 1/1 net: add sparse annotation to ptype_seq_start/stop
Get rid of some more sparse warnings.
net/core/dev.c +2 -0
@@ -2543,6 +2543,7 @@ static void *ptype_get_idx(loff_t pos) }static void *ptype_seq_start (struct seq_file *seq,loff_t *pos) +__acquires (rcu) {rcu_read_lock ();return *pos ?ptype_get_idx (*pos -1 ) :SEQ_START_TOKEN ;
@@ -2578,6 +2579,7 @@ found: }static void ptype_seq_stop (struct seq_file *seq,void *v) +__releases (rcu) {rcu_read_unlock (); }
Quoted 3 lines · Stephen Hemminger
Get rid of some more sparse warnings.
Signed-off-by Stephen Hemminger <[email protected]>
Adding Josh to CC -- is __acquires() case-insensitive? If not, this needs to be __acquires(RCU) and __releases(RCU).
Thanx, Paul
Quoted 22 lines
net/core/dev.c +2
-1@@ -2543,6 +2543,7 @@ static void *ptype_get_idx(loff_t pos) }static void *ptype_seq_start (struct seq_file *seq,loff_t *pos) +__acquires (rcu) {rcu_read_lock ();return *pos ?ptype_get_idx (*pos -1 ) :SEQ_START_TOKEN ;@@ -2578,6 +2579,7 @@ found: }static void ptype_seq_stop (struct seq_file *seq,void *v) +__releases (rcu) {rcu_read_unlock (); } --To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Paul E. McKenney
Quoted 3 lines · Stephen Hemminger
Get rid of some more sparse warnings.
Signed-off-by Stephen Hemminger <[email protected]>Adding Josh to CC -- is
__acquires()case-insensitive? If not, this needs to be__acquires(RCU)and__releases(RCU).
__acquires(whatever_the_helk_you_put_as_its_argument) is all the same.
Quoted 10 lines · Al Viro
Quoted 7 lines · Paul E. McKenney
Quoted 3 lines · Stephen Hemminger
Get rid of some more sparse warnings.
Signed-off-by Stephen Hemminger <[email protected]>Adding Josh to CC -- is
__acquires()case-insensitive? If not, this needs to be__acquires(RCU)and__releases(RCU).
__acquires(whatever_the_helk_you_put_as_its_argument)is all the same.
The existing calls are __acquires(RCU) and __releases(RCU). I suppose that one -could- use __acquires(RCU) in some places and __acquires(rcu) in others, but that sounds like it would eventually bite us...
Thanx, Paul
Quoted 7 lines · Paul E. McKenney
Quoted 3 lines · Stephen Hemminger
Get rid of some more sparse warnings.
Signed-off-by Stephen Hemminger <[email protected]>Adding Josh to CC -- is
__acquires()case-insensitive? If not, this needs to be__acquires(RCU)and__releases(RCU).
[...]
Quoted 13 lines
Quoted 13 lines
net/core/dev.c +1
-0@@ -2543,6 +2543,7 @@ static void *ptype_get_idx(loff_t pos) }static void *ptype_seq_start (struct seq_file *seq,loff_t *pos) +__acquires (rcu) {rcu_read_lock ();return *pos ?ptype_get_idx (*pos -1 ) :SEQ_START_TOKEN ;@@ -2578,6 +2579,7 @@ found: }
Quoted 5 lines
net/core/dev.c found: · line 2585
Quoted 5 lines
net/core/dev.c +1
-0static void ptype_seq_stop (struct seq_file *seq,void *v) +__releases (rcu) {rcu_read_unlock (); }
At the moment, Sparse doesn't actually use the context expression. In the ideal case when it does, all references to the same lock should use a context expression which resolves to that lock (whatever that may mean; hence why Sparse doesn't handle it yet). For mechanisms like RCU without a lock variable, this will likely entail some sort of fake lock expression, which again needs to match between all users of the same mechanism. Like any expression in C, case matters; thus, please match the existing references to "RCU" rather than "rcu".
- Josh Triplett
David Miller
maintainerFrom: Josh Triplett <[email protected]>
Date: Sun, 20 Jan 2008 23:29:32 -0800
Quoted 8 lines
At the moment, Sparse doesn't actually use the context expression. In the ideal case when it does, all references to the same lock should use a context expression which resolves to that lock (whatever that may mean; hence why Sparse doesn't handle it yet). For mechanisms like RCU without a lock variable, this will likely entail some sort of fake lock expression, which again needs to match between all users of the same mechanism. Like any expression in C, case matters; thus, please match the existing references to "RCU" rather than "rcu".
Thus, I've checked in Stephen's patch with __acquires(RCU) and __releases(RCU).
Thanks.