diff options
-rw-r--r-- | sound/usb/usbaudio.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c69cc6e4f549..2b24496ddec7 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -107,7 +107,6 @@ MODULE_PARM_DESC(ignore_ctl_error, | |||
107 | #define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */ | 107 | #define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */ |
108 | #define MAX_URBS 8 | 108 | #define MAX_URBS 8 |
109 | #define SYNC_URBS 4 /* always four urbs for sync */ | 109 | #define SYNC_URBS 4 /* always four urbs for sync */ |
110 | #define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ | ||
111 | #define MAX_QUEUE 24 /* try not to exceed this queue length, in ms */ | 110 | #define MAX_QUEUE 24 /* try not to exceed this queue length, in ms */ |
112 | 111 | ||
113 | struct audioformat { | 112 | struct audioformat { |
@@ -1071,8 +1070,7 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri | |||
1071 | subs->packs_per_ms = packs_per_ms; | 1070 | subs->packs_per_ms = packs_per_ms; |
1072 | 1071 | ||
1073 | if (is_playback) { | 1072 | if (is_playback) { |
1074 | urb_packs = nrpacks; | 1073 | urb_packs = max(nrpacks, 1); |
1075 | urb_packs = max(urb_packs, (unsigned int)MIN_PACKS_URB); | ||
1076 | urb_packs = min(urb_packs, (unsigned int)MAX_PACKS); | 1074 | urb_packs = min(urb_packs, (unsigned int)MAX_PACKS); |
1077 | } else | 1075 | } else |
1078 | urb_packs = 1; | 1076 | urb_packs = 1; |
@@ -1093,9 +1091,9 @@ static int init_substream_urbs(struct snd_usb_substream *subs, unsigned int peri | |||
1093 | total_packs = (total_packs + packs_per_ms - 1) | 1091 | total_packs = (total_packs + packs_per_ms - 1) |
1094 | & ~(packs_per_ms - 1); | 1092 | & ~(packs_per_ms - 1); |
1095 | /* we need at least two URBs for queueing */ | 1093 | /* we need at least two URBs for queueing */ |
1096 | if (total_packs < 2 * MIN_PACKS_URB * packs_per_ms) | 1094 | if (total_packs < 2 * packs_per_ms) { |
1097 | total_packs = 2 * MIN_PACKS_URB * packs_per_ms; | 1095 | total_packs = 2 * packs_per_ms; |
1098 | else { | 1096 | } else { |
1099 | /* and we don't want too long a queue either */ | 1097 | /* and we don't want too long a queue either */ |
1100 | maxpacks = max((unsigned int)MAX_QUEUE, urb_packs * 2); | 1098 | maxpacks = max((unsigned int)MAX_QUEUE, urb_packs * 2); |
1101 | if (total_packs > maxpacks * packs_per_ms) | 1099 | if (total_packs > maxpacks * packs_per_ms) |
@@ -1909,7 +1907,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre | |||
1909 | * in the current code assume the 1ms period. | 1907 | * in the current code assume the 1ms period. |
1910 | */ | 1908 | */ |
1911 | snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, | 1909 | snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, |
1912 | 1000 * MIN_PACKS_URB, | 1910 | 1000, |
1913 | /*(nrpacks * MAX_URBS) * 1000*/ UINT_MAX); | 1911 | /*(nrpacks * MAX_URBS) * 1000*/ UINT_MAX); |
1914 | 1912 | ||
1915 | err = check_hw_params_convention(subs); | 1913 | err = check_hw_params_convention(subs); |
@@ -3753,7 +3751,7 @@ static int usb_audio_resume(struct usb_interface *intf) | |||
3753 | 3751 | ||
3754 | static int __init snd_usb_audio_init(void) | 3752 | static int __init snd_usb_audio_init(void) |
3755 | { | 3753 | { |
3756 | if (nrpacks < MIN_PACKS_URB || nrpacks > MAX_PACKS) { | 3754 | if (nrpacks < 1 || nrpacks > MAX_PACKS) { |
3757 | printk(KERN_WARNING "invalid nrpacks value.\n"); | 3755 | printk(KERN_WARNING "invalid nrpacks value.\n"); |
3758 | return -EINVAL; | 3756 | return -EINVAL; |
3759 | } | 3757 | } |