Skip to contentSkip to conversation

2.5.53 : drivers/net/wan/x25_asy.c

PATCH In review Frank Davis 2 participants 2 messages Dec 29, 2002 – Dec 30, 2002 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.53 : drivers/net/wan/x25_asy.c

Hello all,
The attached patch swaps the save_flags/cli/restore_flags combo with a
spinlock. Please review.

Regards,
Frank

drivers/net/wan/x25_asy.c renamed from drivers/net/wan/x25_asy.c.old +4 -3
@@ -33,6 +33,7 @@
 #include <linux/lapb.h>
 #include <linux/init.h>
 #include "x25_asy.h"
+#include <linux/spinlock.h>
 
 typedef struct x25_ctrl {
 	struct x25_asy	ctrl;		/* X.25 things			*/
@@ -40,6 +41,7 @@
 } x25_asy_ctrl_t;
 
 static x25_asy_ctrl_t	**x25_asy_ctrls = NULL;
+static spinlock_t x25_asy_slock = SPIN_LOCK_UNLOCKED;
 
 int x25_asy_maxdev = SL_NRUNIT;		/* Can be overridden with insmod! */
 
@@ -164,8 +166,7 @@
 		return;
 	}
 
-	save_flags(flags); 
-	cli();
+	spin_lock_irqsave(&x25_asy_slock, flags); 
 
 	oxbuff    = sl->xbuff;
 	sl->xbuff = xbuff;
@@ -195,7 +196,7 @@
 
 	sl->buffsize = len;
 
-	restore_flags(flags);
+	spin_unlock_irqrestore(&x25_asy_slock, flags);
 
 	if (oxbuff != NULL) 
 		kfree(oxbuff);
#1 lore raw
Quoted 3 lines · Frank Davis

Hello all,
The attached patch swaps the save_flags/cli/restore_flags combo with a
spinlock. Please review.

You need to take the lock on the irq path as well