[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200709142034.59802.vda.linux@googlemail.com>
Date: Fri, 14 Sep 2007 20:34:59 +0100
From: Denys Vlasenko <vda.linux@...glemail.com>
To: Joe Perches <joe@...ches.com>
Cc: Takashi Iwai <tiwai@...e.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] add consts where appropriate in sound/pci/hda/*
On Friday 14 September 2007 19:09, Joe Perches wrote:
> On Fri, 2007-09-14 at 18:48 +0100, Denys Vlasenko wrote:
>
> > Patch is attached.
>
> The SND_HDA_PRESETS define doesn't seem useful.
> It's only used once.
It is defined in .h file and used in .c file.
It is made so because defining static data variables in .h file
is a bad style in general and in this case will result in build-time
warnings in particular.
Therefore definition of hda_preset_tables[] is moved to .c file.
It looks like this:
static const struct hda_codec_preset *const hda_preset_tables[] = {
snd_hda_preset_realtek,
snd_hda_preset_cmedia,
snd_hda_preset_analog,
snd_hda_preset_sigmatel,
snd_hda_preset_si3054,
snd_hda_preset_atihdmi,
snd_hda_preset_conexant,
snd_hda_preset_via,
NULL
};
I want to make it easier for people to add new snd_hda_preset_XXX.
I don't want them to be forced to add it in hda_patch.h first,
and then go to hda_codec.c and add it there too.
Therefore I turned this list into a #define which sits in hda_patch.h:
#define SND_HDA_PRESETS \
snd_hda_preset_realtek, \
snd_hda_preset_cmedia, \
snd_hda_preset_analog, \
snd_hda_preset_sigmatel, \
snd_hda_preset_si3054, \
snd_hda_preset_atihdmi, \
snd_hda_preset_conexant, \
snd_hda_preset_via
Now if you want to add yet another snd_hda_preset_XXX, you
don't need to touch hda_codec.c.
Original code was achieving the same by cheating: it has
static const struct hda_codec_preset *hda_preset_tables[] = {...}
in hda_patch.h.
--
vda
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists