public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RFC] spin_trylock_bh
@ 2001-09-15 20:26 Arnaldo Carvalho de Melo
  2001-09-20 23:59 ` David S. Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-09-15 20:26 UTC (permalink / raw)
  To: Linus Torvalds, Alan Cox, David S.Miller
  Cc: Linux Kernel Mailing List, Paul Mackerras

Hi,

	Please see if this is acceptable, I noticed this while working on
the locks for NetBEUI 8) Patch is against 2.4.9, but it should apply to
latest prepatch. It was being used in the ppp code for quite some time.

                        - Arnaldo

Index: include/linux/spinlock.h
===================================================================
RCS file: /home/cvs/kernel-acme/include/linux/spinlock.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 spinlock.h
--- include/linux/spinlock.h	2001/08/16 21:48:34	1.1.1.2
+++ include/linux/spinlock.h	2001/09/15 20:16:44
@@ -30,6 +30,10 @@
 #define write_unlock_irqrestore(lock, flags)	do { write_unlock(lock); local_irq_restore(flags); } while (0)
 #define write_unlock_irq(lock)			do { write_unlock(lock); local_irq_enable();       } while (0)
 #define write_unlock_bh(lock)			do { write_unlock(lock); local_bh_enable();        } while (0)
+#define spin_trylock_bh(lock)			({ int __r; local_bh_disable();\
+						__r = spin_trylock(lock);      \
+						if (!__r) local_bh_enable();   \
+						__r; })
 
 #ifdef CONFIG_SMP
 #include <asm/spinlock.h>
Index: drivers/net/ppp_synctty.c
===================================================================
RCS file: /home/cvs/kernel-acme/drivers/net/ppp_synctty.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 ppp_synctty.c
--- drivers/net/ppp_synctty.c	2001/08/16 21:45:05	1.1.1.2
+++ drivers/net/ppp_synctty.c	2001/09/15 20:16:47
@@ -44,13 +44,6 @@
 #include <linux/init.h>
 #include <asm/uaccess.h>
 
-#ifndef spin_trylock_bh
-#define spin_trylock_bh(lock)	({ int __r; local_bh_disable();	\
-				   __r = spin_trylock(lock);	\
-				   if (!__r) local_bh_enable();	\
-				   __r; })
-#endif
-
 #define PPP_VERSION	"2.4.1"
 
 /* Structure for storing local state. */
Index: net/ipv6/ip6_fib.c
===================================================================
RCS file: /home/cvs/kernel-acme/net/ipv6/ip6_fib.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 ip6_fib.c
--- net/ipv6/ip6_fib.c	2001/08/16 18:44:10	1.1.1.2
+++ net/ipv6/ip6_fib.c	2001/09/15 20:16:50
@@ -1192,10 +1192,8 @@
 		spin_lock_bh(&fib6_gc_lock);
 		gc_args.timeout = (int)dummy;
 	} else {
-		local_bh_disable();
-		if (!spin_trylock(&fib6_gc_lock)) {
+		if (!spin_trylock_bh(&fib6_gc_lock)) {
 			mod_timer(&ip6_fib_timer, jiffies + HZ);
-			local_bh_enable();
 			return;
 		}
 		gc_args.timeout = ip6_rt_gc_interval;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-09-21  0:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-15 20:26 [PATCH][RFC] spin_trylock_bh Arnaldo Carvalho de Melo
2001-09-20 23:59 ` David S. Miller
2001-09-21  0:07   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox