ALSA: control: Simplify snd_ctl_elem_list() implementation
authorTakashi Iwai <[email protected]>
Mon, 22 May 2017 15:43:04 +0000 (17:43 +0200)
committerTakashi Iwai <[email protected]>
Tue, 23 May 2017 05:03:55 +0000 (07:03 +0200)
commit53e7bf452584e73df8a529a2b157a1225a52637f
tree697697b2c5ccd436f4c801458025a21c757c6b43
parenta02cb8f8def634159b60c3a4d6ba16e471b46e0c
ALSA: control: Simplify snd_ctl_elem_list() implementation

This patch simplifies the code of snd_ctl_elem_list() in the following
ways:

- Avoid a vmalloc() temporary buffer but do copy in each iteration;
  the vmalloc buffer was introduced at the time we took the spinlock
  for the ctl element management.

- Use the standard list_for_each_entry() macro

- Merge two loops into one;
  it used to be a loop for skipping until offset becomes zero and
  another loop to copy the data.  They can be folded into a single
  loop easily.

Reviewed-by: Takashi Sakamoto <[email protected]>
Tested-by: Takashi Sakamoto <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
sound/core/control.c