]> nv-tegra.nvidia Code Review - linux-3.10.git/blobdiff - sound/oss/midibuf.c
pci: hda: Limit sleep time when codec is off
[linux-3.10.git] / sound / oss / midibuf.c
index a40be0cf1d97f42bf6a180312afbc10b15c7a5bc..8cdb2cfe65c841a7f942a25fde54b9d04e0d3ea6 100644 (file)
@@ -127,15 +127,16 @@ static void midi_poll(unsigned long dummy)
                for (dev = 0; dev < num_midis; dev++)
                        if (midi_devs[dev] != NULL && midi_out_buf[dev] != NULL)
                        {
-                               int ok = 1;
-
-                               while (DATA_AVAIL(midi_out_buf[dev]) && ok)
+                               while (DATA_AVAIL(midi_out_buf[dev]))
                                {
+                                       int ok;
                                        int c = midi_out_buf[dev]->queue[midi_out_buf[dev]->head];
 
                                        spin_unlock_irqrestore(&lock,flags);/* Give some time to others */
                                        ok = midi_devs[dev]->outputc(dev, c);
                                        spin_lock_irqsave(&lock, flags);
+                                       if (!ok)
+                                               break;
                                        midi_out_buf[dev]->head = (midi_out_buf[dev]->head + 1) % MAX_QUEUE_SIZE;
                                        midi_out_buf[dev]->len--;
                                }
@@ -177,7 +178,7 @@ int MIDIbuf_open(int dev, struct file *file)
                return err;
 
        parms[dev].prech_timeout = MAX_SCHEDULE_TIMEOUT;
-       midi_in_buf[dev] = (struct midi_buf *) vmalloc(sizeof(struct midi_buf));
+       midi_in_buf[dev] = vmalloc(sizeof(struct midi_buf));
 
        if (midi_in_buf[dev] == NULL)
        {
@@ -187,7 +188,7 @@ int MIDIbuf_open(int dev, struct file *file)
        }
        midi_in_buf[dev]->len = midi_in_buf[dev]->head = midi_in_buf[dev]->tail = 0;
 
-       midi_out_buf[dev] = (struct midi_buf *) vmalloc(sizeof(struct midi_buf));
+       midi_out_buf[dev] = vmalloc(sizeof(struct midi_buf));
 
        if (midi_out_buf[dev] == NULL)
        {
@@ -294,7 +295,7 @@ int MIDIbuf_write(int dev, struct file *file, const char __user *buf, int count)
 
                for (i = 0; i < n; i++)
                {
-                       /* BROKE BROKE BROKE - CANT DO THIS WITH CLI !! */
+                       /* BROKE BROKE BROKE - CAN'T DO THIS WITH CLI !! */
                        /* yes, think the same, so I removed the cli() brackets 
                                QUEUE_BYTE is protected against interrupts */
                        if (copy_from_user((char *) &tmp_data, &(buf)[c], 1)) {