[PATCH] 2.5.53 : drivers/net/wan/x25_asy.c

From: Frank Davis (fdavis@si.rr.com)
Date: Sat Dec 28 2002 - 20:04:21 EST


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

Regards,
Frank

--- linux/drivers/net/wan/x25_asy.c.old Sat Dec 28 18:49:00 2002
+++ linux/drivers/net/wan/x25_asy.c Sat Dec 28 18:54:51 2002
@@ -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);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Dec 31 2002 - 22:00:13 EST