ALSA: hda - Use a macro for snd_array iteration loops

Introduce a new helper macro, snd_array_for_each(), to iterate for
each snd_array element.  It slightly improves the readability than
lengthy open codes at each place.

Along with it, add const prefix to some obvious places.

There should be no functional changes by this.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai
2018-04-23 17:24:56 +02:00
parent f656891c66
commit a9c2dfc852
8 changed files with 57 additions and 54 deletions

View File

@@ -65,10 +65,10 @@ static bool hda_writeable_reg(struct device *dev, unsigned int reg)
{
struct hdac_device *codec = dev_to_hdac_dev(dev);
unsigned int verb = get_verb(reg);
const unsigned int *v;
int i;
for (i = 0; i < codec->vendor_verbs.used; i++) {
unsigned int *v = snd_array_elem(&codec->vendor_verbs, i);
snd_array_for_each(&codec->vendor_verbs, i, v) {
if (verb == *v)
return true;
}