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 17/68] ALSA: ppc: More constifications
Date: Sun,  5 Jan 2020 15:47:32 +0100
Message-ID: <20200105144823.29547-18-tiwai@suse.de> (raw)
In-Reply-To: <20200105144823.29547-1-tiwai@suse.de>

Apply const prefix to each possible place: the static tables for rate,
volume, etc.

Just for minor optimization and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/ppc/beep.c           |  2 +-
 sound/ppc/pmac.c           |  8 ++++----
 sound/ppc/pmac.h           |  2 +-
 sound/ppc/tumbler.c        | 20 ++++++++++----------
 sound/ppc/tumbler_volume.h | 12 ++++++------
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index e2806b8aee53..6bc586a5db0f 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -44,7 +44,7 @@ void snd_pmac_beep_stop(struct snd_pmac *chip)
  * so we can multiply by an amplitude in the range 0..100 to get a
  * signed short value to put in the output buffer.
  */
-static short beep_wform[256] = {
+static const short beep_wform[256] = {
 	0,	40,	79,	117,	153,	187,	218,	245,
 	269,	288,	304,	316,	323,	327,	327,	324,
 	318,	310,	299,	288,	275,	262,	249,	236,
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 87738ddc8bfd..592532c09a82 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -24,11 +24,11 @@
 
 
 /* fixed frequency table for awacs, screamer, burgundy, DACA (44100 max) */
-static int awacs_freqs[8] = {
+static const int awacs_freqs[8] = {
 	44100, 29400, 22050, 17640, 14700, 11025, 8820, 7350
 };
 /* fixed frequency table for tumbler */
-static int tumbler_freqs[1] = {
+static const int tumbler_freqs[1] = {
 	44100
 };
 
@@ -1174,7 +1174,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
 	np = chip->node;
 	chip->requested = 0;
 	if (chip->is_k2) {
-		static char *rnames[] = {
+		static const char * const rnames[] = {
 			"Sound Control", "Sound DMA" };
 		for (i = 0; i < 2; i ++) {
 			if (of_address_to_resource(np->parent, i,
@@ -1199,7 +1199,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
 		txdma_addr = chip->rsrc[1].start;
 		rxdma_addr = txdma_addr + 0x100;
 	} else {
-		static char *rnames[] = {
+		static const char * const rnames[] = {
 			"Sound Control", "Sound Tx DMA", "Sound Rx DMA" };
 		for (i = 0; i < 3; i ++) {
 			if (of_address_to_resource(np, i,
diff --git a/sound/ppc/pmac.h b/sound/ppc/pmac.h
index 529f5a9f9039..a758caf689d2 100644
--- a/sound/ppc/pmac.h
+++ b/sound/ppc/pmac.h
@@ -104,7 +104,7 @@ struct snd_pmac {
 	struct resource rsrc[3];
 
 	int num_freqs;
-	int *freq_table;
+	const int *freq_table;
 	unsigned int freqs_ok;		/* bit flags */
 	unsigned int formats_ok;	/* pcm hwinfo */
 	int active;
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index a5843035d718..6e5bdaa262b0 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -106,7 +106,7 @@ struct pmac_tumbler {
 /*
  */
 
-static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs)
+static int send_init_client(struct pmac_keywest *i2c, const unsigned int *regs)
 {
 	while (*regs > 0) {
 		int err, count = 10;
@@ -128,7 +128,7 @@ static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs)
 
 static int tumbler_init_client(struct pmac_keywest *i2c)
 {
-	static unsigned int regs[] = {
+	static const unsigned int regs[] = {
 		/* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */
 		TAS_REG_MCS, (1<<6)|(2<<4)|(2<<2)|0,
 		0, /* terminator */
@@ -139,7 +139,7 @@ static int tumbler_init_client(struct pmac_keywest *i2c)
 
 static int snapper_init_client(struct pmac_keywest *i2c)
 {
-	static unsigned int regs[] = {
+	static const unsigned int regs[] = {
 		/* normal operation, SCLK=64fps, i2s output, 16bit width */
 		TAS_REG_MCS, (1<<6)|(2<<4)|0,
 		/* normal operation, all-pass mode */
@@ -478,11 +478,11 @@ struct tumbler_mono_vol {
 	int reg;
 	int bytes;
 	unsigned int max;
-	unsigned int *table;
+	const unsigned int *table;
 };
 
 static int tumbler_set_mono_volume(struct pmac_tumbler *mix,
-				   struct tumbler_mono_vol *info)
+				   const struct tumbler_mono_vol *info)
 {
 	unsigned char block[4];
 	unsigned int vol;
@@ -553,7 +553,7 @@ static int tumbler_put_mono(struct snd_kcontrol *kcontrol,
 }
 
 /* TAS3001c mono volumes */
-static struct tumbler_mono_vol tumbler_pcm_vol_info = {
+static const struct tumbler_mono_vol tumbler_pcm_vol_info = {
 	.index = VOL_IDX_PCM_MONO,
 	.reg = TAS_REG_PCM,
 	.bytes = 3,
@@ -561,7 +561,7 @@ static struct tumbler_mono_vol tumbler_pcm_vol_info = {
 	.table = mixer_volume_table,
 };
 
-static struct tumbler_mono_vol tumbler_bass_vol_info = {
+static const struct tumbler_mono_vol tumbler_bass_vol_info = {
 	.index = VOL_IDX_BASS,
 	.reg = TAS_REG_BASS,
 	.bytes = 1,
@@ -569,7 +569,7 @@ static struct tumbler_mono_vol tumbler_bass_vol_info = {
 	.table = bass_volume_table,
 };
 
-static struct tumbler_mono_vol tumbler_treble_vol_info = {
+static const struct tumbler_mono_vol tumbler_treble_vol_info = {
 	.index = VOL_IDX_TREBLE,
 	.reg = TAS_REG_TREBLE,
 	.bytes = 1,
@@ -578,7 +578,7 @@ static struct tumbler_mono_vol tumbler_treble_vol_info = {
 };
 
 /* TAS3004 mono volumes */
-static struct tumbler_mono_vol snapper_bass_vol_info = {
+static const struct tumbler_mono_vol snapper_bass_vol_info = {
 	.index = VOL_IDX_BASS,
 	.reg = TAS_REG_BASS,
 	.bytes = 1,
@@ -586,7 +586,7 @@ static struct tumbler_mono_vol snapper_bass_vol_info = {
 	.table = snapper_bass_volume_table,
 };
 
-static struct tumbler_mono_vol snapper_treble_vol_info = {
+static const struct tumbler_mono_vol snapper_treble_vol_info = {
 	.index = VOL_IDX_TREBLE,
 	.reg = TAS_REG_TREBLE,
 	.bytes = 1,
diff --git a/sound/ppc/tumbler_volume.h b/sound/ppc/tumbler_volume.h
index 549ec6a31a98..16d548019ee9 100644
--- a/sound/ppc/tumbler_volume.h
+++ b/sound/ppc/tumbler_volume.h
@@ -2,7 +2,7 @@
 /* volume tables, taken from TAS3001c data manual */
 /* volume gain values */
 /* 0 = -70 dB, 175 = 18.0 dB in 0.5 dB step */
-static unsigned int master_volume_table[] = {
+static const unsigned int master_volume_table[] = {
 	0x00000015, 0x00000016,	0x00000017,
 	0x00000019, 0x0000001a,	0x0000001c,
 	0x0000001d, 0x0000001f,	0x00000021,
@@ -66,7 +66,7 @@ static unsigned int master_volume_table[] = {
 
 /* treble table for TAS3001c */
 /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */
-static unsigned int treble_volume_table[] = {
+static const unsigned int treble_volume_table[] = {
 	0x96, 0x95, 0x94,
 	0x93, 0x92, 0x91,
 	0x90, 0x8f, 0x8e,
@@ -96,7 +96,7 @@ static unsigned int treble_volume_table[] = {
 
 /* bass table for TAS3001c */
 /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */
-static unsigned int bass_volume_table[] = {
+static const unsigned int bass_volume_table[] = {
 	0x86, 0x82, 0x7f,
 	0x7d, 0x7a, 0x78,
 	0x76, 0x74, 0x72,
@@ -126,7 +126,7 @@ static unsigned int bass_volume_table[] = {
 
 /* mixer (pcm) volume table */
 /* 0 = -70 dB, 175 = 18.0 dB in 0.5 dB step */
-static unsigned int mixer_volume_table[] = {
+static const unsigned int mixer_volume_table[] = {
 	0x00014b, 0x00015f, 0x000174,
 	0x00018a, 0x0001a1, 0x0001ba,
 	0x0001d4, 0x0001f0, 0x00020d,
@@ -191,7 +191,7 @@ static unsigned int mixer_volume_table[] = {
 
 /* treble table for TAS3004 */
 /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */
-static unsigned int snapper_treble_volume_table[] = {
+static const unsigned int snapper_treble_volume_table[] = {
 	0x96, 0x95, 0x94,
 	0x93, 0x92, 0x91,
 	0x90, 0x8f, 0x8e,
@@ -221,7 +221,7 @@ static unsigned int snapper_treble_volume_table[] = {
 
 /* bass table for TAS3004 */
 /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */
-static unsigned int snapper_bass_volume_table[] = {
+static const unsigned int snapper_bass_volume_table[] = {
 	0x96, 0x95, 0x94,
 	0x93, 0x92, 0x91,
 	0x90, 0x8f, 0x8e,
-- 
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 ` Takashi Iwai [this message]
2020-01-05 14:47 ` [alsa-devel] [PATCH 18/68] ALSA: hdsp: " Takashi Iwai
2020-01-05 14:47 ` [alsa-devel] [PATCH 19/68] ALSA: hdspm: " Takashi Iwai
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-18-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