[PATCH] usb audio.

From: David Woodhouse (dwmw2@infradead.org)
Date: Thu Oct 12 2000 - 19:07:52 EST


On Thu, 12 Oct 2000, David Woodhouse wrote:

> > * USB: system hang with USB audio driver {CRITICAL} (David
> > Woodhouse, Randy Dunlap, Narayan Desai)
>
> That fixes failure mode #1, in which the NMI watchdog gets triggered and
> all subsequent attempts to open /dev/audio just block.
>
> Unfortunately, it doesn't affect failure mode #2, in which the machine
> just dies completely.

OK. This patch fixes failure mode #2 too - and lets it make noise without
locking up the machine. By including the extra lines which Randy Dunlap
sent me, it even makes the _right_ noise.

My only remaining problem is that I've just woken She Who Must Be Obeyed
by playing Terrorvision very loudly at 1 am.

Index: drivers/usb/audio.c
===================================================================
RCS file: /net/passion/inst/cvs/linux/drivers/usb/audio.c,v
retrieving revision 1.1.2.31
diff -u -r1.1.2.31 audio.c
--- drivers/usb/audio.c 2000/09/07 08:26:12 1.1.2.31
+++ drivers/usb/audio.c 2000/10/13 00:06:04
@@ -879,6 +879,7 @@
                 mask = 0;
                 printk(KERN_ERR "usbin_completed: panic: unknown URB\n");
         }
+ urb->dev = as->state->usbdev;
         spin_lock_irqsave(&as->lock, flags);
         if (!usbin_retire_desc(u, urb) &&
             u->flags & FLG_RUNNING &&
@@ -943,6 +944,7 @@
                 mask = 0;
                 printk(KERN_ERR "usbin_sync_completed: panic: unknown URB\n");
         }
+ urb->dev = as->state->usbdev;
         spin_lock_irqsave(&as->lock, flags);
         if (!usbin_sync_retire_desc(u, urb) &&
             u->flags & FLG_RUNNING &&
@@ -1007,8 +1009,10 @@
                 }
                 spin_lock_irqsave(&as->lock, flags);
         }
- if (u->dma.count >= u->dma.dmasize && !u->dma.mapped)
+ if (u->dma.count >= u->dma.dmasize && !u->dma.mapped) {
+ spin_unlock_irqrestore(&as->lock, flags);
                 return 0;
+ }
         u->flags |= FLG_RUNNING;
         if (!(u->flags & FLG_URB0RUNNING)) {
                 urb = &u->durb[0].urb;
@@ -1233,6 +1237,7 @@
                 mask = 0;
                 printk(KERN_ERR "usbout_completed: panic: unknown URB\n");
         }
+ urb->dev = as->state->usbdev;
         spin_lock_irqsave(&as->lock, flags);
         if (!usbout_retire_desc(u, urb) &&
             u->flags & FLG_RUNNING &&
@@ -1304,6 +1309,7 @@
                 mask = 0;
                 printk(KERN_ERR "usbout_sync_completed: panic: unknown URB\n");
         }
+ urb->dev = as->state->usbdev;
         spin_lock_irqsave(&as->lock, flags);
         if (!usbout_sync_retire_desc(u, urb) &&
             u->flags & FLG_RUNNING &&
@@ -1368,8 +1374,10 @@
                 }
                 spin_lock_irqsave(&as->lock, flags);
         }
- if (u->dma.count <= 0 && !u->dma.mapped)
+ if (u->dma.count <= 0 && !u->dma.mapped) {
+ spin_unlock_irqrestore(&as->lock, flags);
                 return 0;
+ }
                u->flags |= FLG_RUNNING;
         if (!(u->flags & FLG_URB0RUNNING)) {
                 urb = &u->durb[0].urb;
@@ -2768,6 +2776,14 @@
         init_waitqueue_head(&as->usbin.dma.wait);
         init_waitqueue_head(&as->usbout.dma.wait);
         spin_lock_init(&as->lock);
+ spin_lock_init(&as->usbin.durb[0].urb.lock);
+ spin_lock_init(&as->usbin.durb[1].urb.lock);
+ spin_lock_init(&as->usbin.surb[0].urb.lock);
+ spin_lock_init(&as->usbin.surb[1].urb.lock);
+ spin_lock_init(&as->usbout.durb[0].urb.lock);
+ spin_lock_init(&as->usbout.durb[1].urb.lock);
+ spin_lock_init(&as->usbout.surb[0].urb.lock);
+ spin_lock_init(&as->usbout.surb[1].urb.lock);
         as->state = s;
         as->usbin.interface = asifin;
         as->usbout.interface = asifout;

-- 
dwmw2

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:24 EST