mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 2.5.29 sound/oss/trident.c [2/2] remove cli/sti calls
@ 2002-07-28 20:22 Muli Ben-Yehuda
  2002-07-29  8:08 ` Zwane Mwaikambo
  0 siblings, 1 reply; 4+ messages in thread
From: Muli Ben-Yehuda @ 2002-07-28 20:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 2724 bytes --]

Hello, 

This patch replaces the cli/sti calls in the trident.c driver with
spin_lock_irqsave/spin_unlock_irqrestore.

Patch is against 2.5.29 (latest bitkeeper), compiled and
tested. Please apply. 

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.480   -> 1.481  
#	 sound/oss/trident.c	1.23    -> 1.24   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/07/28	mulix@alhambra.merseine.nu	1.481
# get rid of cli/sti
# --------------------------------------------
#
diff -Nru a/sound/oss/trident.c b/sound/oss/trident.c
--- a/sound/oss/trident.c	Sun Jul 28 23:09:05 2002
+++ b/sound/oss/trident.c	Sun Jul 28 23:09:05 2002
@@ -768,9 +768,8 @@
  	 *	Keep interrupts off for the configure - we don't want to
  	 *	clash with another cyberpro config event
  	 */
- 
-	save_flags(flags);
-	cli();
+ 	
+	spin_lock_irqsave(&card->lock, flags); 
 	portDat = cyber_inidx(CYBER_PORT_AUDIO, CYBER_IDX_AUDIO_ENABLE);
 	/* enable, if it was disabled */
 	if( (portDat & CYBER_BMSK_AUENZ) != CYBER_BMSK_AUENZ_ENABLE ) {
@@ -795,7 +794,7 @@
 		cyber_outidx( CYBER_PORT_AUDIO, 0xb3, 0x06 );
 		cyber_outidx( CYBER_PORT_AUDIO, 0xbf, 0x00 );
 	}
-	restore_flags(flags);
+	spin_unlock_irqrestore(&card->lock, flags); 
 	return ret;
 }
 
@@ -3502,9 +3501,8 @@
 	unsigned long flags;
 	int i, j;
 
-	save_flags(flags); 
-	cli();
-	
+	spin_lock_irqsave(&card->lock, flags); 
+
 	ali_registers.global_regs[0x2c] = inl(TRID_REG(card,T4D_MISCINT));
 	//ali_registers.global_regs[0x20] = inl(TRID_REG(card,T4D_START_A));	
 	ali_registers.global_regs[0x21] = inl(TRID_REG(card,T4D_STOP_A));
@@ -3532,7 +3530,7 @@
 	//Stop all HW channel
 	outl(ALI_STOP_ALL_CHANNELS, TRID_REG(card, T4D_STOP_A));
 
-	restore_flags(flags);
+	spin_unlock_irqrestore(&card->lock, flags); 
 }
 
 static void ali_restore_regs(struct trident_card *card)
@@ -3540,8 +3538,7 @@
 	unsigned long flags;
 	int i, j;
 
-	save_flags(flags); 
-	cli();
+	spin_lock_irqsave(&card->lock, flags); 
 	
 	for (i = 1; i < ALI_MIXER_REGS; i++)
 		ali_ac97_write(card->ac97_codec[0], i*2, ali_registers.mixer_regs[i]);
@@ -3564,6 +3561,8 @@
 	outl(ali_registers.global_regs[0x20], TRID_REG(card,T4D_START_A));
 	//restore IRQ enable bits
 	outl(ali_registers.global_regs[0x2c], TRID_REG(card,T4D_MISCINT));
+
+	spin_unlock_irqrestore(&card->lock, flags); 
 	
 	restore_flags(flags);
 }

-- 
http://vipe.technion.ac.il/~mulix/
http://syscalltrack.sf.net/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] 2.5.29 sound/oss/trident.c [2/2] remove cli/sti calls
  2002-07-29  8:08 ` Zwane Mwaikambo
