aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorEldad Zack <eldad@fogrefinery.com>2013-04-22 19:00:41 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-29 07:36:15 -0400
commit74c34ca1cc12884703c70d34ed333517d978c2e7 (patch)
tree6d06b76a9fbe829f2427899aa708d682167420c0 /sound/usb
parent754813473c1a8b7711802313125f0fafc60141f8 (diff)
ALSA: pcm_format_to_bits strong-typed conversion
Add a function to handle conversion from snd_pcm_format_t to bitwise with proper typing. Change such conversions to use this function and silence sparse warnings. Signed-off-by: Eldad Zack <eldad@fogrefinery.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/format.c5
-rw-r--r--sound/usb/pcm.c4
-rw-r--r--sound/usb/proc.c2
3 files changed, 6 insertions, 5 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 020ede0259eb..99299ffb33ac 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -365,7 +365,8 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
365{ 365{
366 struct usb_interface_descriptor *altsd = get_iface_desc(iface); 366 struct usb_interface_descriptor *altsd = get_iface_desc(iface);
367 int protocol = altsd->bInterfaceProtocol; 367 int protocol = altsd->bInterfaceProtocol;
368 int pcm_format, ret; 368 snd_pcm_format_t pcm_format;
369 int ret;
369 370
370 if (fmt->bFormatType == UAC_FORMAT_TYPE_III) { 371 if (fmt->bFormatType == UAC_FORMAT_TYPE_III) {
371 /* FIXME: the format type is really IECxxx 372 /* FIXME: the format type is really IECxxx
@@ -384,7 +385,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
384 default: 385 default:
385 pcm_format = SNDRV_PCM_FORMAT_S16_LE; 386 pcm_format = SNDRV_PCM_FORMAT_S16_LE;
386 } 387 }
387 fp->formats = 1uLL << pcm_format; 388 fp->formats = pcm_format_to_bits(pcm_format);
388 } else { 389 } else {
389 fp->formats = parse_audio_format_i_type(chip, fp, format, 390 fp->formats = parse_audio_format_i_type(chip, fp, format,
390 fmt, protocol); 391 fmt, protocol);
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 9723f3ceb155..93b6e32cfead 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -100,7 +100,7 @@ static struct audioformat *find_format(struct snd_usb_substream *subs)
100 int cur_attr = 0, attr; 100 int cur_attr = 0, attr;
101 101
102 list_for_each_entry(fp, &subs->fmt_list, list) { 102 list_for_each_entry(fp, &subs->fmt_list, list) {
103 if (!(fp->formats & (1uLL << subs->pcm_format))) 103 if (!(fp->formats & pcm_format_to_bits(subs->pcm_format)))
104 continue; 104 continue;
105 if (fp->channels != subs->channels) 105 if (fp->channels != subs->channels)
106 continue; 106 continue;
@@ -478,7 +478,7 @@ static int match_endpoint_audioformats(struct audioformat *fp,
478 return 0; 478 return 0;
479 } 479 }
480 480
481 if (!(fp->formats & (1ULL << pcm_format))) { 481 if (!(fp->formats & pcm_format_to_bits(pcm_format))) {
482 snd_printdd("%s: (fmt @%p) no match for format %d\n", __func__, 482 snd_printdd("%s: (fmt @%p) no match for format %d\n", __func__,
483 fp, pcm_format); 483 fp, pcm_format);
484 return 0; 484 return 0;
diff --git a/sound/usb/proc.c b/sound/usb/proc.c
index 0182ef634d8b..135c76871063 100644
--- a/sound/usb/proc.c
+++ b/sound/usb/proc.c
@@ -85,7 +85,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s
85 snd_iprintf(buffer, " Altset %d\n", fp->altsetting); 85 snd_iprintf(buffer, " Altset %d\n", fp->altsetting);
86 snd_iprintf(buffer, " Format:"); 86 snd_iprintf(buffer, " Format:");
87 for (fmt = 0; fmt <= SNDRV_PCM_FORMAT_LAST; ++fmt) 87 for (fmt = 0; fmt <= SNDRV_PCM_FORMAT_LAST; ++fmt)
88 if (fp->formats & (1uLL << fmt)) 88 if (fp->formats & pcm_format_to_bits(fmt))
89 snd_iprintf(buffer, " %s", 89 snd_iprintf(buffer, " %s",
90 snd_pcm_format_name(fmt)); 90 snd_pcm_format_name(fmt));
91 snd_iprintf(buffer, "\n"); 91 snd_iprintf(buffer, "\n");