ASoC: pxa: Make static string arrays 'const 'char * const []'
Subsystems (3)
PATCH 1/1 ASoC: pxa: Make static string arrays 'const 'char * const []'
const char * const [] is the preferred type for static string arrays since this states explicitly that the individual entries are not going to be changed. Due to limitations in the ASoC API it was not possible to use it for enum text arrays. Commit 87023ff74 ('ASoC: Declare const properly for enum texts') changed this, but most drivers still use 'const char
* []' as the type for their enum text arrays.
Change these occurrences of 'static * const char * []' to 'static const char * const []'.
The conversion was done automatically using the following coccinelle semantic patch:
// <smpl>
@disable optional_qualifier@
identifier s;
@@
static
-const char *
+const char * const
s[] = ...;
// </smpl>
--- sound/soc/pxa/corgi.c | 6 +++--- sound/soc/pxa/magician.c | 2 +- sound/soc/pxa/poodle.c | 4 ++-- sound/soc/pxa/spitz.c | 6 +++--- sound/soc/pxa/tosa.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-)
sound/soc/pxa/corgi.c +3 -3
@@ -244,9 +244,9 @@ static const struct snd_soc_dapm_route corgi_audio_map[] = { {"MICIN", NULL, "Line Jack"}, }; -static const char *jack_function[] = {"Headphone" ,"Mic" ,"Line" ,"Headset" , -"Off" }; -static const char *spk_function[] = {"On" ,"Off" }; +static const char *const jack_function[] = {"Headphone" ,"Mic" ,"Line" , +"Headset" ,"Off" }; +static const char *const spk_function[] = {"On" ,"Off" };static const struct soc_enum corgi_enum[] = {SOC_ENUM_SINGLE_EXT (5 , jack_function), SOC_ENUM_SINGLE_EXT(2, spk_function),
sound/soc/pxa/magician.c +1 -1
@@ -376,7 +376,7 @@ static const struct snd_soc_dapm_route audio_map[] = { {"VINM", NULL, "Call Mic"}, }; -static const char *input_select[] = {"Call Mic" ,"Headset Mic" }; +static const char *const input_select[] = {"Call Mic" ,"Headset Mic" };static const struct soc_enum magician_in_sel_enum =SOC_ENUM_SINGLE_EXT (2 , input_select);
sound/soc/pxa/poodle.c +2 -2
@@ -209,8 +209,8 @@ static const struct snd_soc_dapm_route poodle_audio_map[] = { {"MICIN", NULL, "Microphone"}, }; -static const char *jack_function[] = {"Off" ,"Headphone" }; -static const char *spk_function[] = {"Off" ,"On" }; +static const char *const jack_function[] = {"Off" ,"Headphone" }; +static const char *const spk_function[] = {"Off" ,"On" };static const struct soc_enum poodle_enum[] = {SOC_ENUM_SINGLE_EXT (2 , jack_function), SOC_ENUM_SINGLE_EXT(2, spk_function),
sound/soc/pxa/spitz.c +3 -3
@@ -241,9 +241,9 @@ static const struct snd_soc_dapm_route spitz_audio_map[] = { {"LINPUT1", NULL, "Line Jack"}, }; -static const char *jack_function[] = {"Headphone" ,"Mic" ,"Line" ,"Headset" , -"Off" }; -static const char *spk_function[] = {"On" ,"Off" }; +static const char *const jack_function[] = {"Headphone" ,"Mic" ,"Line" , +"Headset" ,"Off" }; +static const char *const spk_function[] = {"On" ,"Off" };static const struct soc_enum spitz_enum[] = {SOC_ENUM_SINGLE_EXT (5 , jack_function), SOC_ENUM_SINGLE_EXT(2, spk_function),
sound/soc/pxa/tosa.c +3 -3
@@ -169,9 +169,9 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Mic Bias", NULL, "Headset Jack"}, }; -static const char *jack_function[] = {"Headphone" ,"Mic" ,"Line" ,"Headset" , -"Off" }; -static const char *spk_function[] = {"On" ,"Off" }; +static const char *const jack_function[] = {"Headphone" ,"Mic" ,"Line" , +"Headset" ,"Off" }; +static const char *const spk_function[] = {"On" ,"Off" };static const struct soc_enum tosa_enum[] = {SOC_ENUM_SINGLE_EXT (5 , jack_function), SOC_ENUM_SINGLE_EXT(2, spk_function),
Signature · 1 line
2.1.4
Robert Jarzmik
maintainerQuoted 22 lines · Lars-Peter Clausen
const char * const [] is the preferred type for static string arrays since this states explicitly that the individual entries are not going to be changed. Due to limitations in the ASoC API it was not possible to use it for enum text arrays. Commit
87023ff74('ASoC: Declare const properly for enum texts') changed this, but most drivers still use 'const char
* []' as the type for their enum text arrays.Change these occurrences of 'static * const char * []' to 'static const char * const []'.
The conversion was done automatically using the following coccinelle semantic patch:
// <smpl>
@disable optional_qualifier@
identifier s;
@@
static(quoted diff) +1
-1-const char * +const char * const s[] = ...;// </smpl>
Quoted 1 line
Signed-off-by Lars-Peter Clausen <[email protected]>
Hi,
Could you amend your commit message so that checkpatch doesn't complain anymore ? This being done, looks good to me.
Cheers.
--
Robert
Mark Brown
maintainerApplied "ASoC: pxa: Make static string arrays 'const 'char * const []'" to the asoc tree
In reply to Lars-Peter ClausenThe patch
ASoC: pxa: Make static string arrays 'const 'char * const []'
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
92be58106e5d750b97567bea7171f5aee74a678aMon Sep 17 00:00:00 2001
From: Lars-Peter Clausen <[email protected]>
Date: Sat, 12 Nov 2016 14:23:13 +0100
Subject: [PATCH] ASoC: pxa: Make static string arrays 'const 'char * const []'
const char * const [] is the preferred type for static string arrays since this states explicitly that the individual entries are not going to be changed. Due to limitations in the ASoC API it was not possible to use it for enum text arrays. Commit 87023ff74 ('ASoC: Declare const properly for enum texts') changed this, but most drivers still use 'const char
* []' as the type for their enum text arrays.
Change these occurrences of 'static * const char * []' to 'static const char * const []'.
The conversion was done automatically using the following coccinelle semantic patch:
// <smpl>
@disable optional_qualifier@
identifier s;
@@
static
-const char *
+const char * const
s[] = ...;
// </smpl>
--- sound/soc/pxa/corgi.c | 6 +++--- sound/soc/pxa/magician.c | 2 +- sound/soc/pxa/poodle.c | 4 ++-- sound/soc/pxa/spitz.c | 6 +++--- sound/soc/pxa/tosa.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-)
sound/soc/pxa/corgi.c +3 -3
@@ -244,9 +244,9 @@ static const struct snd_soc_dapm_route corgi_audio_map[] = { {"MICIN", NULL, "Line Jack"}, }; -static const char *jack_function[] = {"Headphone" ,"Mic" ,"Line" ,"Headset" , -"Off" }; -static const char *spk_function[] = {"On" ,"Off" }; +static const char *const jack_function[] = {"Headphone" ,"Mic" ,"Line" , +"Headset" ,"Off" }; +static const char *const spk_function[] = {"On" ,"Off" };static const struct soc_enum corgi_enum[] = {SOC_ENUM_SINGLE_EXT (5 , jack_function), SOC_ENUM_SINGLE_EXT(2, spk_function),
sound/soc/pxa/magician.c +1 -1
@@ -376,7 +376,7 @@ static const struct snd_soc_dapm_route audio_map[] = { {"VINM", NULL, "Call Mic"}, }; -static const char *input_select[] = {"Call Mic" ,"Headset Mic" }; +static const char *const input_select[] = {"Call Mic" ,"Headset Mic" };static const struct soc_enum magician_in_sel_enum =SOC_ENUM_SINGLE_EXT (2 , input_select);
sound/soc/pxa/poodle.c +2 -2
@@ -209,8 +209,8 @@ static const struct snd_soc_dapm_route poodle_audio_map[] = { {"MICIN", NULL, "Microphone"}, }; -static const char *jack_function[] = {"Off" ,"Headphone" }; -static const char *spk_function[] = {"Off" ,"On" }; +static const char *const jack_function[] = {"Off" ,"Headphone" }; +static const char *const spk_function[] = {"Off" ,"On" };static const struct soc_enum poodle_enum[] = {SOC_ENUM_SINGLE_EXT (2 , jack_function), SOC_ENUM_SINGLE_EXT(2, spk_function),
sound/soc/pxa/spitz.c +3 -3
@@ -241,9 +241,9 @@ static const struct snd_soc_dapm_route spitz_audio_map[] = { {"LINPUT1", NULL, "Line Jack"}, }; -static const char *jack_function[] = {"Headphone" ,"Mic" ,"Line" ,"Headset" , -"Off" }; -static const char *spk_function[] = {"On" ,"Off" }; +static const char *const jack_function[] = {"Headphone" ,"Mic" ,"Line" , +"Headset" ,"Off" }; +static const char *const spk_function[] = {"On" ,"Off" };static const struct soc_enum spitz_enum[] = {SOC_ENUM_SINGLE_EXT (5 , jack_function), SOC_ENUM_SINGLE_EXT(2, spk_function),
sound/soc/pxa/tosa.c +3 -3
@@ -170,9 +170,9 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Mic Bias", NULL, "Headset Jack"}, }; -static const char *jack_function[] = {"Headphone" ,"Mic" ,"Line" ,"Headset" , -"Off" }; -static const char *spk_function[] = {"On" ,"Off" }; +static const char *const jack_function[] = {"Headphone" ,"Mic" ,"Line" , +"Headset" ,"Off" }; +static const char *const spk_function[] = {"On" ,"Off" };static const struct soc_enum tosa_enum[] = {SOC_ENUM_SINGLE_EXT (5 , jack_function), SOC_ENUM_SINGLE_EXT(2, spk_function),
Signature · 1 line
2.10.2