From: Satyam Sharma Date: Mon, 16 Jul 2007 06:39:24 +0000 (-0700) Subject: introduce write_trylock_irqsave() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e1f4a88c5a15a86124a95ea712213bb7dab2ad99;p=openwrt%2Fstaging%2Fblogic.git 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 Cc: Sripathi Kodi Cc: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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 { \ 1 : ({ local_irq_restore(flags); 0; }); \ }) +#define write_trylock_irqsave(lock, flags) \ +({ \ + local_irq_save(flags); \ + write_trylock(lock) ? \ + 1 : ({ local_irq_restore(flags); 0; }); \ +}) + /* * Locks two spinlocks l1 and l2. * l1_first indicates if spinlock l1 should be taken first.