Update of /cvsroot/alsa/alsa-kernel/isa/cs423x
In directory sc8-pr-cvs1:/tmp/cvs-serv716/isa/cs423x

Modified Files:
        cs4231_lib.c 
Log Message:
[PATCH: cs423x-spinlock-fix.dif]

- fixed (and removed unnecessary) spinlocks.



Index: cs4231_lib.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/isa/cs423x/cs4231_lib.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- cs4231_lib.c        10 Dec 2002 15:20:18 -0000      1.23
+++ cs4231_lib.c        7 Jan 2003 10:19:15 -0000       1.24
@@ -338,13 +338,13 @@
        unsigned long flags;
        int timeout;
 
-       spin_lock_irqsave(&chip->reg_lock, flags);
        for (timeout = 250; timeout > 0 && (cs4231_inb(chip, CS4231P(REGSEL)) & 
CS4231_INIT); timeout--)
                udelay(100);
 #ifdef CONFIG_SND_DEBUG
        if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT)
                snd_printk("mce_up - auto calibration time out (0)\n");
 #endif
+       spin_lock_irqsave(&chip->reg_lock, flags);
        chip->mce_bit |= CS4231_MCE;
        timeout = cs4231_inb(chip, CS4231P(REGSEL));
        if (timeout == 0x80)
@@ -360,7 +360,6 @@
        int timeout;
        signed long time;
 
-       spin_lock_irqsave(&chip->reg_lock, flags);
        snd_cs4231_busy_wait(chip);
 #if 0
        printk("(1) timeout = %i\n", timeout);
@@ -369,14 +368,15 @@
        if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT)
                snd_printk("mce_down [0x%lx] - auto calibration time out (0)\n", 
(long)CS4231P(REGSEL));
 #endif
+       spin_lock_irqsave(&chip->reg_lock, flags);
        chip->mce_bit &= ~CS4231_MCE;
        timeout = cs4231_inb(chip, CS4231P(REGSEL));
        cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f));
+       spin_unlock_irqrestore(&chip->reg_lock, flags);
        if (timeout == 0x80)
                snd_printk("mce_down [0x%lx]: serious init problem - codec still 
busy\n", chip->port);
        if ((timeout & CS4231_MCE) == 0 ||
            !(chip->hardware & (CS4231_HW_CS4231_MASK | CS4231_HW_CS4232_MASK))) {
-               spin_unlock_irqrestore(&chip->reg_lock, flags);
                return;
        }
        snd_cs4231_busy_wait(chip);
@@ -387,7 +387,6 @@
                udelay(10);
        if ((snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) == 0) {
                snd_printd("cs4231_mce_down - auto calibration time out (1)\n");
-               spin_unlock_irqrestore(&chip->reg_lock, flags);
                return;
        }
 #if 0
@@ -395,30 +394,25 @@
 #endif
        time = HZ / 4;
        while (snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) {
-               spin_unlock_irqrestore(&chip->reg_lock, flags);
                if (time <= 0) {
                        snd_printk("mce_down - auto calibration time out (2)\n");
                        return;
                }
                set_current_state(TASK_INTERRUPTIBLE);
                time = schedule_timeout(time);
-               spin_lock_irqsave(&chip->reg_lock, flags);
        }
 #if 0
        printk("(3) jiffies = %li\n", jiffies);
 #endif
        time = HZ / 10;
        while (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) {
-               spin_unlock_irqrestore(&chip->reg_lock, flags);
                if (time <= 0) {
-                       snd_printk("mce_down - auto calibration time out (3)\n");
+                       snd_printk(KERN_ERR "mce_down - auto calibration time out 
+(3)\n");
                        return;
                }
                set_current_state(TASK_INTERRUPTIBLE);          
                time = schedule_timeout(time);
-               spin_lock_irqsave(&chip->reg_lock, flags);
        }
-       spin_unlock_irqrestore(&chip->reg_lock, flags);
 #if 0
        printk("(4) jiffies = %li\n", jiffies);
        snd_printk("mce_down - exit = 0x%x\n", cs4231_inb(chip, CS4231P(REGSEL)));
@@ -1375,20 +1369,19 @@
           This is the first half of copy of snd_cs4231_mce_down(), but doesn't
           include rescheduling.  -- iwai
           */
-       spin_lock_irqsave(&chip->reg_lock, flags);
        snd_cs4231_busy_wait(chip);
+       spin_lock_irqsave(&chip->reg_lock, flags);
        chip->mce_bit &= ~CS4231_MCE;
        timeout = cs4231_inb(chip, CS4231P(REGSEL));
        cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f));
+       spin_unlock_irqrestore(&chip->reg_lock, flags);
        if (timeout == 0x80)
                snd_printk("down [0x%lx]: serious init problem - codec still busy\n", 
chip->port);
        if ((timeout & CS4231_MCE) == 0 ||
            !(chip->hardware & (CS4231_HW_CS4231_MASK | CS4231_HW_CS4232_MASK))) {
-               spin_unlock_irqrestore(&chip->reg_lock, flags);
                return;
        }
        snd_cs4231_busy_wait(chip);
-       spin_unlock_irqrestore(&chip->reg_lock, flags);
 #endif
 }
 



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to