1 Feb
2015
1 Feb
'15
10:31 a.m.
At Sat, 31 Jan 2015 22:34:25 +0100, Mario Kicherer wrote:
+static struct snd_kcontrol_new elements[] = {
- {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,.name = "Phono A / Mic Capture Switch",
Don't use "Switch" suffix for an enum control.
.index = 0,.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,.info = bcd2000_control_phono_mic_sw_info,.get = bcd2000_control_phono_mic_sw_get,.put = bcd2000_control_phono_mic_sw_put- },
- {}
+};
+int bcd2000_init_control(struct bcd2000 *bcd2k) +{
- int i, ret;
- bcd2k->control.bcd2k = bcd2k;
- i = 0;
- while (elements[i].name) {
ret = snd_ctl_add(bcd2k->card, snd_ctl_new1(&elements[i],&bcd2k->control));if (ret < 0) {dev_err(&bcd2k->dev->dev, "cannot add control\n");return ret;}i++;
This is written usually with a for loop.
thanks,
Takashi