Alsa-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [alsa-devel] [PATCH 19/68] ALSA: hdspm: More constifications
Date: Sun,  5 Jan 2020 15:47:34 +0100
Message-ID: <20200105144823.29547-20-tiwai@suse.de> (raw)
In-Reply-To: <20200105144823.29547-1-tiwai@suse.de>

Apply const prefix to each possible place: the string arrays, the
channel map tables and callers.

Just for minor optimization and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/rme9652/hdspm.c | 66 +++++++++++++++++++++++++----------------------
 1 file changed, 35 insertions(+), 31 deletions(-)

diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index f926899e4755..2212d5799151 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -637,7 +637,7 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
 #define HDSPM_SPEED_QUAD   2
 
 /* names for speed modes */
-static char *hdspm_speed_names[] = { "single", "double", "quad" };
+static const char * const hdspm_speed_names[] = { "single", "double", "quad" };
 
 static const char *const texts_autosync_aes_tco[] = { "Word Clock",
 					  "AES1", "AES2", "AES3", "AES4",
@@ -684,7 +684,7 @@ static const char *const texts_freq[] = {
 	"192 kHz"
 };
 
-static char *texts_ports_madi[] = {
+static const char * const texts_ports_madi[] = {
 	"MADI.1", "MADI.2", "MADI.3", "MADI.4", "MADI.5", "MADI.6",
 	"MADI.7", "MADI.8", "MADI.9", "MADI.10", "MADI.11", "MADI.12",
 	"MADI.13", "MADI.14", "MADI.15", "MADI.16", "MADI.17", "MADI.18",
@@ -699,7 +699,7 @@ static char *texts_ports_madi[] = {
 };
 
 
-static char *texts_ports_raydat_ss[] = {
+static const char * const texts_ports_raydat_ss[] = {
 	"ADAT1.1", "ADAT1.2", "ADAT1.3", "ADAT1.4", "ADAT1.5", "ADAT1.6",
 	"ADAT1.7", "ADAT1.8", "ADAT2.1", "ADAT2.2", "ADAT2.3", "ADAT2.4",
 	"ADAT2.5", "ADAT2.6", "ADAT2.7", "ADAT2.8", "ADAT3.1", "ADAT3.2",
@@ -710,7 +710,7 @@ static char *texts_ports_raydat_ss[] = {
 	"SPDIF.L", "SPDIF.R"
 };
 
-static char *texts_ports_raydat_ds[] = {
+static const char * const texts_ports_raydat_ds[] = {
 	"ADAT1.1", "ADAT1.2", "ADAT1.3", "ADAT1.4",
 	"ADAT2.1", "ADAT2.2", "ADAT2.3", "ADAT2.4",
 	"ADAT3.1", "ADAT3.2", "ADAT3.3", "ADAT3.4",
@@ -719,7 +719,7 @@ static char *texts_ports_raydat_ds[] = {
 	"SPDIF.L", "SPDIF.R"
 };
 
-static char *texts_ports_raydat_qs[] = {
+static const char * const texts_ports_raydat_qs[] = {
 	"ADAT1.1", "ADAT1.2",
 	"ADAT2.1", "ADAT2.2",
 	"ADAT3.1", "ADAT3.2",
@@ -729,7 +729,7 @@ static char *texts_ports_raydat_qs[] = {
 };
 
 
-static char *texts_ports_aio_in_ss[] = {
+static const char * const texts_ports_aio_in_ss[] = {
 	"Analogue.L", "Analogue.R",
 	"AES.L", "AES.R",
 	"SPDIF.L", "SPDIF.R",
@@ -738,7 +738,7 @@ static char *texts_ports_aio_in_ss[] = {
 	"AEB.1", "AEB.2", "AEB.3", "AEB.4"
 };
 
-static char *texts_ports_aio_out_ss[] = {
+static const char * const texts_ports_aio_out_ss[] = {
 	"Analogue.L", "Analogue.R",
 	"AES.L", "AES.R",
 	"SPDIF.L", "SPDIF.R",
@@ -748,7 +748,7 @@ static char *texts_ports_aio_out_ss[] = {
 	"AEB.1", "AEB.2", "AEB.3", "AEB.4"
 };
 
-static char *texts_ports_aio_in_ds[] = {
+static const char * const texts_ports_aio_in_ds[] = {
 	"Analogue.L", "Analogue.R",
 	"AES.L", "AES.R",
 	"SPDIF.L", "SPDIF.R",
@@ -756,7 +756,7 @@ static char *texts_ports_aio_in_ds[] = {
 	"AEB.1", "AEB.2", "AEB.3", "AEB.4"
 };
 
-static char *texts_ports_aio_out_ds[] = {
+static const char * const texts_ports_aio_out_ds[] = {
 	"Analogue.L", "Analogue.R",
 	"AES.L", "AES.R",
 	"SPDIF.L", "SPDIF.R",
@@ -765,7 +765,7 @@ static char *texts_ports_aio_out_ds[] = {
 	"AEB.1", "AEB.2", "AEB.3", "AEB.4"
 };
 
-static char *texts_ports_aio_in_qs[] = {
+static const char * const texts_ports_aio_in_qs[] = {
 	"Analogue.L", "Analogue.R",
 	"AES.L", "AES.R",
 	"SPDIF.L", "SPDIF.R",
@@ -773,7 +773,7 @@ static char *texts_ports_aio_in_qs[] = {
 	"AEB.1", "AEB.2", "AEB.3", "AEB.4"
 };
 
-static char *texts_ports_aio_out_qs[] = {
+static const char * const texts_ports_aio_out_qs[] = {
 	"Analogue.L", "Analogue.R",
 	"AES.L", "AES.R",
 	"SPDIF.L", "SPDIF.R",
@@ -782,7 +782,7 @@ static char *texts_ports_aio_out_qs[] = {
 	"AEB.1", "AEB.2", "AEB.3", "AEB.4"
 };
 
-static char *texts_ports_aes32[] = {
+static const char * const texts_ports_aes32[] = {
 	"AES.1", "AES.2", "AES.3", "AES.4", "AES.5", "AES.6", "AES.7",
 	"AES.8", "AES.9.", "AES.10", "AES.11", "AES.12", "AES.13", "AES.14",
 	"AES.15", "AES.16"
@@ -796,7 +796,7 @@ static char *texts_ports_aes32[] = {
    where the data for that channel can be read/written from/to.
 */
 
-static char channel_map_unity_ss[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_unity_ss[HDSPM_MAX_CHANNELS] = {
 	0, 1, 2, 3, 4, 5, 6, 7,
 	8, 9, 10, 11, 12, 13, 14, 15,
 	16, 17, 18, 19, 20, 21, 22, 23,
@@ -807,7 +807,7 @@ static char channel_map_unity_ss[HDSPM_MAX_CHANNELS] = {
 	56, 57, 58, 59, 60, 61, 62, 63
 };
 
-static char channel_map_raydat_ss[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_raydat_ss[HDSPM_MAX_CHANNELS] = {
 	4, 5, 6, 7, 8, 9, 10, 11,	/* ADAT 1 */
 	12, 13, 14, 15, 16, 17, 18, 19,	/* ADAT 2 */
 	20, 21, 22, 23, 24, 25, 26, 27,	/* ADAT 3 */
@@ -820,7 +820,7 @@ static char channel_map_raydat_ss[HDSPM_MAX_CHANNELS] = {
 	-1, -1, -1, -1, -1, -1, -1, -1,
 };
 
-static char channel_map_raydat_ds[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_raydat_ds[HDSPM_MAX_CHANNELS] = {
 	4, 5, 6, 7,		/* ADAT 1 */
 	8, 9, 10, 11,		/* ADAT 2 */
 	12, 13, 14, 15,		/* ADAT 3 */
@@ -835,7 +835,7 @@ static char channel_map_raydat_ds[HDSPM_MAX_CHANNELS] = {
 	-1, -1, -1, -1, -1, -1, -1, -1,
 };
 
-static char channel_map_raydat_qs[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_raydat_qs[HDSPM_MAX_CHANNELS] = {
 	4, 5,			/* ADAT 1 */
 	6, 7,			/* ADAT 2 */
 	8, 9,			/* ADAT 3 */
@@ -851,7 +851,7 @@ static char channel_map_raydat_qs[HDSPM_MAX_CHANNELS] = {
 	-1, -1, -1, -1, -1, -1, -1, -1,
 };
 
-static char channel_map_aio_in_ss[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_aio_in_ss[HDSPM_MAX_CHANNELS] = {
 	0, 1,			/* line in */
 	8, 9,			/* aes in, */
 	10, 11,			/* spdif in */
@@ -865,7 +865,7 @@ static char channel_map_aio_in_ss[HDSPM_MAX_CHANNELS] = {
 	-1, -1, -1, -1, -1, -1, -1, -1,
 };
 
-static char channel_map_aio_out_ss[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_aio_out_ss[HDSPM_MAX_CHANNELS] = {
 	0, 1,			/* line out */
 	8, 9,			/* aes out */
 	10, 11,			/* spdif out */
@@ -880,7 +880,7 @@ static char channel_map_aio_out_ss[HDSPM_MAX_CHANNELS] = {
 	-1, -1, -1, -1, -1, -1, -1, -1,
 };
 
-static char channel_map_aio_in_ds[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_aio_in_ds[HDSPM_MAX_CHANNELS] = {
 	0, 1,			/* line in */
 	8, 9,			/* aes in */
 	10, 11,			/* spdif in */
@@ -895,7 +895,7 @@ static char channel_map_aio_in_ds[HDSPM_MAX_CHANNELS] = {
 	-1, -1, -1, -1, -1, -1, -1, -1
 };
 
-static char channel_map_aio_out_ds[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_aio_out_ds[HDSPM_MAX_CHANNELS] = {
 	0, 1,			/* line out */
 	8, 9,			/* aes out */
 	10, 11,			/* spdif out */
@@ -910,7 +910,7 @@ static char channel_map_aio_out_ds[HDSPM_MAX_CHANNELS] = {
 	-1, -1, -1, -1, -1, -1, -1, -1
 };
 
-static char channel_map_aio_in_qs[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_aio_in_qs[HDSPM_MAX_CHANNELS] = {
 	0, 1,			/* line in */
 	8, 9,			/* aes in */
 	10, 11,			/* spdif in */
@@ -925,7 +925,7 @@ static char channel_map_aio_in_qs[HDSPM_MAX_CHANNELS] = {
 	-1, -1, -1, -1, -1, -1, -1, -1
 };
 
-static char channel_map_aio_out_qs[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_aio_out_qs[HDSPM_MAX_CHANNELS] = {
 	0, 1,			/* line out */
 	8, 9,			/* aes out */
 	10, 11,			/* spdif out */
@@ -941,7 +941,7 @@ static char channel_map_aio_out_qs[HDSPM_MAX_CHANNELS] = {
 	-1, -1, -1, -1, -1, -1, -1, -1
 };
 
-static char channel_map_aes32[HDSPM_MAX_CHANNELS] = {
+static const char channel_map_aes32[HDSPM_MAX_CHANNELS] = {
 	0, 1, 2, 3, 4, 5, 6, 7,
 	8, 9, 10, 11, 12, 13, 14, 15,
 	-1, -1, -1, -1, -1, -1, -1, -1,
@@ -1010,17 +1010,21 @@ struct hdspm {
 	unsigned char max_channels_in;
 	unsigned char max_channels_out;
 
-	signed char *channel_map_in;
-	signed char *channel_map_out;
+	const signed char *channel_map_in;
+	const signed char *channel_map_out;
 
-	signed char *channel_map_in_ss, *channel_map_in_ds, *channel_map_in_qs;
-	signed char *channel_map_out_ss, *channel_map_out_ds, *channel_map_out_qs;
+	const signed char *channel_map_in_ss, *channel_map_in_ds, *channel_map_in_qs;
+	const signed char *channel_map_out_ss, *channel_map_out_ds, *channel_map_out_qs;
 
-	char **port_names_in;
-	char **port_names_out;
+	const char * const *port_names_in;
+	const char * const *port_names_out;
 
-	char **port_names_in_ss, **port_names_in_ds, **port_names_in_qs;
-	char **port_names_out_ss, **port_names_out_ds, **port_names_out_qs;
+	const char * const *port_names_in_ss;
+	const char * const *port_names_in_ds;
+	const char * const *port_names_in_qs;
+	const char * const *port_names_out_ss;
+	const char * const *port_names_out_ds;
+	const char * const *port_names_out_qs;
 
 	unsigned char *playback_buffer;	/* suitably aligned address */
 	unsigned char *capture_buffer;	/* suitably aligned address */
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply index

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-05 14:47 [alsa-devel] [PATCH 00/68] ALSA: Constifications, take #2 Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 01/68] ALSA: Allow const arrays for legacy resource management helpers Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 02/68] ALSA: aoa: More constifications Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 03/68] ALSA: hda/realtek - " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 04/68] ALSA: dummy: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 05/68] ALSA: pcm: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 06/68] ALSA: seq: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 07/68] ALSA: vx: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 08/68] ALSA: intel8x0: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 09/68] ALSA: hda: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 10/68] ALSA: ac97: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 11/68] ALSA: usb-audio: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 12/68] ALSA: caiaq: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 13/68] ALSA: au88x0: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 14/68] ALSA: emu10k1: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 15/68] ALSA: riptide: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 16/68] ALSA: ice1712: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 17/68] ALSA: ppc: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 18/68] ALSA: hdsp: " Takashi Iwai
2020-01-05 14:47 ` Takashi Iwai [this message]
2020-01-05 14:47 ` [alsa-devel] [PATCH 20/68] ALSA: rme9652: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 21/68] ALSA: emux: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 22/68] ALSA: usx2y: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 23/68] ALSA: pcxhr: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 24/68] ALSA: mixart: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 25/68] ALSA: ymfpci: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 26/68] ALSA: bcd2000: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 27/68] ALSA: nm256: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 28/68] ALSA: korg1212: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 29/68] ALSA: cs46xx: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 30/68] ALSA: ca0106: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 31/68] ALSA: ctxfi: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 32/68] ALSA: asihpi: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 33/68] ALSA: atiixp: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 34/68] ALSA: es1938: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 35/68] ALSA: es1968: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 36/68] ALSA: cmipci: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 37/68] ALSA: sparc: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 38/68] ALSA: info: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 39/68] ALSA: jack: More constification Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 40/68] ALSA: oss: More constifications Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 41/68] ALSA: rawmidi: More constification Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 42/68] ALSA: opl3: More constifications Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 43/68] ALSA: cmi8328: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 44/68] ALSA: cs423x: More constification Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 45/68] ALSA: sb: More constifications Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 46/68] ALSA: cmi8330: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 47/68] ALSA: es1688: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 48/68] ALSA: es18xx: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 49/68] ALSA: gus: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 50/68] ALSA: opti9xx: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 51/68] ALSA: wss: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 52/68] ALSA: sc6000: More constification Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 53/68] ALSA: mts64: More constifications Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 54/68] ALSA: aw2: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 55/68] ALSA: lx6464es: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 56/68] ALSA: arm: More constification Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 57/68] ALSA: opl4: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 58/68] ALSA: serial-u16550: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 59/68] ALSA: ak4531: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 60/68] ALSA: azt3328: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 61/68] ALSA: cs4281: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 62/68] ALSA: echoaudio: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 63/68] ALSA: ens137x: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 64/68] ALSA: fm801: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 65/68] ALSA: via82xx: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 66/68] ALSA: pdaudiocf: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 67/68] ALSA: spi: " Takashi Iwai
2020-01-05 14:48 ` [alsa-devel] [PATCH 68/68] ALSA: sh: Fix compile warning wrt const Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200105144823.29547-20-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Alsa-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \
		alsa-devel@alsa-project.org
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git