Update of /cvsroot/alsa/alsa-driver/isa
In directory sc8-pr-cvs1:/tmp/cvs-serv21180

Modified Files:
        sscape.c 
Log Message:
removed spinlocks during copy_from_user().



Index: sscape.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/isa/sscape.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- sscape.c    23 Oct 2002 09:57:09 -0000      1.11
+++ sscape.c    8 Jan 2003 10:54:23 -0000       1.12
@@ -497,16 +497,31 @@
         * board through the DMA channel ...
         */
        while (size != 0) {
-               unsigned long len = min(size, dma.size);
+               unsigned long len;
+
+               /*
+                * Apparently, copying to/from userspace can sleep.
+                * We are therefore forbidden from holding any
+                * spinlocks while we copy ...
+                */
+               spin_unlock_irqrestore(&s->lock, flags);
 
                /*
                 * Remember that the data that we want to DMA
                 * comes from USERSPACE. We have already verified
                 * the userspace pointer ...
                 */
+               len = min(size, dma.size);
                __copy_from_user(dma.data, data, len);
                data += len;
                size -= len;
+
+               /*
+                * Grab that spinlock again, now that we've
+                * finished copying!
+                */
+               spin_lock_irqsave(&s->lock, flags);
+
                snd_dma_program(s->chip->dma1, dma.addr, len, DMA_MODE_WRITE);
                sscape_start_dma_unsafe(s->io_base, GA_DMAA_REG);
                if (!sscape_wait_dma_unsafe(s->io_base, GA_DMAA_REG, 5000)) {
@@ -707,7 +722,7 @@
        default:
                err = -EINVAL;
                break;
-       }                       /* switch */
+       } /* switch */
 
        return err;
 }



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