xref: /dflybsd-src/sys/dev/drm/scripts/linux_spin_locks.cocci (revision 220c9d77d60dd995be5edb6a5022087b33616d20)
1*220c9d77SFrançois Tigeot// Replace Linux spin_lock/spin_unlock calls by lockmgr ones
2*220c9d77SFrançois Tigeot// Usage: spatch --no-includes --sp-file scripts/linux_spin_locks.cocci --in-place <files>
3*220c9d77SFrançois Tigeot
4*220c9d77SFrançois Tigeot@@ expression E1, E2; @@
5*220c9d77SFrançois Tigeot
6*220c9d77SFrançois Tigeot(
7*220c9d77SFrançois Tigeot- spin_lock(E1);
8*220c9d77SFrançois Tigeot+ lockmgr(E1, LK_EXCLUSIVE);
9*220c9d77SFrançois Tigeot|
10*220c9d77SFrançois Tigeot- spin_unlock(E1);
11*220c9d77SFrançois Tigeot+ lockmgr(E1, LK_RELEASE);
12*220c9d77SFrançois Tigeot|
13*220c9d77SFrançois Tigeot- spin_trylock(E1);
14*220c9d77SFrançois Tigeot+ lockmgr_try(E1, LK_EXCLUSIVE);
15*220c9d77SFrançois Tigeot|
16*220c9d77SFrançois Tigeot- spin_lock_nested(E1, E2);
17*220c9d77SFrançois Tigeot+ lockmgr(E1, LK_EXCLUSIVE);
18*220c9d77SFrançois Tigeot)
19