Commit f729f88a authored by Takashi Iwai's avatar Takashi Iwai

ALSA: intel8x0: More constifications

Apply const prefix to more places: the static tables for PCM
definitions, the register tables, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-9-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c0948245
...@@ -393,7 +393,7 @@ struct intel8x0 { ...@@ -393,7 +393,7 @@ struct intel8x0 {
struct snd_ac97 *ac97[3]; struct snd_ac97 *ac97[3];
unsigned int ac97_sdin[3]; unsigned int ac97_sdin[3];
unsigned int max_codecs, ncodecs; unsigned int max_codecs, ncodecs;
unsigned int *codec_bit; const unsigned int *codec_bit;
unsigned int codec_isr_bits; unsigned int codec_isr_bits;
unsigned int codec_ready_bits; unsigned int codec_ready_bits;
...@@ -843,7 +843,7 @@ static int snd_intel8x0_ali_trigger(struct snd_pcm_substream *substream, int cmd ...@@ -843,7 +843,7 @@ static int snd_intel8x0_ali_trigger(struct snd_pcm_substream *substream, int cmd
struct intel8x0 *chip = snd_pcm_substream_chip(substream); struct intel8x0 *chip = snd_pcm_substream_chip(substream);
struct ichdev *ichdev = get_ichdev(substream); struct ichdev *ichdev = get_ichdev(substream);
unsigned long port = ichdev->reg_offset; unsigned long port = ichdev->reg_offset;
static int fiforeg[] = { static const int fiforeg[] = {
ICHREG(ALI_FIFOCR1), ICHREG(ALI_FIFOCR2), ICHREG(ALI_FIFOCR3) ICHREG(ALI_FIFOCR1), ICHREG(ALI_FIFOCR2), ICHREG(ALI_FIFOCR3)
}; };
unsigned int val, fifo; unsigned int val, fifo;
...@@ -1443,7 +1443,7 @@ struct ich_pcm_table { ...@@ -1443,7 +1443,7 @@ struct ich_pcm_table {
((chip)->fix_nocache ? SNDRV_DMA_TYPE_DEV_UC : SNDRV_DMA_TYPE_DEV) ((chip)->fix_nocache ? SNDRV_DMA_TYPE_DEV_UC : SNDRV_DMA_TYPE_DEV)
static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device, static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
struct ich_pcm_table *rec) const struct ich_pcm_table *rec)
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
...@@ -1498,7 +1498,7 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device, ...@@ -1498,7 +1498,7 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
return 0; return 0;
} }
static struct ich_pcm_table intel_pcms[] = { static const struct ich_pcm_table intel_pcms[] = {
{ {
.playback_ops = &snd_intel8x0_playback_ops, .playback_ops = &snd_intel8x0_playback_ops,
.capture_ops = &snd_intel8x0_capture_ops, .capture_ops = &snd_intel8x0_capture_ops,
...@@ -1535,7 +1535,7 @@ static struct ich_pcm_table intel_pcms[] = { ...@@ -1535,7 +1535,7 @@ static struct ich_pcm_table intel_pcms[] = {
}, },
}; };
static struct ich_pcm_table nforce_pcms[] = { static const struct ich_pcm_table nforce_pcms[] = {
{ {
.playback_ops = &snd_intel8x0_playback_ops, .playback_ops = &snd_intel8x0_playback_ops,
.capture_ops = &snd_intel8x0_capture_ops, .capture_ops = &snd_intel8x0_capture_ops,
...@@ -1558,7 +1558,7 @@ static struct ich_pcm_table nforce_pcms[] = { ...@@ -1558,7 +1558,7 @@ static struct ich_pcm_table nforce_pcms[] = {
}, },
}; };
static struct ich_pcm_table ali_pcms[] = { static const struct ich_pcm_table ali_pcms[] = {
{ {
.playback_ops = &snd_intel8x0_ali_playback_ops, .playback_ops = &snd_intel8x0_ali_playback_ops,
.capture_ops = &snd_intel8x0_ali_capture_ops, .capture_ops = &snd_intel8x0_ali_capture_ops,
...@@ -1593,7 +1593,7 @@ static struct ich_pcm_table ali_pcms[] = { ...@@ -1593,7 +1593,7 @@ static struct ich_pcm_table ali_pcms[] = {
static int snd_intel8x0_pcm(struct intel8x0 *chip) static int snd_intel8x0_pcm(struct intel8x0 *chip)
{ {
int i, tblsize, device, err; int i, tblsize, device, err;
struct ich_pcm_table *tbl, *rec; const struct ich_pcm_table *tbl, *rec;
switch (chip->device_type) { switch (chip->device_type) {
case DEVICE_INTEL_ICH4: case DEVICE_INTEL_ICH4:
...@@ -2849,10 +2849,10 @@ struct ich_reg_info { ...@@ -2849,10 +2849,10 @@ struct ich_reg_info {
unsigned int offset; unsigned int offset;
}; };
static unsigned int ich_codec_bits[3] = { static const unsigned int ich_codec_bits[3] = {
ICH_PCR, ICH_SCR, ICH_TCR ICH_PCR, ICH_SCR, ICH_TCR
}; };
static unsigned int sis_codec_bits[3] = { static const unsigned int sis_codec_bits[3] = {
ICH_PCR, ICH_SCR, ICH_SIS_TCR ICH_PCR, ICH_SCR, ICH_SIS_TCR
}; };
...@@ -2901,14 +2901,14 @@ static int snd_intel8x0_create(struct snd_card *card, ...@@ -2901,14 +2901,14 @@ static int snd_intel8x0_create(struct snd_card *card,
.dev_free = snd_intel8x0_dev_free, .dev_free = snd_intel8x0_dev_free,
}; };
static unsigned int bdbars[] = { static const unsigned int bdbars[] = {
3, /* DEVICE_INTEL */ 3, /* DEVICE_INTEL */
6, /* DEVICE_INTEL_ICH4 */ 6, /* DEVICE_INTEL_ICH4 */
3, /* DEVICE_SIS */ 3, /* DEVICE_SIS */
6, /* DEVICE_ALI */ 6, /* DEVICE_ALI */
4, /* DEVICE_NFORCE */ 4, /* DEVICE_NFORCE */
}; };
static struct ich_reg_info intel_regs[6] = { static const struct ich_reg_info intel_regs[6] = {
{ ICH_PIINT, 0 }, { ICH_PIINT, 0 },
{ ICH_POINT, 0x10 }, { ICH_POINT, 0x10 },
{ ICH_MCINT, 0x20 }, { ICH_MCINT, 0x20 },
...@@ -2916,13 +2916,13 @@ static int snd_intel8x0_create(struct snd_card *card, ...@@ -2916,13 +2916,13 @@ static int snd_intel8x0_create(struct snd_card *card,
{ ICH_P2INT, 0x50 }, { ICH_P2INT, 0x50 },
{ ICH_SPINT, 0x60 }, { ICH_SPINT, 0x60 },
}; };
static struct ich_reg_info nforce_regs[4] = { static const struct ich_reg_info nforce_regs[4] = {
{ ICH_PIINT, 0 }, { ICH_PIINT, 0 },
{ ICH_POINT, 0x10 }, { ICH_POINT, 0x10 },
{ ICH_MCINT, 0x20 }, { ICH_MCINT, 0x20 },
{ ICH_NVSPINT, 0x70 }, { ICH_NVSPINT, 0x70 },
}; };
static struct ich_reg_info ali_regs[6] = { static const struct ich_reg_info ali_regs[6] = {
{ ALI_INT_PCMIN, 0x40 }, { ALI_INT_PCMIN, 0x40 },
{ ALI_INT_PCMOUT, 0x50 }, { ALI_INT_PCMOUT, 0x50 },
{ ALI_INT_MICIN, 0x60 }, { ALI_INT_MICIN, 0x60 },
...@@ -2930,7 +2930,7 @@ static int snd_intel8x0_create(struct snd_card *card, ...@@ -2930,7 +2930,7 @@ static int snd_intel8x0_create(struct snd_card *card,
{ ALI_INT_SPDIFIN, 0xa0 }, { ALI_INT_SPDIFIN, 0xa0 },
{ ALI_INT_SPDIFOUT, 0xb0 }, { ALI_INT_SPDIFOUT, 0xb0 },
}; };
struct ich_reg_info *tbl; const struct ich_reg_info *tbl;
*r_intel8x0 = NULL; *r_intel8x0 = NULL;
......
...@@ -288,7 +288,7 @@ static inline void iaputword(struct intel8x0m *chip, u32 offset, u16 val) ...@@ -288,7 +288,7 @@ static inline void iaputword(struct intel8x0m *chip, u32 offset, u16 val)
/* return the GLOB_STA bit for the corresponding codec */ /* return the GLOB_STA bit for the corresponding codec */
static unsigned int get_ich_codec_bit(struct intel8x0m *chip, unsigned int codec) static unsigned int get_ich_codec_bit(struct intel8x0m *chip, unsigned int codec)
{ {
static unsigned int codec_bit[3] = { static const unsigned int codec_bit[3] = {
ICH_PCR, ICH_SCR, ICH_TCR ICH_PCR, ICH_SCR, ICH_TCR
}; };
if (snd_BUG_ON(codec >= 3)) if (snd_BUG_ON(codec >= 3))
...@@ -686,7 +686,7 @@ struct ich_pcm_table { ...@@ -686,7 +686,7 @@ struct ich_pcm_table {
}; };
static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device, static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device,
struct ich_pcm_table *rec) const struct ich_pcm_table *rec)
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
...@@ -724,7 +724,7 @@ static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device, ...@@ -724,7 +724,7 @@ static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device,
return 0; return 0;
} }
static struct ich_pcm_table intel_pcms[] = { static const struct ich_pcm_table intel_pcms[] = {
{ {
.suffix = "Modem", .suffix = "Modem",
.playback_ops = &snd_intel8x0m_playback_ops, .playback_ops = &snd_intel8x0m_playback_ops,
...@@ -737,7 +737,7 @@ static struct ich_pcm_table intel_pcms[] = { ...@@ -737,7 +737,7 @@ static struct ich_pcm_table intel_pcms[] = {
static int snd_intel8x0m_pcm(struct intel8x0m *chip) static int snd_intel8x0m_pcm(struct intel8x0m *chip)
{ {
int i, tblsize, device, err; int i, tblsize, device, err;
struct ich_pcm_table *tbl, *rec; const struct ich_pcm_table *tbl, *rec;
#if 1 #if 1
tbl = intel_pcms; tbl = intel_pcms;
...@@ -1082,11 +1082,11 @@ static int snd_intel8x0m_create(struct snd_card *card, ...@@ -1082,11 +1082,11 @@ static int snd_intel8x0m_create(struct snd_card *card,
static const struct snd_device_ops ops = { static const struct snd_device_ops ops = {
.dev_free = snd_intel8x0m_dev_free, .dev_free = snd_intel8x0m_dev_free,
}; };
static struct ich_reg_info intel_regs[2] = { static const struct ich_reg_info intel_regs[2] = {
{ ICH_MIINT, 0 }, { ICH_MIINT, 0 },
{ ICH_MOINT, 0x10 }, { ICH_MOINT, 0x10 },
}; };
struct ich_reg_info *tbl; const struct ich_reg_info *tbl;
*r_intel8x0m = NULL; *r_intel8x0m = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment