summaryrefslogtreecommitdiff
path: root/sound/usb/mixer_scarlett.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-05-03 12:33:32 +0200
committerTakashi Iwai <tiwai@suse.de>2018-05-03 12:35:19 +0200
commit8c558076c740e8009a96c6fdc3d4245dde62be77 (patch)
tree361e87f1a346bff4a243a2538fb109665978317b /sound/usb/mixer_scarlett.c
parent207459a2804a64d0f0f05c8aba04e0b0844661f2 (diff)
ALSA: usb-audio: Clean up mixer element list traverse
Introduce a new macro for iterating over mixer element list for avoiding the open codes in many places. Also the open-coded container_of() and the forced cast to struct usb_mixer_elem_info are replaced with another simple macro, too. No functional changes but just readability improvement. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/mixer_scarlett.c')
-rw-r--r--sound/usb/mixer_scarlett.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index c33e2378089d..4aeb9488a0c9 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -287,8 +287,7 @@ static int scarlett_ctl_switch_put(struct snd_kcontrol *kctl,
static int scarlett_ctl_resume(struct usb_mixer_elem_list *list)
{
- struct usb_mixer_elem_info *elem =
- container_of(list, struct usb_mixer_elem_info, head);
+ struct usb_mixer_elem_info *elem = mixer_elem_list_to_info(list);
int i;
for (i = 0; i < elem->channels; i++)
@@ -447,8 +446,7 @@ static int scarlett_ctl_enum_put(struct snd_kcontrol *kctl,
static int scarlett_ctl_enum_resume(struct usb_mixer_elem_list *list)
{
- struct usb_mixer_elem_info *elem =
- container_of(list, struct usb_mixer_elem_info, head);
+ struct usb_mixer_elem_info *elem = mixer_elem_list_to_info(list);
if (elem->cached)
snd_usb_set_cur_mix_value(elem, 0, 0, *elem->cache_val);