added migrate function and others for replace fb
[ana-net.git] / sem / locks / call_kern.cocci
blob00af5344a68f2a1269b85e093bc25ddc56e0f98e
1 /// Find functions that refer to GFP_KERNEL but are called with locks held.
2 /// The proposed change of converting the GFP_KERNEL is not necessarily the
3 /// correct one.  It may be desired to unlock the lock, or to not call the
4 /// function under the lock in the first place.
5 ///
6 // Confidence: Moderate
7 // Copyright: (C) 2010 Nicolas Palix, DIKU.  GPLv2.
8 // Copyright: (C) 2010 Julia Lawall, DIKU.  GPLv2.
9 // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6.  GPLv2.
10 // URL: http://coccinelle.lip6.fr/
11 // Comments:
12 // Options: -no_includes -include_headers
14 virtual patch
16 @gfp exists@
17 identifier fn;
18 position p;
21 fn(...) {
22  ... when != read_unlock_irq(...)
23      when != write_unlock_irq(...)
24      when != read_unlock_irqrestore(...)
25      when != write_unlock_irqrestore(...)
26      when != spin_unlock(...)
27      when != spin_unlock_irq(...)
28      when != spin_unlock_irqrestore(...)
29      when != local_irq_enable(...)
30      when any
31  GFP_KERNEL@p
32  ... when any
35 @locked@
36 identifier gfp.fn;
40 read_lock_irq
42 write_lock_irq
44 read_lock_irqsave
46 write_lock_irqsave
48 spin_lock
50 spin_trylock
52 spin_lock_irq
54 spin_lock_irqsave
56 local_irq_disable
58  (...)
59 ...  when != read_unlock_irq(...)
60      when != write_unlock_irq(...)
61      when != read_unlock_irqrestore(...)
62      when != write_unlock_irqrestore(...)
63      when != spin_unlock(...)
64      when != spin_unlock_irq(...)
65      when != spin_unlock_irqrestore(...)
66      when != local_irq_enable(...)
67 fn(...)
69 @depends on locked@
70 position gfp.p;
73 - GFP_KERNEL@p
74 + GFP_ATOMIC