mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 24/41 sound/oss/sys_timer.c - convert cli to spinlocks
@ 2002-08-29 19:56 pwaechtler
  0 siblings, 0 replies; only message in thread
From: pwaechtler @ 2002-08-29 19:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds

--- vanilla-2.5.32/sound/oss/sys_timer.c	Sat Apr 20 18:25:21 2002
+++ linux-2.5-cli-oss/sound/oss/sys_timer.c	Thu Aug 15 14:30:00 2002
@@ -15,6 +15,7 @@
  * Thomas Sailer   : ioctl code reworked (vmalloc/vfree removed)
  * Andrew Veliath  : adapted tmr2ticks from level 1 sequencer (avoid overflow)
  */
+#include <linux/spinlock.h>
 #include "sound_config.h"
 
 static volatile int opened = 0, tmr_running = 0;
@@ -26,7 +27,7 @@
 static unsigned long prev_event_time;
 
 static void     poll_def_tmr(unsigned long dummy);
-
+static spinlock_t lock=SPIN_LOCK_UNLOCKED;
 
 static struct timer_list def_tmr =
 {function: poll_def_tmr};
@@ -62,6 +63,7 @@
 
 		  if (tmr_running)
 		    {
+				spin_lock(&lock);
 			    tmr_ctr++;
 			    curr_ticks = ticks_offs + tmr2ticks(tmr_ctr);
 
@@ -70,6 +72,7 @@
 				      next_event_time = (unsigned long) -1;
 				      sequencer_timer(0);
 			      }
+				spin_unlock(&lock);
 		    }
 	  }
 }
@@ -79,15 +82,14 @@
 {
 	unsigned long   flags;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&lock,flags);
 	tmr_offs = 0;
 	ticks_offs = 0;
 	tmr_ctr = 0;
 	next_event_time = (unsigned long) -1;
 	prev_event_time = 0;
 	curr_ticks = 0;
-	restore_flags(flags);
+	spin_unlock_irqrestore(&lock,flags);
 }
 
 static int


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-29 22:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-29 19:56 [PATCH] 24/41 sound/oss/sys_timer.c - convert cli to spinlocks pwaechtler

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

all inboxes | Powered by JetHome®