1840 return err;
1841}
1842
1843
1844
1845
1846static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime,
1847 struct snd_usb_substream *subs)
1848{
1849 struct audioformat *fp;
1850 int count = 0, needs_knot = 0;
1851 int err;
1852
1853 list_for_each_entry(fp, &subs->fmt_list, list) {
1854 if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS)
1855 return 0;
1856 count += fp->nr_rates;
1857 if (fp->rates & SNDRV_PCM_RATE_KNOT)
1858 needs_knot = 1;
1859 }
1860 if (!needs_knot)
1861 return 0;
1862
1863 subs->rate_list.count = count;
1864 subs->rate_list.list = kmalloc(sizeof(int) * count, GFP_KERNEL);
1865 subs->rate_list.mask = 0;
1866 count = 0;
1867 list_for_each_entry(fp, &subs->fmt_list, list) {
1868 int i;
1869 for (i = 0; i < fp->nr_rates; i++)
1870 subs->rate_list.list[count++] = fp->rate_table[i];
1871 }
1872 err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
1873 &subs->rate_list);
1874 if (err < 0)
1875 return err;
1876
1877 return 0;
1878}
1879
1880