From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] Improved support for different bt87x board configurations Date: Wed, 05 Sep 2007 12:07:52 +0200 Message-ID: References: <1188801407.6762.1208578117@webmail.messagingengine.com> <1188914079.6535.47.camel@areia> <1188975275.6158.34.camel@areia> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mx1.suse.de (ns.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 8B3F3103975 for ; Wed, 5 Sep 2007 12:07:53 +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: Trent Piepho Cc: alsa-devel@alsa-project.org, Linux and Kernel Video , Mauro Carvalho Chehab List-Id: alsa-devel@alsa-project.org At Wed, 5 Sep 2007 02:09:45 -0700 (PDT), Trent Piepho wrote: > = > On Wed, 5 Sep 2007, Mauro Carvalho Chehab wrote: > > Em Ter, 2007-09-04 =E0s 14:04 -0700, Trent Piepho escreveu: > > > There are few drawbacks. > > > > > > First, there are like 20x more cards supported by the bttv driver tha= n by > > > the bt87x driver. It's going to produce a very sparse card database = in the > > > ALSA driver. Note that for the most part, __initdata doesn't work, s= o you > > > can't say "it'll just be dropped after the driver loads." > > > > You should notice that even the way you've mapped is a a little sparse, > > since just two boards use digital_fmt. > > > > Maybe one solution for that is to use a different code or data > > structure. > > > > For example, instead of using a data struct, you could use some sort of > > code like (*) (**): > > > > static void fill_board (struct snd_bt87x_board &board, int board_id) > > { > > board->dig_rate =3D 32000; > > switch (board_id) { > > case BTTV_BOARD_AVPHONE98: > > board.dig_rate =3D 48000, > > break; > = > I don't think gcc will be smart enough to a bunch of cases with random nu= mbers > into a O(1) lookup, instead it will use an O(log n) branch chain. With a= ll > the explicit assignments, I doubt it will be much smaller, if any, since = there > are just a couple board configurations. Several board configurations are > currently duplicates and I think I'll just merge them. > = > But code wise I think using a switch with manual assignments is ugly. It= 's a > lot more code to write and just doesn't have the regularity and elegance = of a > table. I second for Trent. The switch is uglier than the array for such a purpose. > > > And if both linuxtv and alsa use the same header, what happens if they > > > don't push the changes to GIT at the exact same time? You'll have pa= tches > > > in one subsystem that are dependant on the other subsystem. How will= they > > > make the same merge window? > > > > This should be coordinated between me and Takashi. I have no objections > > if he pull such patch, if he is willing to send the pull request before > > myself. > > > > I don't see this as a big trouble. There are other cases like this > > already (pci_ids.h, i2c_id.h). Also, currently, there are not much bttv > > board additions anymore. > = > And pci_ids and i2d_id are pain to deal with. Both v4l-dvb and ALSA have= out > of kernel tree build system that try to be backward compatible with older > kernels. When the IDs come from somewhere outside the repository, you ne= ed to > have compat patches to deal with old id files that are missing ids. Look= at > all the kernel-sync patches for those id files, all the compat code in the > various drivers for non-defined PCI ids. There's even something I had to= add > to compat.h for an i2c ID that went away in newer kernels. > = > It's a lot of extra work, and I just don't see the point. To reuse a cou= ple > defines from a bttv header file? They are just arbitrary numbers, it's n= ot > like there is any benefit from using the same value in both drivers. Well, at first I misunderstood that we would share the PCI SSIDs together with enum items. Sharing only the enum items doesn't give much improvements. Sharing the card database may do, though. So, I see Trent's point. The merge work wouldn't pay for the benifit by sharing only the enum id, not the card database. thanks, Takashi