@ 2002-07-29  8:08   ` Muli Ben-Yehuda
  2002-07-29  8:56     ` Zwane Mwaikambo
  0 siblings, 1 reply; 4+ messages in thread
From: Muli Ben-Yehuda @ 2002-07-29  8:08 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Linus Torvalds, Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

On Mon, Jul 29, 2002 at 10:08:52AM +0200, Zwane Mwaikambo wrote:
> On Sun, 28 Jul 2002, Muli Ben-Yehuda wrote:
> 
> > +
> > +	spin_unlock_irqrestore(&card->lock, flags); 
> >  	
> >  	restore_flags(flags);
> >  }
> 
> hmm...

grrr, harmless I think, but thanks for spotting it. 

===== sound/oss/trident.c 1.25 vs 1.26 =====
--- 1.25/sound/oss/trident.c	Mon Jul 29 07:08:09 2002
+++ 1.26/sound/oss/trident.c	Mon Jul 29 10:59:59 2002
@@ -3563,8 +3563,6 @@
 	outl(ali_registers.global_regs[0x2c], TRID_REG(card,T4D_MISCINT));
 
 	spin_unlock_irqrestore(&card->lock, flags); 
-	
-	restore_flags(flags);
 }
 
 static int trident_suspend(struct pci_dev *dev, u32 unused)

-- 
http://vipe.technion.ac.il/~mulix/
http://syscalltrack.sf.net/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] 2.5.29 sound/oss/trident.c [2/2] remove cli/sti calls
  2002-07-28 20:22 [PATCH] 2.5.29 sound/oss/trident.c [2/2] remove cli/sti calls Muli Ben-Yehuda
@ 2002-07-29  8:08 ` Zwane Mwaikambo
  2002-07-29  8:08   ` Muli Ben-Yehuda
  0 siblings, 1 reply; 4+ messages in thread
From: Zwane Mwaikambo @ 2002-07-29  8:08 UTC (permalink / raw)
  To: Muli Ben-Yehuda; +Cc: Linus Torvalds, Linux-Kernel

On Sun, 28 Jul 2002, Muli Ben-Yehuda wrote:

> +
> +	spin_unlock_irqrestore(&card->lock, flags); 
>  	
>  	restore_flags(flags);
>  }

hmm...

-- 
function.linuxpower.ca



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

* Re: [PATCH] 2.5.29 sound/oss/trident.c [2/2] remove cli/sti calls
  2002-07-29  8:08   ` Muli Ben-Yehuda
@ 2002-07-29  8:56     ` Zwane Mwaikambo
  0 siblings, 0 replies; 4+ messages in thread
From: Zwane Mwaikambo @ 2002-07-29  8:56 UTC (permalink / raw)
  To: Muli Ben-Yehuda; +Cc: Linus Torvalds, Linux-Kernel

On Mon, 29 Jul 2002, Muli Ben-Yehuda wrote:

> On Mon, Jul 29, 2002 at 10:08:52AM +0200, Zwane Mwaikambo wrote:
> > On Sun, 28 Jul 2002, Muli Ben-Yehuda wrote:
> > 
> > > +
> > > +	spin_unlock_irqrestore(&card->lock, flags); 
> > >  	
> > >  	restore_flags(flags);
> > >  }
> > 
> > hmm...
> 
> grrr, harmless I think, but thanks for spotting it. 

But still racy, i think i may try a test run with some code to poison 
flags after its already been used to xxx_restore.

Cheers,
	Zwane

-- 
function.linuxpower.ca



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

end of thread, other threads:[~2002-07-29  8:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-28 20:22 [PATCH] 2.5.29 sound/oss/trident.c [2/2] remove cli/sti calls Muli Ben-Yehuda
2002-07-29  8:08 ` Zwane Mwaikambo
2002-07-29  8:08   ` Muli Ben-Yehuda
2002-07-29  8:56     ` Zwane Mwaikambo

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®