Commit 6d3d01de authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

PATCH: audio driver urb allocation

  
This fixes a bug in the audio driver which came from an
incorrect conversion from static to dynamic URB allocation.
It's against 2.5.5
  
I noticed this while trying to see exactly how ISO transfers
get used.  The bug is that while originally the driver statically
allocated several structures {urb + N * iso packet descriptors},
the update forgot to allocate the ISO descriptors.
    
Likely not many folk noticed this on 32 bit machines, where
sizeof urb == 92, because kmalloc rounds that up to 128,
adding 36 bytes of external padding.  The ISO descriptors
took up 32 bytes of that, which "just happened" to already
have been allocated but unused.
parent d4f03d86
...@@ -124,9 +124,7 @@ ...@@ -124,9 +124,7 @@
* conversions. We never do sample rate conversion; these are too * conversions. We never do sample rate conversion; these are too
* expensive to be performed in the kernel. * expensive to be performed in the kernel.
* *
* Current status: * Current status: no known HCD-specific issues.
* - Pretty stable on UHCI-Acher/Fliegl/Sailer
* - Does not work on OHCI due to lack of OHCI driver supporting URB's
* *
* Generally: Due to the brokenness of the Audio Class spec * Generally: Due to the brokenness of the Audio Class spec
* it seems generally impossible to write a generic Audio Class driver, * it seems generally impossible to write a generic Audio Class driver,
...@@ -298,12 +296,10 @@ struct usb_audio_state; ...@@ -298,12 +296,10 @@ struct usb_audio_state;
struct my_data_urb { struct my_data_urb {
struct urb *urb; struct urb *urb;
struct usb_iso_packet_descriptor isoframe[DESCFRAMES];
}; };
struct my_sync_urb { struct my_sync_urb {
struct urb *urb; struct urb *urb;
struct usb_iso_packet_descriptor isoframe[SYNCFRAMES];
}; };
...@@ -2829,14 +2825,14 @@ static void usb_audio_parsestreaming(struct usb_audio_state *s, unsigned char *b ...@@ -2829,14 +2825,14 @@ static void usb_audio_parsestreaming(struct usb_audio_state *s, unsigned char *b
init_waitqueue_head(&as->usbin.dma.wait); init_waitqueue_head(&as->usbin.dma.wait);
init_waitqueue_head(&as->usbout.dma.wait); init_waitqueue_head(&as->usbout.dma.wait);
spin_lock_init(&as->lock); spin_lock_init(&as->lock);
as->usbin.durb[0].urb = usb_alloc_urb(0, GFP_KERNEL); as->usbin.durb[0].urb = usb_alloc_urb (DESCFRAMES, GFP_KERNEL);
as->usbin.durb[1].urb = usb_alloc_urb(0, GFP_KERNEL); as->usbin.durb[1].urb = usb_alloc_urb (DESCFRAMES, GFP_KERNEL);
as->usbin.surb[0].urb = usb_alloc_urb(0, GFP_KERNEL); as->usbin.surb[0].urb = usb_alloc_urb (SYNCFRAMES, GFP_KERNEL);
as->usbin.surb[1].urb = usb_alloc_urb(0, GFP_KERNEL); as->usbin.surb[1].urb = usb_alloc_urb (SYNCFRAMES, GFP_KERNEL);
as->usbout.durb[0].urb = usb_alloc_urb(0, GFP_KERNEL); as->usbout.durb[0].urb = usb_alloc_urb (DESCFRAMES, GFP_KERNEL);
as->usbout.durb[1].urb = usb_alloc_urb(0, GFP_KERNEL); as->usbout.durb[1].urb = usb_alloc_urb (DESCFRAMES, GFP_KERNEL);
as->usbout.surb[0].urb = usb_alloc_urb(0, GFP_KERNEL); as->usbout.surb[0].urb = usb_alloc_urb (SYNCFRAMES, GFP_KERNEL);
as->usbout.surb[1].urb = usb_alloc_urb(0, GFP_KERNEL); as->usbout.surb[1].urb = usb_alloc_urb (SYNCFRAMES, GFP_KERNEL);
if ((!as->usbin.durb[0].urb) || if ((!as->usbin.durb[0].urb) ||
(!as->usbin.durb[1].urb) || (!as->usbin.durb[1].urb) ||
(!as->usbin.surb[0].urb) || (!as->usbin.surb[0].urb) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment