From: Takashi Iwai Subject: Re: [RFC] usb-audio: Use a table of mixer controls Date: Sat, 12 May 2012 09:45:00 +0200 Message-ID: References: <1336757328-22649-1-git-send-email-mark@pogo.org.uk> 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 12DD7244AE for ; Sat, 12 May 2012 09:45:01 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Mark Hills Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Sat, 12 May 2012 00:21:14 +0100 (BST), Mark Hills wrote: > > On Fri, 11 May 2012, Takashi Iwai wrote: > > > > +/* > > > + * The mixer units for Ebox-44 are corrupt, and even where they > > > + * are valid they presents mono controls as L and R channels of > > > + * stereo. So we create provide a good mixer here. > > > + */ > > > +struct std_mono_table ebox44_table[] = { > > > + { 4, 1, 0x0, USB_MIXER_INV_BOOLEAN, "Headphone Playback Switch", NULL }, > > > + { 4, 2, 0x1, USB_MIXER_S16, "Headphone A Mix Playback Volume", NULL }, > > > + { 4, 2, 0x2, USB_MIXER_S16, "Headphone B Mix Playback Volume", NULL }, > > > + > > > + { 7, 1, 0x0, USB_MIXER_INV_BOOLEAN, "Output Playback Switch", NULL }, > > > + { 7, 2, 0x1, USB_MIXER_S16, "Output A Playback Volume", NULL }, > > > + { 7, 2, 0x2, USB_MIXER_S16, "Output B Playback Volume", NULL }, > > > + > > > + { 10, 1, 0x0, USB_MIXER_INV_BOOLEAN, "Input Capture Switch", NULL }, > > > + { 10, 2, 0x1, USB_MIXER_S16, "Input A Capture Volume", NULL }, > > > + { 10, 2, 0x2, USB_MIXER_S16, "Input B Capture Volume", NULL }, > > > + > > > + { } > > > > C99 style struct initialization is preferred. Then NULL settings can > > be omittted. > > Do you mean like this? > > ebox44_table[] = { > { > .unitid = 4, > .control = 1 > .cmask = 0x0 > /* etc. */ > } > > Because then it becomes a lot less concise and a lot less readable? I can't count fields more than two, so to me, C99 style is more readable :) > Of course, if there are more optional params in the future, then maybe. Yep. > IIRC, I could omit the NULL anyway, because static memory is initialised > to contain zeroes (hence the "{ }" works). Am I correct? It's late, I > might be mistaken. Yes. But it's not recommended much, when you think of adding a new field. Takashi