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>
Šī revīzija ir iekļauta:
Takashi Iwai
2018-05-03 12:33:32 +02:00
vecāks 207459a280
revīzija 8c558076c7
4 mainīti faili ar 18 papildinājumiem un 16 dzēšanām

Parādīt failu

@@ -53,6 +53,12 @@ struct usb_mixer_elem_list {
usb_mixer_elem_resume_func_t resume;
};
/* iterate over mixer element list of the given unit id */
#define for_each_mixer_elem(list, mixer, id) \
for ((list) = (mixer)->id_elems[id]; (list); (list) = (list)->next_id_elem)
#define mixer_elem_list_to_info(list) \
container_of(list, struct usb_mixer_elem_info, head)
struct usb_mixer_elem_info {
struct usb_mixer_elem_list head;
unsigned int control; /* CS or ICN (high byte) */