From: Takashi Iwai Subject: Re: [PATCH 3/3] snd-bcd2000: add control interface Date: Sun, 01 Feb 2015 10:31:11 +0100 Message-ID: References: <1422740065-20196-1-git-send-email-dev@kicherer.org> <1422740065-20196-4-git-send-email-dev@kicherer.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 6D13826057F for ; Sun, 1 Feb 2015 10:31:11 +0100 (CET) In-Reply-To: <1422740065-20196-4-git-send-email-dev@kicherer.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mario Kicherer Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org 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