sound: usb-audio: fix queue length check for high speed devices

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:19 pm

Gitweb:     http://git.kernel.org/linus/b1c86bb807448701400abc6eb8e958475ab5424b
Commit:     b1c86bb807448701400abc6eb8e958475ab5424b
Parent:     eab2b553c3d3ed20698c4a9c7e049a60b804e2f5
Author:     Clemens Ladisch <clemens@ladisch.de>
AuthorDate: Mon Mar 2 12:06:28 2009 +0100
Committer:  Takashi Iwai <tiwai@suse.de>
CommitDate: Mon Mar 2 14:50:01 2009 +0100

    sound: usb-audio: fix queue length check for high speed devices
    
    When checking for the maximum queue length, we have to take into account
    that MAX_QUEUE is measured in milliseconds (i.e., frames) while the unit
    of urb_packs is whatever data packet interval the device uses (possibly
    less than one frame when using high speed devices).
    
    Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/usbaudio.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index f853b62..defe991 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -1095,9 +1095,8 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri
 			total_packs = 2 * packs_per_ms;
 		} else {
 			/* and we don't want too long a queue either */
-			maxpacks = max((unsigned int)MAX_QUEUE, urb_packs * 2);
-			if (total_packs > maxpacks * packs_per_ms)
-				total_packs = maxpacks * packs_per_ms;
+			maxpacks = max(MAX_QUEUE * packs_per_ms, urb_packs * 2);
+			total_packs = min(total_packs, maxpacks);
 		}
 	} else {
 		total_packs = MAX_URBS * urb_packs;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
sound: usb-audio: fix queue length check for high speed de ..., Linux Kernel Mailing ..., (Thu Mar 26, 12:19 pm)