aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSatyam Sharma <ssatyam@cse.iitk.ac.in>2007-07-16 02:39:24 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:40 -0400
commite1f4a88c5a15a86124a95ea712213bb7dab2ad99 (patch)
tree7ec29d5eb850629ee11c2ec8cc467877430e9039 /include
parentb5d425c97f7d4e92151167b01ca038e7853c6b37 (diff)
introduce write_trylock_irqsave()
Introduce a write_trylock_irqsave() implementation. Similar in style to the implementation of spin_trylock_irqsave() in mainline. Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in> Cc: Sripathi Kodi <sripathik@in.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/spinlock.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index a946176db638..c376f3b36c89 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -282,6 +282,13 @@ do { \
282 1 : ({ local_irq_restore(flags); 0; }); \ 282 1 : ({ local_irq_restore(flags); 0; }); \
283}) 283})
284 284
285#define write_trylock_irqsave(lock, flags) \
286({ \
287 local_irq_save(flags); \
288 write_trylock(lock) ? \
289 1 : ({ local_irq_restore(flags); 0; }); \
290})
291
285/* 292/*
286 * Locks two spinlocks l1 and l2. 293 * Locks two spinlocks l1 and l2.
287 * l1_first indicates if spinlock l1 should be taken first. 294 * l1_first indicates if spinlock l1 should be taken first.