diff options
Diffstat (limited to 'sound/usb/pcm.c')
-rw-r--r-- | sound/usb/pcm.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index c263991b3b9d..652724c12235 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -94,13 +94,11 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream | |||
94 | */ | 94 | */ |
95 | static struct audioformat *find_format(struct snd_usb_substream *subs) | 95 | static struct audioformat *find_format(struct snd_usb_substream *subs) |
96 | { | 96 | { |
97 | struct list_head *p; | 97 | struct audioformat *fp; |
98 | struct audioformat *found = NULL; | 98 | struct audioformat *found = NULL; |
99 | int cur_attr = 0, attr; | 99 | int cur_attr = 0, attr; |
100 | 100 | ||
101 | list_for_each(p, &subs->fmt_list) { | 101 | list_for_each_entry(fp, &subs->fmt_list, list) { |
102 | struct audioformat *fp; | ||
103 | fp = list_entry(p, struct audioformat, list); | ||
104 | if (!(fp->formats & (1uLL << subs->pcm_format))) | 102 | if (!(fp->formats & (1uLL << subs->pcm_format))) |
105 | continue; | 103 | continue; |
106 | if (fp->channels != subs->channels) | 104 | if (fp->channels != subs->channels) |
@@ -809,7 +807,7 @@ static int hw_rule_rate(struct snd_pcm_hw_params *params, | |||
809 | struct snd_pcm_hw_rule *rule) | 807 | struct snd_pcm_hw_rule *rule) |
810 | { | 808 | { |
811 | struct snd_usb_substream *subs = rule->private; | 809 | struct snd_usb_substream *subs = rule->private; |
812 | struct list_head *p; | 810 | struct audioformat *fp; |
813 | struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); | 811 | struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); |
814 | unsigned int rmin, rmax; | 812 | unsigned int rmin, rmax; |
815 | int changed; | 813 | int changed; |
@@ -817,9 +815,7 @@ static int hw_rule_rate(struct snd_pcm_hw_params *params, | |||
817 | hwc_debug("hw_rule_rate: (%d,%d)\n", it->min, it->max); | 815 | hwc_debug("hw_rule_rate: (%d,%d)\n", it->min, it->max); |
818 | changed = 0; | 816 | changed = 0; |
819 | rmin = rmax = 0; | 817 | rmin = rmax = 0; |
820 | list_for_each(p, &subs->fmt_list) { | 818 | list_for_each_entry(fp, &subs->fmt_list, list) { |
821 | struct audioformat *fp; | ||
822 | fp = list_entry(p, struct audioformat, list); | ||
823 | if (!hw_check_valid_format(subs, params, fp)) | 819 | if (!hw_check_valid_format(subs, params, fp)) |
824 | continue; | 820 | continue; |
825 | if (changed++) { | 821 | if (changed++) { |
@@ -863,7 +859,7 @@ static int hw_rule_channels(struct snd_pcm_hw_params *params, | |||
863 | struct snd_pcm_hw_rule *rule) | 859 | struct snd_pcm_hw_rule *rule) |
864 | { | 860 | { |
865 | struct snd_usb_substream *subs = rule->private; | 861 | struct snd_usb_substream *subs = rule->private; |
866 | struct list_head *p; | 862 | struct audioformat *fp; |
867 | struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); | 863 | struct snd_interval *it = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); |
868 | unsigned int rmin, rmax; | 864 | unsigned int rmin, rmax; |
869 | int changed; | 865 | int changed; |
@@ -871,9 +867,7 @@ static int hw_rule_channels(struct snd_pcm_hw_params *params, | |||
871 | hwc_debug("hw_rule_channels: (%d,%d)\n", it->min, it->max); | 867 | hwc_debug("hw_rule_channels: (%d,%d)\n", it->min, it->max); |
872 | changed = 0; | 868 | changed = 0; |
873 | rmin = rmax = 0; | 869 | rmin = rmax = 0; |
874 | list_for_each(p, &subs->fmt_list) { | 870 | list_for_each_entry(fp, &subs->fmt_list, list) { |
875 | struct audioformat *fp; | ||
876 | fp = list_entry(p, struct audioformat, list); | ||
877 | if (!hw_check_valid_format(subs, params, fp)) | 871 | if (!hw_check_valid_format(subs, params, fp)) |
878 | continue; | 872 | continue; |
879 | if (changed++) { | 873 | if (changed++) { |
@@ -916,7 +910,7 @@ static int hw_rule_format(struct snd_pcm_hw_params *params, | |||
916 | struct snd_pcm_hw_rule *rule) | 910 | struct snd_pcm_hw_rule *rule) |
917 | { | 911 | { |
918 | struct snd_usb_substream *subs = rule->private; | 912 | struct snd_usb_substream *subs = rule->private; |
919 | struct list_head *p; | 913 | struct audioformat *fp; |
920 | struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); | 914 | struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); |
921 | u64 fbits; | 915 | u64 fbits; |
922 | u32 oldbits[2]; | 916 | u32 oldbits[2]; |
@@ -924,9 +918,7 @@ static int hw_rule_format(struct snd_pcm_hw_params *params, | |||
924 | 918 | ||
925 | hwc_debug("hw_rule_format: %x:%x\n", fmt->bits[0], fmt->bits[1]); | 919 | hwc_debug("hw_rule_format: %x:%x\n", fmt->bits[0], fmt->bits[1]); |
926 | fbits = 0; | 920 | fbits = 0; |
927 | list_for_each(p, &subs->fmt_list) { | 921 | list_for_each_entry(fp, &subs->fmt_list, list) { |
928 | struct audioformat *fp; | ||
929 | fp = list_entry(p, struct audioformat, list); | ||
930 | if (!hw_check_valid_format(subs, params, fp)) | 922 | if (!hw_check_valid_format(subs, params, fp)) |
931 | continue; | 923 | continue; |
932 | fbits |= fp->formats; | 924 | fbits |= fp->formats; |
@@ -1034,7 +1026,7 @@ static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime, | |||
1034 | 1026 | ||
1035 | static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substream *subs) | 1027 | static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substream *subs) |
1036 | { | 1028 | { |
1037 | struct list_head *p; | 1029 | struct audioformat *fp; |
1038 | unsigned int pt, ptmin; | 1030 | unsigned int pt, ptmin; |
1039 | int param_period_time_if_needed; | 1031 | int param_period_time_if_needed; |
1040 | int err; | 1032 | int err; |
@@ -1048,9 +1040,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre | |||
1048 | runtime->hw.rates = 0; | 1040 | runtime->hw.rates = 0; |
1049 | ptmin = UINT_MAX; | 1041 | ptmin = UINT_MAX; |
1050 | /* check min/max rates and channels */ | 1042 | /* check min/max rates and channels */ |
1051 | list_for_each(p, &subs->fmt_list) { | 1043 | list_for_each_entry(fp, &subs->fmt_list, list) { |
1052 | struct audioformat *fp; | ||
1053 | fp = list_entry(p, struct audioformat, list); | ||
1054 | runtime->hw.rates |= fp->rates; | 1044 | runtime->hw.rates |= fp->rates; |
1055 | if (runtime->hw.rate_min > fp->rate_min) | 1045 | if (runtime->hw.rate_min > fp->rate_min) |
1056 | runtime->hw.rate_min = fp->rate_min; | 1046 | runtime->hw.rate_min = fp->rate_min; |