diff options
author | Takashi Iwai <tiwai@suse.de> | 2024-07-15 14:36:45 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2024-07-15 16:06:22 +0200 |
commit | e54dc34318f62bdeea7edefed386d47fae155618 (patch) | |
tree | 961caba3f7594aae33bb7f3ea80d58b1c3d902e0 /sound/usb/format.c | |
parent | 2f38cf730caedaeacdefb7ff35b0a3c1168117f9 (diff) |
ALSA: usb: Use BIT() for bit values
Instead of the explicit "1 << x", use BIT() macro for one bit values.
This will improve the readability and also avoids the possible bad
value for 31bit shift.
Link: https://patch.msgid.link/20240715123646.26679-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/format.c')
-rw-r--r-- | sound/usb/format.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c index 3b45d0ee7693..1bb6a455a1b4 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -82,13 +82,13 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, fp->fmt_bits = sample_width; if ((pcm_formats == 0) && - (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { + (format == 0 || format == BIT(UAC_FORMAT_TYPE_I_UNDEFINED))) { /* some devices don't define this correctly... */ usb_audio_info(chip, "%u:%d : format type 0 is detected, processed as PCM\n", fp->iface, fp->altsetting); - format = 1 << UAC_FORMAT_TYPE_I_PCM; + format = BIT(UAC_FORMAT_TYPE_I_PCM); } - if (format & (1 << UAC_FORMAT_TYPE_I_PCM)) { + if (format & BIT(UAC_FORMAT_TYPE_I_PCM)) { if (((chip->usb_id == USB_ID(0x0582, 0x0016)) || /* Edirol SD-90 */ (chip->usb_id == USB_ID(0x0582, 0x000c))) && @@ -128,7 +128,7 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, break; } } - if (format & (1 << UAC_FORMAT_TYPE_I_PCM8)) { + if (format & BIT(UAC_FORMAT_TYPE_I_PCM8)) { /* Dallas DS4201 workaround: it advertises U8 format, but really supports S8. */ if (chip->usb_id == USB_ID(0x04fa, 0x4201)) @@ -136,15 +136,12 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, else pcm_formats |= SNDRV_PCM_FMTBIT_U8; } - if (format & (1 << UAC_FORMAT_TYPE_I_IEEE_FLOAT)) { + if (format & BIT(UAC_FORMAT_TYPE_I_IEEE_FLOAT)) pcm_formats |= SNDRV_PCM_FMTBIT_FLOAT_LE; - } - if (format & (1 << UAC_FORMAT_TYPE_I_ALAW)) { + if (format & BIT(UAC_FORMAT_TYPE_I_ALAW)) pcm_formats |= SNDRV_PCM_FMTBIT_A_LAW; - } - if (format & (1 << UAC_FORMAT_TYPE_I_MULAW)) { + if (format & BIT(UAC_FORMAT_TYPE_I_MULAW)) pcm_formats |= SNDRV_PCM_FMTBIT_MU_LAW; - } if (format & ~0x3f) { usb_audio_info(chip, "%u:%d : unsupported format bits %#llx\n", |