OSDN Git Service

ALSA: ppc: More constifications
authorTakashi Iwai <tiwai@suse.de>
Sun, 5 Jan 2020 14:47:32 +0000 (15:47 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sun, 5 Jan 2020 15:14:43 +0000 (16:14 +0100)
Apply const prefix to each possible place: the static tables for rate,
volume, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-18-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/ppc/beep.c
sound/ppc/pmac.c
sound/ppc/pmac.h
sound/ppc/tumbler.c
sound/ppc/tumbler_volume.h

index e2806b8..6bc586a 100644 (file)
@@ -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,
index 87738dd..592532c 100644 (file)
 
 
 /* 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,
index 529f5a9..a758caf 100644 (file)
@@ -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;
index a584303..6e5bdaa 100644 (file)
@@ -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,
index 549ec6a..16d5480 100644 (file)
@@ -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,