public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.5.53 : drivers/net/wan/x25_asy.c
@ 2002-12-29  1:04 Frank Davis
  2002-12-30  1:17 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Frank Davis @ 2002-12-29  1:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: fdavis

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);


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

* Re: [PATCH] 2.5.53 : drivers/net/wan/x25_asy.c
  2002-12-29  1:04 [PATCH] 2.5.53 : drivers/net/wan/x25_asy.c Frank Davis
@ 2002-12-30  1:17 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2002-12-30  1:17 UTC (permalink / raw)
  To: Frank Davis; +Cc: Linux Kernel Mailing List

On Sun, 2002-12-29 at 01:04, Frank Davis wrote:
> 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


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

end of thread, other threads:[~2002-12-30  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-29  1:04 [PATCH] 2.5.53 : drivers/net/wan/x25_asy.c Frank Davis
2002-12-30  1:17 ` Alan Cox

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