diff mbox

ASoC: intel: mfld: Make static string arrays 'const 'char * const []'

Message ID 1479242445-12069-1-git-send-email-lars@metafoo.de (mailing list archive)
State Accepted
Commit 266c618d67dd4a42f798baaab47634018cb1db4b
Headers show

Commit Message

Lars-Peter Clausen Nov. 15, 2016, 8:40 p.m. UTC
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 87023ff74b23 ("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>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/intel/boards/mfld_machine.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Vinod Koul Nov. 16, 2016, 2:51 a.m. UTC | #1
On Tue, Nov 15, 2016 at 09:40:45PM +0100, Lars-Peter Clausen wrote:
> 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 87023ff74b23 ("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>
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

Acked-by: Vinod Koul <vinod.koul@intel.com>
diff mbox

Patch

diff --git a/sound/soc/intel/boards/mfld_machine.c b/sound/soc/intel/boards/mfld_machine.c
index 34f46c7..4e08885 100644
--- a/sound/soc/intel/boards/mfld_machine.c
+++ b/sound/soc/intel/boards/mfld_machine.c
@@ -81,9 +81,9 @@  static struct snd_soc_jack_zone mfld_zones[] = {
 };
 
 /* sound card controls */
-static const char *headset_switch_text[] = {"Earpiece", "Headset"};
+static const char * const headset_switch_text[] = {"Earpiece", "Headset"};
 
-static const char *lo_text[] = {"Vibra", "Headset", "IHF", "None"};
+static const char * const lo_text[] = {"Vibra", "Headset", "IHF", "None"};
 
 static const struct soc_enum headset_enum =
 	SOC_ENUM_SINGLE_EXT(2, headset_switch_text);