patch-2.1.36 linux/include/asm-sparc/softirq.h

Next file: linux/include/asm-sparc/spinlock.h
Previous file: linux/include/asm-sparc/smp_lock.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.35/linux/include/asm-sparc/softirq.h linux/include/asm-sparc/softirq.h
@@ -13,18 +13,17 @@
  * is entirely private to an implementation, it should not be
  * referenced at all outside of this file.
  */
+#define get_active_bhs()	(bh_mask & bh_active)
+
+#ifdef __SMP__
+
 extern atomic_t __sparc_bh_counter;
 
-/* Linus, I'd _really_ like to get rid of this synchronize_irq() -DaveM */
 #define start_bh_atomic() \
 	do { atomic_inc(&__sparc_bh_counter); synchronize_irq(); } while(0)
 
 #define end_bh_atomic()		atomic_dec(&__sparc_bh_counter)
 
-#define get_active_bhs()	(bh_mask & bh_active)
-
-#ifdef __SMP__
-
 #include <asm/spinlock.h>
 
 extern spinlock_t global_bh_lock;
@@ -39,6 +38,15 @@
 	spin_unlock_irqrestore(&global_bh_lock, flags);	\
 } while(0)
 
+#define remove_bh(nr)					\
+do {	unsigned long flags;				\
+	int ent = nr;					\
+	spin_lock_irqsave(&global_bh_lock, flags);	\
+	bh_base[ent] = NULL;				\
+	bh_mask &= ~(1 << ent);				\
+	spin_unlock_irqrestore(&global_bh_lock, flags);	\
+} while(0)
+
 #define mark_bh(nr)					\
 do {	unsigned long flags;				\
 	spin_lock_irqsave(&global_bh_lock, flags);	\
@@ -83,10 +91,13 @@
 
 #else /* !(__SMP__) */
 
-#define softirq_trylock() \
-	(atomic_read(&__sparc_bh_counter) ? 0 : ((atomic_set(&__sparc_bh_counter,1)),1))
+extern int __sparc_bh_counter;
 
-#define softirq_endlock()	(atomic_set(&__sparc_bh_counter, 0))
+#define start_bh_atomic()	do { __sparc_bh_counter++; barrier(); } while(0)
+#define end_bh_atomic()		do { barrier(); __sparc_bh_counter--; } while(0)
+
+#define softirq_trylock() (__sparc_bh_counter ? 0 : (__sparc_bh_counter=1))
+#define softirq_endlock() (__sparc_bh_counter = 0)
 #define clear_active_bhs(x)	(bh_active &= ~(x))
 
 #define init_bh(nr, routine)	\
@@ -94,6 +105,12 @@
 	bh_base[ent] = routine;	\
 	bh_mask_count[ent] = 0;	\
 	bh_mask |= 1 << ent;	\
+} while(0)
+
+#define remove_bh(nr)		\
+do {	int ent = nr;		\
+	bh_base[ent] = NULL;	\
+	bh_mask &= ~(1 << ent);	\
 } while(0)
 
 #define mark_bh(nr)		(bh_active |= (1 << (nr)))

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov