[alsa-devel] [PATCH 00/68] ALSA: Constifications, take #2
Hi,
this is the next series of patches for adding more const prefix allover the places. They do just nothing but adding cost.
Takashi
===
Takashi Iwai (68): ALSA: Allow const arrays for legacy resource management helpers ALSA: aoa: More constifications ALSA: hda/realtek - More constifications ALSA: dummy: More constifications ALSA: pcm: More constifications ALSA: seq: More constifications ALSA: vx: More constifications ALSA: intel8x0: More constifications ALSA: hda: More constifications ALSA: ac97: More constifications ALSA: usb-audio: More constifications ALSA: caiaq: More constifications ALSA: au88x0: More constifications ALSA: emu10k1: More constifications ALSA: riptide: More constifications ALSA: ice1712: More constifications ALSA: ppc: More constifications ALSA: hdsp: More constifications ALSA: hdspm: More constifications ALSA: rme9652: More constifications ALSA: emux: More constifications ALSA: usx2y: More constifications ALSA: pcxhr: More constifications ALSA: mixart: More constifications ALSA: ymfpci: More constifications ALSA: bcd2000: More constifications ALSA: nm256: More constifications ALSA: korg1212: More constifications ALSA: cs46xx: More constifications ALSA: ca0106: More constifications ALSA: ctxfi: More constifications ALSA: asihpi: More constifications ALSA: atiixp: More constifications ALSA: es1938: More constifications ALSA: es1968: More constifications ALSA: cmipci: More constifications ALSA: sparc: More constifications ALSA: info: More constifications ALSA: jack: More constification ALSA: oss: More constifications ALSA: rawmidi: More constification ALSA: opl3: More constifications ALSA: cmi8328: More constifications ALSA: cs423x: More constification ALSA: sb: More constifications ALSA: cmi8330: More constifications ALSA: es1688: More constifications ALSA: es18xx: More constifications ALSA: gus: More constifications ALSA: opti9xx: More constifications ALSA: wss: More constifications ALSA: sc6000: More constification ALSA: mts64: More constifications ALSA: aw2: More constifications ALSA: lx6464es: More constifications ALSA: arm: More constification ALSA: opl4: More constification ALSA: serial-u16550: More constification ALSA: ak4531: More constification ALSA: azt3328: More constification ALSA: cs4281: More constification ALSA: echoaudio: More constification ALSA: ens137x: More constification ALSA: fm801: More constification ALSA: via82xx: More constification ALSA: pdaudiocf: More constification ALSA: spi: More constification ALSA: sh: Fix compile warning wrt const
include/sound/initval.h | 6 +- sound/aoa/codecs/onyx.c | 4 +- sound/aoa/codecs/tas-basstreble.h | 4 +- sound/aoa/codecs/tas-gain-table.h | 2 +- sound/aoa/soundbus/i2sbus/core.c | 2 +- sound/arm/aaci.c | 2 +- sound/core/info.c | 4 +- sound/core/jack.c | 2 +- sound/core/oss/mixer_oss.c | 2 +- sound/core/oss/pcm_plugin.c | 2 +- sound/core/pcm.c | 12 ++-- sound/core/pcm_lib.c | 2 +- sound/core/pcm_misc.c | 5 +- sound/core/rawmidi.c | 2 +- sound/core/seq/oss/seq_oss_init.c | 4 +- sound/core/seq/seq_midi_emul.c | 6 +- sound/core/seq/seq_midi_event.c | 6 +- sound/drivers/dummy.c | 24 +++---- sound/drivers/mts64.c | 4 +- sound/drivers/opl3/opl3_drums.c | 2 +- sound/drivers/opl3/opl3_midi.c | 6 +- sound/drivers/opl4/opl4_synth.c | 2 +- sound/drivers/serial-u16550.c | 2 +- sound/drivers/vx/vx_cmd.c | 2 +- sound/drivers/vx/vx_core.c | 12 ++-- sound/drivers/vx/vx_hwdep.c | 2 +- sound/drivers/vx/vx_mixer.c | 2 +- sound/hda/hdac_device.c | 4 +- sound/hda/hdmi_chmap.c | 2 +- sound/hda/intel-nhlt.c | 2 +- sound/isa/cmi8328.c | 24 +++---- sound/isa/cmi8330.c | 8 +-- sound/isa/cs423x/cs4236_lib.c | 2 +- sound/isa/es1688/es1688.c | 6 +- sound/isa/es1688/es1688_lib.c | 4 +- sound/isa/es18xx.c | 10 +-- sound/isa/gus/gus_io.c | 2 +- sound/isa/gus/gus_main.c | 4 +- sound/isa/gus/gus_volume.c | 9 +-- sound/isa/gus/gusclassic.c | 6 +- sound/isa/gus/gusextreme.c | 10 +-- sound/isa/gus/gusmax.c | 6 +- sound/isa/gus/interwave.c | 10 +-- sound/isa/opti9xx/miro.c | 18 ++--- sound/isa/opti9xx/opti92x-ad1848.c | 18 ++--- sound/isa/sb/emu8000.c | 16 ++--- sound/isa/sb/jazz16.c | 10 +-- sound/isa/sb/sb16.c | 8 +-- sound/isa/sb/sb8.c | 2 +- sound/isa/sb/sb_mixer.c | 38 +++++----- sound/isa/sc6000.c | 4 +- sound/isa/wss/wss_lib.c | 6 +- sound/pci/ac97/ac97_codec.c | 10 +-- sound/pci/ac97/ac97_patch.c | 26 +++---- sound/pci/ac97/ac97_pcm.c | 4 +- sound/pci/ak4531_codec.c | 2 +- sound/pci/asihpi/asihpi.c | 4 +- sound/pci/asihpi/hpimsgx.c | 2 +- sound/pci/atiixp.c | 2 +- sound/pci/atiixp_modem.c | 2 +- sound/pci/au88x0/au88x0_core.c | 2 +- sound/pci/au88x0/au88x0_eq.c | 22 +++--- sound/pci/au88x0/au88x0_eqdata.c | 18 ++--- sound/pci/au88x0/au88x0_pcm.c | 4 +- sound/pci/aw2/aw2-tsl.c | 4 +- sound/pci/azt3328.c | 2 +- sound/pci/ca0106/ca0106_main.c | 4 +- sound/pci/ca0106/ca0106_mixer.c | 14 ++-- sound/pci/cmipci.c | 8 +-- sound/pci/cs4281.c | 2 +- sound/pci/cs46xx/cs46xx_lib.c | 2 +- sound/pci/cs46xx/dsp_spos.c | 4 +- sound/pci/cs46xx/dsp_spos_scb_lib.c | 6 +- sound/pci/ctxfi/ctdaio.c | 4 +- sound/pci/ctxfi/ctresource.c | 2 +- sound/pci/echoaudio/echoaudio.c | 2 +- sound/pci/emu10k1/emu10k1_main.c | 12 ++-- sound/pci/emu10k1/emufx.c | 14 ++-- sound/pci/emu10k1/emumixer.c | 28 ++++---- sound/pci/emu10k1/emuproc.c | 16 ++--- sound/pci/emu10k1/io.c | 4 +- sound/pci/ens1370.c | 2 +- sound/pci/es1938.c | 8 ++- sound/pci/es1968.c | 4 +- sound/pci/fm801.c | 2 +- sound/pci/hda/hda_codec.c | 6 +- sound/pci/hda/hda_eld.c | 6 +- sound/pci/hda/hda_intel.c | 8 +-- sound/pci/hda/hda_proc.c | 2 +- sound/pci/hda/hda_sysfs.c | 2 +- sound/pci/hda/patch_analog.c | 2 +- sound/pci/hda/patch_ca0132.c | 18 ++--- sound/pci/hda/patch_realtek.c | 118 ++++++++++++++++---------------- sound/pci/ice1712/aureon.c | 8 +-- sound/pci/ice1712/juli.c | 6 +- sound/pci/ice1712/maya44.c | 10 +-- sound/pci/ice1712/phase.c | 4 +- sound/pci/ice1712/pontis.c | 2 +- sound/pci/ice1712/prodigy192.c | 2 +- sound/pci/ice1712/prodigy_hifi.c | 16 ++--- sound/pci/ice1712/psc724.c | 2 +- sound/pci/ice1712/quartet.c | 8 +-- sound/pci/ice1712/se.c | 8 +-- sound/pci/ice1712/vt1720_mobo.c | 4 +- sound/pci/ice1712/wtm.c | 6 +- sound/pci/intel8x0.c | 28 ++++---- sound/pci/intel8x0m.c | 12 ++-- sound/pci/korg1212/korg1212.c | 8 +-- sound/pci/lx6464es/lx_core.c | 4 +- sound/pci/mixart/mixart_hwdep.c | 2 +- sound/pci/mixart/mixart_mixer.c | 4 +- sound/pci/nm256/nm256.c | 4 +- sound/pci/nm256/nm256_coef.c | 4 +- sound/pci/pcxhr/pcxhr.c | 2 +- sound/pci/pcxhr/pcxhr_core.c | 6 +- sound/pci/pcxhr/pcxhr_hwdep.c | 2 +- sound/pci/riptide/riptide.c | 60 ++++++++-------- sound/pci/rme9652/hdsp.c | 14 ++-- sound/pci/rme9652/hdspm.c | 66 +++++++++--------- sound/pci/rme9652/rme9652.c | 10 +-- sound/pci/via82xx.c | 2 +- sound/pci/vx222/vx222_ops.c | 4 +- sound/pci/ymfpci/ymfpci_main.c | 8 +-- sound/pcmcia/pdaudiocf/pdaudiocf_core.c | 2 +- sound/pcmcia/vx/vxp_ops.c | 2 +- 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 ++-- sound/sh/aica.c | 4 +- sound/sparc/cs4231.c | 4 +- sound/sparc/dbri.c | 2 +- sound/spi/at73c213.c | 2 +- sound/synth/emux/emux_nrpn.c | 4 +- sound/synth/emux/emux_synth.c | 10 +-- sound/synth/emux/soundfont.c | 8 +-- sound/usb/bcd2000/bcd2000.c | 4 +- sound/usb/caiaq/audio.c | 2 +- sound/usb/caiaq/control.c | 20 +++--- sound/usb/caiaq/input.c | 10 +-- sound/usb/mixer.c | 60 ++++++++-------- sound/usb/mixer_maps.c | 56 +++++++-------- sound/usb/mixer_quirks.c | 6 +- sound/usb/mixer_scarlett.c | 14 ++-- sound/usb/proc.c | 2 +- sound/usb/stream.c | 4 +- sound/usb/usx2y/usX2Yhwdep.c | 2 +- sound/usb/usx2y/usbusx2yaudio.c | 6 +- sound/usb/validate.c | 4 +- 150 files changed, 677 insertions(+), 669 deletions(-)
Declare the arrays passed to the helper functions for legacy resources (mostly for ISA drivers) as const, so that each caller can make its static data as const for minor optimizations, too.
Signed-off-by: Takashi Iwai tiwai@suse.de --- include/sound/initval.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/sound/initval.h b/include/sound/initval.h index 3ddae2b4177e..a1ff3b4865b4 100644 --- a/include/sound/initval.h +++ b/include/sound/initval.h @@ -37,7 +37,7 @@ #define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR
#ifdef SNDRV_LEGACY_FIND_FREE_IOPORT -static long snd_legacy_find_free_ioport(long *port_table, long size) +static long snd_legacy_find_free_ioport(const long *port_table, long size) { while (*port_table != -1) { if (request_region(*port_table, size, "ALSA test")) { @@ -58,7 +58,7 @@ static irqreturn_t snd_legacy_empty_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; }
-static int snd_legacy_find_free_irq(int *irq_table) +static int snd_legacy_find_free_irq(const int *irq_table) { while (*irq_table != -1) { if (!request_irq(*irq_table, snd_legacy_empty_irq_handler, @@ -74,7 +74,7 @@ static int snd_legacy_find_free_irq(int *irq_table) #endif
#ifdef SNDRV_LEGACY_FIND_FREE_DMA -static int snd_legacy_find_free_dma(int *dma_table) +static int snd_legacy_find_free_dma(const int *dma_table) { while (*dma_table != -1) { if (!request_dma(*dma_table, "ALSA Test DMA")) {
Apply const prefix at every place where appropriate: the static register tables, the volume tables and the callback tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/aoa/codecs/onyx.c | 4 ++-- sound/aoa/codecs/tas-basstreble.h | 4 ++-- sound/aoa/codecs/tas-gain-table.h | 2 +- sound/aoa/soundbus/i2sbus/core.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c index f85bc8a1e2a6..12028b3e2eee 100644 --- a/sound/aoa/codecs/onyx.c +++ b/sound/aoa/codecs/onyx.c @@ -543,7 +543,7 @@ static const struct snd_kcontrol_new onyx_spdif_ctrl = {
/* our registers */
-static u8 register_map[] = { +static const u8 register_map[] = { ONYX_REG_DAC_ATTEN_LEFT, ONYX_REG_DAC_ATTEN_RIGHT, ONYX_REG_CONTROL, @@ -559,7 +559,7 @@ static u8 register_map[] = { ONYX_REG_DIG_INFO4 };
-static u8 initial_values[ARRAY_SIZE(register_map)] = { +static const u8 initial_values[ARRAY_SIZE(register_map)] = { 0x80, 0x80, /* muted */ ONYX_MRST | ONYX_SRST, /* but handled specially! */ ONYX_MUTE_LEFT | ONYX_MUTE_RIGHT, diff --git a/sound/aoa/codecs/tas-basstreble.h b/sound/aoa/codecs/tas-basstreble.h index 770935af66af..14dc4e9eea73 100644 --- a/sound/aoa/codecs/tas-basstreble.h +++ b/sound/aoa/codecs/tas-basstreble.h @@ -13,7 +13,7 @@ #define TAS3004_TREBLE_ZERO 36 #define TAS3004_BASS_ZERO 36
-static u8 tas3004_treble_table[] = { +static const u8 tas3004_treble_table[] = { 150, /* -18 dB */ 149, 148, @@ -99,7 +99,7 @@ static inline u8 tas3004_treble(int idx) * I have also ignored completely differences of * +/- 1 */ -static s8 tas3004_bass_diff_to_treble[] = { +static const s8 tas3004_bass_diff_to_treble[] = { 2, /* 7 dB, offset 50 */ 2, 2, diff --git a/sound/aoa/codecs/tas-gain-table.h b/sound/aoa/codecs/tas-gain-table.h index 77b8e7dc55fd..c9ea01488181 100644 --- a/sound/aoa/codecs/tas-gain-table.h +++ b/sound/aoa/codecs/tas-gain-table.h @@ -27,7 +27,7 @@ int main() { * as easy as calculating * hwvalue = 1048576.0*exp(0.057564628*dB*2) * :) */ -static int tas_gaintable[] = { +static const int tas_gaintable[] = { 0x000000, /* -infinity dB */ 0x00014b, /* -70.0 dB */ 0x00015f, /* -69.5 dB */ diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c index 17df288fbe98..faf6b03131ee 100644 --- a/sound/aoa/soundbus/i2sbus/core.c +++ b/sound/aoa/soundbus/i2sbus/core.c @@ -160,7 +160,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, static const char *rnames[] = { "i2sbus: %pOFn (control)", "i2sbus: %pOFn (tx)", "i2sbus: %pOFn (rx)" }; - static irq_handler_t ints[] = { + static const irq_handler_t ints[] = { i2sbus_bus_intr, i2sbus_tx_intr, i2sbus_rx_intr
Apply const prefix to each coef table array.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/hda/patch_realtek.c | 118 +++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 59 deletions(-)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 76b603544f2a..73407b25a777 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -948,7 +948,7 @@ struct alc_codec_rename_pci_table { const char *name; };
-static struct alc_codec_rename_table rename_tbl[] = { +static const struct alc_codec_rename_table rename_tbl[] = { { 0x10ec0221, 0xf00f, 0x1003, "ALC231" }, { 0x10ec0269, 0xfff0, 0x3010, "ALC277" }, { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" }, @@ -969,7 +969,7 @@ static struct alc_codec_rename_table rename_tbl[] = { { } /* terminator */ };
-static struct alc_codec_rename_pci_table rename_pci_tbl[] = { +static const struct alc_codec_rename_pci_table rename_pci_tbl[] = { { 0x10ec0280, 0x1028, 0, "ALC3220" }, { 0x10ec0282, 0x1028, 0, "ALC3221" }, { 0x10ec0283, 0x1028, 0, "ALC3223" }, @@ -2995,7 +2995,7 @@ static void alc269_shutup(struct hda_codec *codec) alc_shutup_pins(codec); }
-static struct coef_fw alc282_coefs[] = { +static const struct coef_fw alc282_coefs[] = { WRITE_COEF(0x03, 0x0002), /* Power Down Control */ UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ WRITE_COEF(0x07, 0x0200), /* DMIC control */ @@ -3107,7 +3107,7 @@ static void alc282_shutup(struct hda_codec *codec) alc_write_coef_idx(codec, 0x78, coef78); }
-static struct coef_fw alc283_coefs[] = { +static const struct coef_fw alc283_coefs[] = { WRITE_COEF(0x03, 0x0002), /* Power Down Control */ UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ WRITE_COEF(0x07, 0x0200), /* DMIC control */ @@ -4183,7 +4183,7 @@ static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, } }
-static struct coef_fw alc225_pre_hsmode[] = { +static const struct coef_fw alc225_pre_hsmode[] = { UPDATE_COEF(0x4a, 1<<8, 0), UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), UPDATE_COEF(0x63, 3<<14, 3<<14), @@ -4196,7 +4196,7 @@ static struct coef_fw alc225_pre_hsmode[] = {
static void alc_headset_mode_unplugged(struct hda_codec *codec) { - static struct coef_fw coef0255[] = { + static const struct coef_fw coef0255[] = { WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */ WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */ UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ @@ -4204,7 +4204,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */ {} }; - static struct coef_fw coef0256[] = { + static const struct coef_fw coef0256[] = { WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */ WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */ WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */ @@ -4212,7 +4212,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ {} }; - static struct coef_fw coef0233[] = { + static const struct coef_fw coef0233[] = { WRITE_COEF(0x1b, 0x0c0b), WRITE_COEF(0x45, 0xc429), UPDATE_COEF(0x35, 0x4000, 0), @@ -4222,7 +4222,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) WRITE_COEF(0x32, 0x42a3), {} }; - static struct coef_fw coef0288[] = { + static const struct coef_fw coef0288[] = { UPDATE_COEF(0x4f, 0xfcc0, 0xc400), UPDATE_COEF(0x50, 0x2000, 0x2000), UPDATE_COEF(0x56, 0x0006, 0x0006), @@ -4230,18 +4230,18 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) UPDATE_COEF(0x67, 0x2000, 0), {} }; - static struct coef_fw coef0298[] = { + static const struct coef_fw coef0298[] = { UPDATE_COEF(0x19, 0x1300, 0x0300), {} }; - static struct coef_fw coef0292[] = { + static const struct coef_fw coef0292[] = { WRITE_COEF(0x76, 0x000e), WRITE_COEF(0x6c, 0x2400), WRITE_COEF(0x18, 0x7308), WRITE_COEF(0x6b, 0xc429), {} }; - static struct coef_fw coef0293[] = { + static const struct coef_fw coef0293[] = { UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */ UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */ UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */ @@ -4250,16 +4250,16 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */ {} }; - static struct coef_fw coef0668[] = { + static const struct coef_fw coef0668[] = { WRITE_COEF(0x15, 0x0d40), WRITE_COEF(0xb7, 0x802b), {} }; - static struct coef_fw coef0225[] = { + static const struct coef_fw coef0225[] = { UPDATE_COEF(0x63, 3<<14, 0), {} }; - static struct coef_fw coef0274[] = { + static const struct coef_fw coef0274[] = { UPDATE_COEF(0x4a, 0x0100, 0), UPDATE_COEFEX(0x57, 0x05, 0x4000, 0), UPDATE_COEF(0x6b, 0xf000, 0x5000), @@ -4324,25 +4324,25 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, hda_nid_t mic_pin) { - static struct coef_fw coef0255[] = { + static const struct coef_fw coef0255[] = { WRITE_COEFEX(0x57, 0x03, 0x8aa6), WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */ {} }; - static struct coef_fw coef0256[] = { + static const struct coef_fw coef0256[] = { UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/ WRITE_COEFEX(0x57, 0x03, 0x09a3), WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */ {} }; - static struct coef_fw coef0233[] = { + static const struct coef_fw coef0233[] = { UPDATE_COEF(0x35, 0, 1<<14), WRITE_COEF(0x06, 0x2100), WRITE_COEF(0x1a, 0x0021), WRITE_COEF(0x26, 0x008c), {} }; - static struct coef_fw coef0288[] = { + static const struct coef_fw coef0288[] = { UPDATE_COEF(0x4f, 0x00c0, 0), UPDATE_COEF(0x50, 0x2000, 0), UPDATE_COEF(0x56, 0x0006, 0), @@ -4351,30 +4351,30 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, UPDATE_COEF(0x67, 0x2000, 0x2000), {} }; - static struct coef_fw coef0292[] = { + static const struct coef_fw coef0292[] = { WRITE_COEF(0x19, 0xa208), WRITE_COEF(0x2e, 0xacf0), {} }; - static struct coef_fw coef0293[] = { + static const struct coef_fw coef0293[] = { UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */ UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */ UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ {} }; - static struct coef_fw coef0688[] = { + static const struct coef_fw coef0688[] = { WRITE_COEF(0xb7, 0x802b), WRITE_COEF(0xb5, 0x1040), UPDATE_COEF(0xc3, 0, 1<<12), {} }; - static struct coef_fw coef0225[] = { + static const struct coef_fw coef0225[] = { UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), UPDATE_COEF(0x4a, 3<<4, 2<<4), UPDATE_COEF(0x63, 3<<14, 0), {} }; - static struct coef_fw coef0274[] = { + static const struct coef_fw coef0274[] = { UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000), UPDATE_COEF(0x4a, 0x0010, 0), UPDATE_COEF(0x6b, 0xf000, 0), @@ -4460,7 +4460,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
static void alc_headset_mode_default(struct hda_codec *codec) { - static struct coef_fw coef0225[] = { + static const struct coef_fw coef0225[] = { UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10), UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10), UPDATE_COEF(0x49, 3<<8, 0<<8), @@ -4469,14 +4469,14 @@ static void alc_headset_mode_default(struct hda_codec *codec) UPDATE_COEF(0x67, 0xf000, 0x3000), {} }; - static struct coef_fw coef0255[] = { + static const struct coef_fw coef0255[] = { WRITE_COEF(0x45, 0xc089), WRITE_COEF(0x45, 0xc489), WRITE_COEFEX(0x57, 0x03, 0x8ea6), WRITE_COEF(0x49, 0x0049), {} }; - static struct coef_fw coef0256[] = { + static const struct coef_fw coef0256[] = { WRITE_COEF(0x45, 0xc489), WRITE_COEFEX(0x57, 0x03, 0x0da3), WRITE_COEF(0x49, 0x0049), @@ -4484,12 +4484,12 @@ static void alc_headset_mode_default(struct hda_codec *codec) WRITE_COEF(0x06, 0x6100), {} }; - static struct coef_fw coef0233[] = { + static const struct coef_fw coef0233[] = { WRITE_COEF(0x06, 0x2100), WRITE_COEF(0x32, 0x4ea3), {} }; - static struct coef_fw coef0288[] = { + static const struct coef_fw coef0288[] = { UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */ UPDATE_COEF(0x50, 0x2000, 0x2000), UPDATE_COEF(0x56, 0x0006, 0x0006), @@ -4497,26 +4497,26 @@ static void alc_headset_mode_default(struct hda_codec *codec) UPDATE_COEF(0x67, 0x2000, 0), {} }; - static struct coef_fw coef0292[] = { + static const struct coef_fw coef0292[] = { WRITE_COEF(0x76, 0x000e), WRITE_COEF(0x6c, 0x2400), WRITE_COEF(0x6b, 0xc429), WRITE_COEF(0x18, 0x7308), {} }; - static struct coef_fw coef0293[] = { + static const struct coef_fw coef0293[] = { UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */ WRITE_COEF(0x45, 0xC429), /* Set to TRS type */ UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ {} }; - static struct coef_fw coef0688[] = { + static const struct coef_fw coef0688[] = { WRITE_COEF(0x11, 0x0041), WRITE_COEF(0x15, 0x0d40), WRITE_COEF(0xb7, 0x802b), {} }; - static struct coef_fw coef0274[] = { + static const struct coef_fw coef0274[] = { WRITE_COEF(0x45, 0x4289), UPDATE_COEF(0x4a, 0x0010, 0x0010), UPDATE_COEF(0x6b, 0x0f00, 0), @@ -4579,53 +4579,53 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) { int val;
- static struct coef_fw coef0255[] = { + static const struct coef_fw coef0255[] = { WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */ WRITE_COEF(0x1b, 0x0c2b), WRITE_COEFEX(0x57, 0x03, 0x8ea6), {} }; - static struct coef_fw coef0256[] = { + static const struct coef_fw coef0256[] = { WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */ WRITE_COEF(0x1b, 0x0e6b), {} }; - static struct coef_fw coef0233[] = { + static const struct coef_fw coef0233[] = { WRITE_COEF(0x45, 0xd429), WRITE_COEF(0x1b, 0x0c2b), WRITE_COEF(0x32, 0x4ea3), {} }; - static struct coef_fw coef0288[] = { + static const struct coef_fw coef0288[] = { UPDATE_COEF(0x50, 0x2000, 0x2000), UPDATE_COEF(0x56, 0x0006, 0x0006), UPDATE_COEF(0x66, 0x0008, 0), UPDATE_COEF(0x67, 0x2000, 0), {} }; - static struct coef_fw coef0292[] = { + static const struct coef_fw coef0292[] = { WRITE_COEF(0x6b, 0xd429), WRITE_COEF(0x76, 0x0008), WRITE_COEF(0x18, 0x7388), {} }; - static struct coef_fw coef0293[] = { + static const struct coef_fw coef0293[] = { WRITE_COEF(0x45, 0xd429), /* Set to ctia type */ UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ {} }; - static struct coef_fw coef0688[] = { + static const struct coef_fw coef0688[] = { WRITE_COEF(0x11, 0x0001), WRITE_COEF(0x15, 0x0d60), WRITE_COEF(0xc3, 0x0000), {} }; - static struct coef_fw coef0225_1[] = { + static const struct coef_fw coef0225_1[] = { UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10), UPDATE_COEF(0x63, 3<<14, 2<<14), {} }; - static struct coef_fw coef0225_2[] = { + static const struct coef_fw coef0225_2[] = { UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10), UPDATE_COEF(0x63, 3<<14, 1<<14), {} @@ -4697,48 +4697,48 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) /* Nokia type */ static void alc_headset_mode_omtp(struct hda_codec *codec) { - static struct coef_fw coef0255[] = { + static const struct coef_fw coef0255[] = { WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */ WRITE_COEF(0x1b, 0x0c2b), WRITE_COEFEX(0x57, 0x03, 0x8ea6), {} }; - static struct coef_fw coef0256[] = { + static const struct coef_fw coef0256[] = { WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */ WRITE_COEF(0x1b, 0x0e6b), {} }; - static struct coef_fw coef0233[] = { + static const struct coef_fw coef0233[] = { WRITE_COEF(0x45, 0xe429), WRITE_COEF(0x1b, 0x0c2b), WRITE_COEF(0x32, 0x4ea3), {} }; - static struct coef_fw coef0288[] = { + static const struct coef_fw coef0288[] = { UPDATE_COEF(0x50, 0x2000, 0x2000), UPDATE_COEF(0x56, 0x0006, 0x0006), UPDATE_COEF(0x66, 0x0008, 0), UPDATE_COEF(0x67, 0x2000, 0), {} }; - static struct coef_fw coef0292[] = { + static const struct coef_fw coef0292[] = { WRITE_COEF(0x6b, 0xe429), WRITE_COEF(0x76, 0x0008), WRITE_COEF(0x18, 0x7388), {} }; - static struct coef_fw coef0293[] = { + static const struct coef_fw coef0293[] = { WRITE_COEF(0x45, 0xe429), /* Set to omtp type */ UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ {} }; - static struct coef_fw coef0688[] = { + static const struct coef_fw coef0688[] = { WRITE_COEF(0x11, 0x0001), WRITE_COEF(0x15, 0x0d50), WRITE_COEF(0xc3, 0x0000), {} }; - static struct coef_fw coef0225[] = { + static const struct coef_fw coef0225[] = { UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10), UPDATE_COEF(0x63, 3<<14, 2<<14), {} @@ -4798,17 +4798,17 @@ static void alc_determine_headset_type(struct hda_codec *codec) int val; bool is_ctia = false; struct alc_spec *spec = codec->spec; - static struct coef_fw coef0255[] = { + static const struct coef_fw coef0255[] = { WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/ WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref conteol) */ {} }; - static struct coef_fw coef0288[] = { + static const struct coef_fw coef0288[] = { UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */ {} }; - static struct coef_fw coef0298[] = { + static const struct coef_fw coef0298[] = { UPDATE_COEF(0x50, 0x2000, 0x2000), UPDATE_COEF(0x56, 0x0006, 0x0006), UPDATE_COEF(0x66, 0x0008, 0), @@ -4816,19 +4816,19 @@ static void alc_determine_headset_type(struct hda_codec *codec) UPDATE_COEF(0x19, 0x1300, 0x1300), {} }; - static struct coef_fw coef0293[] = { + static const struct coef_fw coef0293[] = { UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */ WRITE_COEF(0x45, 0xD429), /* Set to ctia type */ {} }; - static struct coef_fw coef0688[] = { + static const struct coef_fw coef0688[] = { WRITE_COEF(0x11, 0x0001), WRITE_COEF(0xb7, 0x802b), WRITE_COEF(0x15, 0x0d60), WRITE_COEF(0xc3, 0x0c00), {} }; - static struct coef_fw coef0274[] = { + static const struct coef_fw coef0274[] = { UPDATE_COEF(0x4a, 0x0010, 0), UPDATE_COEF(0x4a, 0x8000, 0), WRITE_COEF(0x45, 0xd289), @@ -5115,7 +5115,7 @@ static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, static void alc255_set_default_jack_type(struct hda_codec *codec) { /* Set to iphone type */ - static struct coef_fw alc255fw[] = { + static const struct coef_fw alc255fw[] = { WRITE_COEF(0x1b, 0x880b), WRITE_COEF(0x45, 0xd089), WRITE_COEF(0x1b, 0x080b), @@ -5123,7 +5123,7 @@ static void alc255_set_default_jack_type(struct hda_codec *codec) WRITE_COEF(0x1b, 0x0c0b), {} }; - static struct coef_fw alc256fw[] = { + static const struct coef_fw alc256fw[] = { WRITE_COEF(0x1b, 0x884b), WRITE_COEF(0x45, 0xd089), WRITE_COEF(0x1b, 0x084b), @@ -8482,7 +8482,7 @@ static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, } }
-static struct coef_fw alc668_coefs[] = { +static const struct coef_fw alc668_coefs[] = { WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
Apply const prefix to every possible place: mostly for declaring the dummy hardware models.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/dummy.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 46fa60e7f722..da0bd8960b3c 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -117,7 +117,7 @@ struct dummy_model {
struct snd_dummy { struct snd_card *card; - struct dummy_model *model; + const struct dummy_model *model; struct snd_pcm *pcm; struct snd_pcm_hardware pcm_hw; spinlock_t mixer_lock; @@ -144,13 +144,13 @@ static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime) return 0; }
-static struct dummy_model model_emu10k1 = { +static const struct dummy_model model_emu10k1 = { .name = "emu10k1", .playback_constraints = emu10k1_playback_constraints, .buffer_bytes_max = 128 * 1024, };
-static struct dummy_model model_rme9652 = { +static const struct dummy_model model_rme9652 = { .name = "rme9652", .buffer_bytes_max = 26 * 64 * 1024, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -160,7 +160,7 @@ static struct dummy_model model_rme9652 = { .periods_max = 2, };
-static struct dummy_model model_ice1712 = { +static const struct dummy_model model_ice1712 = { .name = "ice1712", .buffer_bytes_max = 256 * 1024, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -170,7 +170,7 @@ static struct dummy_model model_ice1712 = { .periods_max = 1024, };
-static struct dummy_model model_uda1341 = { +static const struct dummy_model model_uda1341 = { .name = "uda1341", .buffer_bytes_max = 16380, .formats = SNDRV_PCM_FMTBIT_S16_LE, @@ -180,7 +180,7 @@ static struct dummy_model model_uda1341 = { .periods_max = 255, };
-static struct dummy_model model_ac97 = { +static const struct dummy_model model_ac97 = { .name = "ac97", .formats = SNDRV_PCM_FMTBIT_S16_LE, .channels_min = 2, @@ -190,7 +190,7 @@ static struct dummy_model model_ac97 = { .rate_max = 48000, };
-static struct dummy_model model_ca0106 = { +static const struct dummy_model model_ca0106 = { .name = "ca0106", .formats = SNDRV_PCM_FMTBIT_S16_LE, .buffer_bytes_max = ((65536-64)*8), @@ -204,7 +204,7 @@ static struct dummy_model model_ca0106 = { .rate_max = 192000, };
-static struct dummy_model *dummy_models[] = { +static const struct dummy_model *dummy_models[] = { &model_emu10k1, &model_rme9652, &model_ice1712, @@ -535,7 +535,7 @@ static int dummy_pcm_hw_params(struct snd_pcm_substream *substream, static int dummy_pcm_open(struct snd_pcm_substream *substream) { struct snd_dummy *dummy = snd_pcm_substream_chip(substream); - struct dummy_model *model = dummy->model; + const struct dummy_model *model = dummy->model; struct snd_pcm_runtime *runtime = substream->runtime; const struct dummy_timer_ops *ops; int err; @@ -912,7 +912,7 @@ static void print_formats(struct snd_dummy *dummy, static void print_rates(struct snd_dummy *dummy, struct snd_info_buffer *buffer) { - static int rates[] = { + static const int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, }; @@ -944,7 +944,7 @@ struct dummy_hw_field { .offset = offsetof(struct snd_pcm_hardware, item), \ .size = sizeof(dummy_pcm_hardware.item) }
-static struct dummy_hw_field fields[] = { +static const struct dummy_hw_field fields[] = { FIELD_ENTRY(formats, "%#llx"), FIELD_ENTRY(rates, "%#x"), FIELD_ENTRY(rate_min, "%d"), @@ -1022,7 +1022,7 @@ static int snd_dummy_probe(struct platform_device *devptr) { struct snd_card *card; struct snd_dummy *dummy; - struct dummy_model *m = NULL, **mdl; + const struct dummy_model *m = NULL, **mdl; int idx, err; int dev = devptr->id;
Apply const prefix to more possible places: the string tables for PCM format and co, the table for the PCM type helpers, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/pcm.c | 12 ++++++------ sound/core/pcm_lib.c | 2 +- sound/core/pcm_misc.c | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index a0f704b72a78..a141a301369f 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -163,7 +163,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
#define FORMAT(v) [SNDRV_PCM_FORMAT_##v] = #v
-static char *snd_pcm_format_names[] = { +static const char * const snd_pcm_format_names[] = { FORMAT(S8), FORMAT(U8), FORMAT(S16_LE), @@ -237,12 +237,12 @@ EXPORT_SYMBOL_GPL(snd_pcm_format_name); #define START(v) [SNDRV_PCM_START_##v] = #v #define SUBFORMAT(v) [SNDRV_PCM_SUBFORMAT_##v] = #v
-static char *snd_pcm_stream_names[] = { +static const char * const snd_pcm_stream_names[] = { STREAM(PLAYBACK), STREAM(CAPTURE), };
-static char *snd_pcm_state_names[] = { +static const char * const snd_pcm_state_names[] = { STATE(OPEN), STATE(SETUP), STATE(PREPARED), @@ -253,7 +253,7 @@ static char *snd_pcm_state_names[] = { STATE(SUSPENDED), };
-static char *snd_pcm_access_names[] = { +static const char * const snd_pcm_access_names[] = { ACCESS(MMAP_INTERLEAVED), ACCESS(MMAP_NONINTERLEAVED), ACCESS(MMAP_COMPLEX), @@ -261,11 +261,11 @@ static char *snd_pcm_access_names[] = { ACCESS(RW_NONINTERLEAVED), };
-static char *snd_pcm_subformat_names[] = { +static const char * const snd_pcm_subformat_names[] = { SUBFORMAT(STD), };
-static char *snd_pcm_tstamp_mode_names[] = { +static const char * const snd_pcm_tstamp_mode_names[] = { TSTAMP(NONE), TSTAMP(ENABLE), }; diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 18f498ab7af1..872a852de75c 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1452,7 +1452,7 @@ EXPORT_SYMBOL(snd_pcm_hw_constraint_step);
static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { - static unsigned int pow2_sizes[] = { + static const unsigned int pow2_sizes[] = { 1<<0, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7, 1<<8, 1<<9, 1<<10, 1<<11, 1<<12, 1<<13, 1<<14, 1<<15, 1<<16, 1<<17, 1<<18, 1<<19, 1<<20, 1<<21, 1<<22, 1<<23, diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c index c4eb561d2008..a6a541511534 100644 --- a/sound/core/pcm_misc.c +++ b/sound/core/pcm_misc.c @@ -42,7 +42,7 @@ struct pcm_format_data { /* we do lots of calculations on snd_pcm_format_t; shut up sparse */ #define INT __force int
-static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = { +static const struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = { [SNDRV_PCM_FORMAT_S8] = { .width = 8, .phys = 8, .le = -1, .signd = 1, .silence = {}, @@ -415,7 +415,8 @@ EXPORT_SYMBOL(snd_pcm_format_silence_64); int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int samples) { int width; - unsigned char *dst, *pat; + unsigned char *dst; + const unsigned char *pat;
if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST) return -EINVAL;
Apply const prefix to the remaining sequencer code: the static tables for MIDI macros, RPN/NRPN, and some strings.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/seq/oss/seq_oss_init.c | 4 ++-- sound/core/seq/seq_midi_emul.c | 6 +++--- sound/core/seq/seq_midi_event.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index 6dc94efc19c9..4534a154b8c8 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c @@ -460,10 +460,10 @@ enabled_str(int bool) return bool ? "enabled" : "disabled"; }
-static char * +static const char * filemode_str(int val) { - static char *str[] = { + static const char * const str[] = { "none", "read", "write", "read/write", }; return str[val & SNDRV_SEQ_OSS_FILE_ACMODE]; diff --git a/sound/core/seq/seq_midi_emul.c b/sound/core/seq/seq_midi_emul.c index 536ccf48ee72..198f285594e3 100644 --- a/sound/core/seq/seq_midi_emul.c +++ b/sound/core/seq/seq_midi_emul.c @@ -479,11 +479,11 @@ sysex(const struct snd_midi_op *ops, void *private, unsigned char *buf, int len, struct snd_midi_channel_set *chset) { /* GM on */ - static unsigned char gm_on_macro[] = { + static const unsigned char gm_on_macro[] = { 0x7e,0x7f,0x09,0x01, }; /* XG on */ - static unsigned char xg_on_macro[] = { + static const unsigned char xg_on_macro[] = { 0x43,0x10,0x4c,0x00,0x00,0x7e,0x00, }; /* GS prefix @@ -492,7 +492,7 @@ sysex(const struct snd_midi_op *ops, void *private, unsigned char *buf, int len, * chorus mode: XX=0x01, YY=0x38, ZZ=0-7 * master vol: XX=0x00, YY=0x04, ZZ=0-127 */ - static unsigned char gs_pfx_macro[] = { + static const unsigned char gs_pfx_macro[] = { 0x41,0x10,0x42,0x12,0x40,/*XX,YY,ZZ*/ };
diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c index ae0308d4ace3..7511462fe071 100644 --- a/sound/core/seq/seq_midi_event.c +++ b/sound/core/seq/seq_midi_event.c @@ -422,12 +422,12 @@ static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf, int count, struct snd_seq_event *ev) { unsigned char cmd; - char *cbytes; - static char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB, + const char *cbytes; + static const char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB, MIDI_CTL_NONREG_PARM_NUM_LSB, MIDI_CTL_MSB_DATA_ENTRY, MIDI_CTL_LSB_DATA_ENTRY }; - static char cbytes_rpn[4] = { MIDI_CTL_REGIST_PARM_NUM_MSB, + static const char cbytes_rpn[4] = { MIDI_CTL_REGIST_PARM_NUM_MSB, MIDI_CTL_REGIST_PARM_NUM_LSB, MIDI_CTL_MSB_DATA_ENTRY, MIDI_CTL_LSB_DATA_ENTRY };
Apply const prefix to every possible place: the static tables for DSP commands, the string tables, and register/offset tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/vx/vx_cmd.c | 2 +- sound/drivers/vx/vx_core.c | 12 ++++++------ sound/drivers/vx/vx_hwdep.c | 2 +- sound/drivers/vx/vx_mixer.c | 2 +- sound/pci/vx222/vx222_ops.c | 4 ++-- sound/pcmcia/vx/vxp_ops.c | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/drivers/vx/vx_cmd.c b/sound/drivers/vx/vx_cmd.c index 77ae59aef4e0..b0970a04883e 100644 --- a/sound/drivers/vx/vx_cmd.c +++ b/sound/drivers/vx/vx_cmd.c @@ -15,7 +15,7 @@ /* * Array of DSP commands */ -static struct vx_cmd_info vx_dsp_cmds[] = { +static const struct vx_cmd_info vx_dsp_cmds[] = { [CMD_VERSION] = { 0x010000, 2, RMH_SSIZE_FIXED, 1 }, [CMD_SUPPORTED] = { 0x020000, 1, RMH_SSIZE_FIXED, 2 }, [CMD_TEST_IT] = { 0x040000, 1, RMH_SSIZE_FIXED, 1 }, diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c index dd35de3f2434..ffab0400d7fb 100644 --- a/sound/drivers/vx/vx_core.c +++ b/sound/drivers/vx/vx_core.c @@ -39,7 +39,7 @@ MODULE_LICENSE("GPL"); int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time) { unsigned long end_time = jiffies + (time * HZ + 999) / 1000; - static char *reg_names[VX_REG_MAX] = { + static const char * const reg_names[VX_REG_MAX] = { "ICR", "CVR", "ISR", "IVR", "RXH", "RXM", "RXL", "DMA", "CDSP", "RFREQ", "RUER/V2", "DATA", "MEMIRQ", "ACQ", "BIT0", "BIT1", "MIC0", "MIC1", "MIC2", @@ -588,11 +588,11 @@ static void vx_reset_board(struct vx_core *chip, int cold_reset) static void vx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct vx_core *chip = entry->private_data; - static char *audio_src_vxp[] = { "Line", "Mic", "Digital" }; - static char *audio_src_vx2[] = { "Analog", "Analog", "Digital" }; - static char *clock_mode[] = { "Auto", "Internal", "External" }; - static char *clock_src[] = { "Internal", "External" }; - static char *uer_type[] = { "Consumer", "Professional", "Not Present" }; + static const char * const audio_src_vxp[] = { "Line", "Mic", "Digital" }; + static const char * const audio_src_vx2[] = { "Analog", "Analog", "Digital" }; + static const char * const clock_mode[] = { "Auto", "Internal", "External" }; + static const char * const clock_src[] = { "Internal", "External" }; + static const char * const uer_type[] = { "Consumer", "Professional", "Not Present" }; snd_iprintf(buffer, "%s\n", chip->card->longname); snd_iprintf(buffer, "Xilinx Firmware: %s\n", diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c index f0d31b0a178e..01baa6d872e9 100644 --- a/sound/drivers/vx/vx_hwdep.c +++ b/sound/drivers/vx/vx_hwdep.c @@ -32,7 +32,7 @@ MODULE_FIRMWARE("vx/l_1_vp4.d56");
int snd_vx_setup_firmware(struct vx_core *chip) { - static char *fw_files[VX_TYPE_NUMS][4] = { + static const char * const fw_files[VX_TYPE_NUMS][4] = { [VX_TYPE_BOARD] = { NULL, "x1_1_vx2.xlx", "bd56002.boot", "l_1_vx2.d56", }, diff --git a/sound/drivers/vx/vx_mixer.c b/sound/drivers/vx/vx_mixer.c index b17c67b14d59..13099f8c84d6 100644 --- a/sound/drivers/vx/vx_mixer.c +++ b/sound/drivers/vx/vx_mixer.c @@ -961,7 +961,7 @@ int snd_vx_mixer_new(struct vx_core *chip) return err; /* VU, peak, saturation meters */ for (c = 0; c < 2; c++) { - static char *dir[2] = { "Output", "Input" }; + static const char * const dir[2] = { "Output", "Input" }; for (i = 0; i < chip->hw->num_ins; i++) { int val = (i * 2) | (c << 8); if (c == 1) { diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c index 6245240d8768..23d4338dc553 100644 --- a/sound/pci/vx222/vx222_ops.c +++ b/sound/pci/vx222/vx222_ops.c @@ -19,7 +19,7 @@ #include "vx222.h"
-static int vx2_reg_offset[VX_REG_MAX] = { +static const int vx2_reg_offset[VX_REG_MAX] = { [VX_ICR] = 0x00, [VX_CVR] = 0x04, [VX_ISR] = 0x08, @@ -45,7 +45,7 @@ static int vx2_reg_offset[VX_REG_MAX] = { [VX_GPIOC] = 0x54, // VX_GPIOC (new with PLX9030) };
-static int vx2_reg_index[VX_REG_MAX] = { +static const int vx2_reg_index[VX_REG_MAX] = { [VX_ICR] = 1, [VX_CVR] = 1, [VX_ISR] = 1, diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c index f7cf707d315f..45eeb0f57d59 100644 --- a/sound/pcmcia/vx/vxp_ops.c +++ b/sound/pcmcia/vx/vxp_ops.c @@ -15,7 +15,7 @@ #include "vxpocket.h"
-static int vxp_reg_offset[VX_REG_MAX] = { +static const int vxp_reg_offset[VX_REG_MAX] = { [VX_ICR] = 0x00, // ICR [VX_CVR] = 0x01, // CVR [VX_ISR] = 0x02, // ISR
Apply const prefix to more places: the static tables for PCM definitions, the register tables, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/intel8x0.c | 28 ++++++++++++++-------------- sound/pci/intel8x0m.c | 12 ++++++------ 2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 5bdd25815fc7..1781a1c081c3 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -393,7 +393,7 @@ struct intel8x0 { struct snd_ac97 *ac97[3]; unsigned int ac97_sdin[3]; unsigned int max_codecs, ncodecs; - unsigned int *codec_bit; + const unsigned int *codec_bit; unsigned int codec_isr_bits; unsigned int codec_ready_bits;
@@ -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 ichdev *ichdev = get_ichdev(substream); unsigned long port = ichdev->reg_offset; - static int fiforeg[] = { + static const int fiforeg[] = { ICHREG(ALI_FIFOCR1), ICHREG(ALI_FIFOCR2), ICHREG(ALI_FIFOCR3) }; unsigned int val, fifo; @@ -1443,7 +1443,7 @@ struct ich_pcm_table { ((chip)->fix_nocache ? SNDRV_DMA_TYPE_DEV_UC : SNDRV_DMA_TYPE_DEV)
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; int err; @@ -1498,7 +1498,7 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device, return 0; }
-static struct ich_pcm_table intel_pcms[] = { +static const struct ich_pcm_table intel_pcms[] = { { .playback_ops = &snd_intel8x0_playback_ops, .capture_ops = &snd_intel8x0_capture_ops, @@ -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, .capture_ops = &snd_intel8x0_capture_ops, @@ -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, .capture_ops = &snd_intel8x0_ali_capture_ops, @@ -1593,7 +1593,7 @@ static struct ich_pcm_table ali_pcms[] = { static int snd_intel8x0_pcm(struct intel8x0 *chip) { int i, tblsize, device, err; - struct ich_pcm_table *tbl, *rec; + const struct ich_pcm_table *tbl, *rec;
switch (chip->device_type) { case DEVICE_INTEL_ICH4: @@ -2849,10 +2849,10 @@ struct ich_reg_info { unsigned int offset; };
-static unsigned int ich_codec_bits[3] = { +static const unsigned int ich_codec_bits[3] = { 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 };
@@ -2901,14 +2901,14 @@ static int snd_intel8x0_create(struct snd_card *card, .dev_free = snd_intel8x0_dev_free, };
- static unsigned int bdbars[] = { + static const unsigned int bdbars[] = { 3, /* DEVICE_INTEL */ 6, /* DEVICE_INTEL_ICH4 */ 3, /* DEVICE_SIS */ 6, /* DEVICE_ALI */ 4, /* DEVICE_NFORCE */ }; - static struct ich_reg_info intel_regs[6] = { + static const struct ich_reg_info intel_regs[6] = { { ICH_PIINT, 0 }, { ICH_POINT, 0x10 }, { ICH_MCINT, 0x20 }, @@ -2916,13 +2916,13 @@ static int snd_intel8x0_create(struct snd_card *card, { ICH_P2INT, 0x50 }, { ICH_SPINT, 0x60 }, }; - static struct ich_reg_info nforce_regs[4] = { + static const struct ich_reg_info nforce_regs[4] = { { ICH_PIINT, 0 }, { ICH_POINT, 0x10 }, { ICH_MCINT, 0x20 }, { 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_PCMOUT, 0x50 }, { ALI_INT_MICIN, 0x60 }, @@ -2930,7 +2930,7 @@ static int snd_intel8x0_create(struct snd_card *card, { ALI_INT_SPDIFIN, 0xa0 }, { ALI_INT_SPDIFOUT, 0xb0 }, }; - struct ich_reg_info *tbl; + const struct ich_reg_info *tbl;
*r_intel8x0 = NULL;
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 74d45b9a1571..1b7df0c4e57c 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -288,7 +288,7 @@ static inline void iaputword(struct intel8x0m *chip, u32 offset, u16 val) /* 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 codec_bit[3] = { + static const unsigned int codec_bit[3] = { ICH_PCR, ICH_SCR, ICH_TCR }; if (snd_BUG_ON(codec >= 3)) @@ -686,7 +686,7 @@ struct ich_pcm_table { };
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; int err; @@ -724,7 +724,7 @@ static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device, return 0; }
-static struct ich_pcm_table intel_pcms[] = { +static const struct ich_pcm_table intel_pcms[] = { { .suffix = "Modem", .playback_ops = &snd_intel8x0m_playback_ops, @@ -737,7 +737,7 @@ static struct ich_pcm_table intel_pcms[] = { static int snd_intel8x0m_pcm(struct intel8x0m *chip) { int i, tblsize, device, err; - struct ich_pcm_table *tbl, *rec; + const struct ich_pcm_table *tbl, *rec;
#if 1 tbl = intel_pcms; @@ -1082,11 +1082,11 @@ static int snd_intel8x0m_create(struct snd_card *card, static const struct snd_device_ops ops = { .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_MOINT, 0x10 }, }; - struct ich_reg_info *tbl; + const struct ich_reg_info *tbl;
*r_intel8x0m = NULL;
Apply const prefix to the remaining possible places: the string tables, the rate tables, the verb tables, the index tables, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/hda/hdac_device.c | 4 ++-- sound/hda/hdmi_chmap.c | 2 +- sound/hda/intel-nhlt.c | 2 +- sound/pci/hda/hda_codec.c | 6 +++--- sound/pci/hda/hda_eld.c | 6 +++--- sound/pci/hda/hda_intel.c | 8 ++++---- sound/pci/hda/hda_proc.c | 2 +- sound/pci/hda/hda_sysfs.c | 2 +- sound/pci/hda/patch_analog.c | 2 +- sound/pci/hda/patch_ca0132.c | 18 +++++++++--------- 10 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index 9f3e37511408..b4f8725f5ddf 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -637,7 +637,7 @@ struct hda_vendor_id { const char *name; };
-static struct hda_vendor_id hda_vendor_ids[] = { +static const struct hda_vendor_id hda_vendor_ids[] = { { 0x1002, "ATI" }, { 0x1013, "Cirrus Logic" }, { 0x1057, "Motorola" }, @@ -692,7 +692,7 @@ struct hda_rate_tbl { (AC_FMT_BASE_##base##K | (((mult) - 1) << AC_FMT_MULT_SHIFT) | \ (((div) - 1) << AC_FMT_DIV_SHIFT))
-static struct hda_rate_tbl rate_bits[] = { +static const struct hda_rate_tbl rate_bits[] = { /* rate in Hz, ALSA rate bitmask, HDA format value */
/* autodetected value used in snd_hda_query_supported_pcm */ diff --git a/sound/hda/hdmi_chmap.c b/sound/hda/hdmi_chmap.c index 886cb7811bd6..5fd6d575e123 100644 --- a/sound/hda/hdmi_chmap.c +++ b/sound/hda/hdmi_chmap.c @@ -59,7 +59,7 @@ static const char * const cea_speaker_allocation_names[] = { /* * ELD SA bits in the CEA Speaker Allocation data block */ -static int eld_speaker_allocation_bits[] = { +static const int eld_speaker_allocation_bits[] = { [0] = FL | FR, [1] = LFE, [2] = FC, diff --git a/sound/hda/intel-nhlt.c b/sound/hda/intel-nhlt.c index 097ff6c10099..99a23fe7fab9 100644 --- a/sound/hda/intel-nhlt.c +++ b/sound/hda/intel-nhlt.c @@ -7,7 +7,7 @@ #define NHLT_ACPI_HEADER_SIG "NHLT"
/* Unique identification for getting NHLT blobs */ -static guid_t osc_guid = +static const guid_t osc_guid = GUID_INIT(0xA69F886E, 0x6CEB, 0x4594, 0xA4, 0x1F, 0x7B, 0x5D, 0xCE, 0x24, 0xC5, 0x53);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index d039eeec080f..4377b2aba835 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3201,7 +3201,7 @@ static int get_empty_pcm_device(struct hda_bus *bus, unsigned int type) /* assigned to static slots up to dev#10; if more needed, assign * the later slot dynamically (when CONFIG_SND_DYNAMIC_MINORS=y) */ - static int audio_idx[HDA_PCM_NTYPES][5] = { + static const int audio_idx[HDA_PCM_NTYPES][5] = { [HDA_PCM_TYPE_AUDIO] = { 0, 2, 4, 5, -1 }, [HDA_PCM_TYPE_SPDIF] = { 1, -1 }, [HDA_PCM_TYPE_HDMI] = { 3, 7, 8, 9, -1 }, @@ -3869,7 +3869,7 @@ EXPORT_SYMBOL_GPL(snd_hda_get_default_vref); unsigned int snd_hda_correct_pin_ctl(struct hda_codec *codec, hda_nid_t pin, unsigned int val) { - static unsigned int cap_lists[][2] = { + static const unsigned int cap_lists[][2] = { { AC_PINCTL_VREF_100, AC_PINCAP_VREF_100 }, { AC_PINCTL_VREF_80, AC_PINCAP_VREF_80 }, { AC_PINCTL_VREF_50, AC_PINCAP_VREF_50 }, @@ -4014,7 +4014,7 @@ void snd_hda_bus_reset_codecs(struct hda_bus *bus) */ void snd_print_pcm_bits(int pcm, char *buf, int buflen) { - static unsigned int bits[] = { 8, 16, 20, 24, 32 }; + static const unsigned int bits[] = { 8, 16, 20, 24, 32 }; int i, j;
for (i = 0, j = 0; i < ARRAY_SIZE(bits); i++) diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index d081fb2880a0..bb46c89b7f63 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c @@ -98,7 +98,7 @@ static const char * const cea_audio_coding_type_names[] = { /* * SS1:SS0 index => sample size */ -static int cea_sample_sizes[4] = { +static const int cea_sample_sizes[4] = { 0, /* 0: Refer to Stream Header */ AC_SUPPCM_BITS_16, /* 1: 16 bits */ AC_SUPPCM_BITS_20, /* 2: 20 bits */ @@ -108,7 +108,7 @@ static int cea_sample_sizes[4] = { /* * SF2:SF1:SF0 index => sampling frequency */ -static int cea_sampling_frequencies[8] = { +static const int cea_sampling_frequencies[8] = { 0, /* 0: Refer to Stream Header */ SNDRV_PCM_RATE_32000, /* 1: 32000Hz */ SNDRV_PCM_RATE_44100, /* 2: 44100Hz */ @@ -352,7 +352,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid, */ static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen) { - static unsigned int alsa_rates[] = { + static const unsigned int alsa_rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, 384000 }; diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 49f1638969e3..617143a44a10 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -372,7 +372,7 @@ enum {
#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
-static char *driver_short_names[] = { +static const char * const driver_short_names[] = { [AZX_DRIVER_ICH] = "HDA Intel", [AZX_DRIVER_PCH] = "HDA Intel PCH", [AZX_DRIVER_SCH] = "HDA Intel MID", @@ -499,7 +499,7 @@ static void bxt_reduce_dma_latency(struct azx *chip) static int intel_get_lctl_scf(struct azx *chip) { struct hdac_bus *bus = azx_bus(chip); - static int preferred_bits[] = { 2, 3, 1, 4, 5 }; + static const int preferred_bits[] = { 2, 3, 1, 4, 5 }; u32 val, t; int i;
@@ -1564,7 +1564,7 @@ static int check_position_fix(struct azx *chip, int fix)
static void assign_position_fix(struct azx *chip, int fix) { - static azx_get_pos_callback_t callbacks[] = { + static const azx_get_pos_callback_t callbacks[] = { [POS_FIX_AUTO] = NULL, [POS_FIX_LPIB] = azx_get_pos_lpib, [POS_FIX_POSBUF] = azx_get_pos_posbuf, @@ -2231,7 +2231,7 @@ static void set_default_power_save(struct azx *chip) }
/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ -static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { +static const unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { [AZX_DRIVER_NVIDIA] = 8, [AZX_DRIVER_TERA] = 1, }; diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 468836c65445..0631f31ef87f 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -160,7 +160,7 @@ static void print_amp_vals(struct snd_info_buffer *buffer,
static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) { - static unsigned int rates[] = { + static const unsigned int rates[] = { 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000, 176400, 192000, 384000 }; diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c index fcc34417cbce..0607ed5d1959 100644 --- a/sound/pci/hda/hda_sysfs.c +++ b/sound/pci/hda/hda_sysfs.c @@ -611,7 +611,7 @@ struct hda_patch_item { void (*parser)(char *buf, struct hda_bus *bus, struct hda_codec **retc); };
-static struct hda_patch_item patch_items[NUM_LINE_MODES] = { +static const struct hda_patch_item patch_items[NUM_LINE_MODES] = { [LINE_MODE_CODEC] = { .tag = "[codec]", .parser = parse_codec_mode, diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index c64895f99299..88c46b051d14 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -812,7 +812,7 @@ static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec) /* we create four static faked paths, since AD codecs have odd * widget connections regarding the SPDIF out source */ - static struct nid_path fake_paths[4] = { + static const struct nid_path fake_paths[4] = { { .depth = 3, .path = { 0x02, 0x1d, 0x1b }, diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 250534f90ce0..46e105244ad3 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -3768,7 +3768,7 @@ static const unsigned int float_xbass_xover_lookup[] = { /* The following are for tuning of products */ #ifdef ENABLE_TUNING_CONTROLS
-static unsigned int voice_focus_vals_lookup[] = { +static const unsigned int voice_focus_vals_lookup[] = { 0x41A00000, 0x41A80000, 0x41B00000, 0x41B80000, 0x41C00000, 0x41C80000, 0x41D00000, 0x41D80000, 0x41E00000, 0x41E80000, 0x41F00000, 0x41F80000, 0x42000000, 0x42040000, 0x42080000, 0x420C0000, 0x42100000, 0x42140000, @@ -3798,7 +3798,7 @@ static unsigned int voice_focus_vals_lookup[] = { 0x43300000, 0x43310000, 0x43320000, 0x43330000, 0x43340000 };
-static unsigned int mic_svm_vals_lookup[] = { +static const unsigned int mic_svm_vals_lookup[] = { 0x00000000, 0x3C23D70A, 0x3CA3D70A, 0x3CF5C28F, 0x3D23D70A, 0x3D4CCCCD, 0x3D75C28F, 0x3D8F5C29, 0x3DA3D70A, 0x3DB851EC, 0x3DCCCCCD, 0x3DE147AE, 0x3DF5C28F, 0x3E051EB8, 0x3E0F5C29, 0x3E19999A, 0x3E23D70A, 0x3E2E147B, @@ -3818,7 +3818,7 @@ static unsigned int mic_svm_vals_lookup[] = { 0x3F75C28F, 0x3F7851EC, 0x3F7AE148, 0x3F7D70A4, 0x3F800000 };
-static unsigned int equalizer_vals_lookup[] = { +static const unsigned int equalizer_vals_lookup[] = { 0xC1C00000, 0xC1B80000, 0xC1B00000, 0xC1A80000, 0xC1A00000, 0xC1980000, 0xC1900000, 0xC1880000, 0xC1800000, 0xC1700000, 0xC1600000, 0xC1500000, 0xC1400000, 0xC1300000, 0xC1200000, 0xC1100000, 0xC1000000, 0xC0E00000, @@ -3831,7 +3831,7 @@ static unsigned int equalizer_vals_lookup[] = { };
static int tuning_ctl_set(struct hda_codec *codec, hda_nid_t nid, - unsigned int *lookup, int idx) + const unsigned int *lookup, int idx) { int i = 0;
@@ -7642,14 +7642,14 @@ static void ca0132_init_unsol(struct hda_codec *codec) */
/* Sends before DSP download. */ -static struct hda_verb ca0132_base_init_verbs[] = { +static const struct hda_verb ca0132_base_init_verbs[] = { /*enable ct extension*/ {0x15, VENDOR_CHIPIO_CT_EXTENSIONS_ENABLE, 0x1}, {} };
/* Send at exit. */ -static struct hda_verb ca0132_base_exit_verbs[] = { +static const struct hda_verb ca0132_base_exit_verbs[] = { /*set afg to D3*/ {0x01, AC_VERB_SET_POWER_STATE, 0x03}, /*disable ct extension*/ @@ -7659,7 +7659,7 @@ static struct hda_verb ca0132_base_exit_verbs[] = {
/* Other verbs tables. Sends after DSP download. */
-static struct hda_verb ca0132_init_verbs0[] = { +static const struct hda_verb ca0132_init_verbs0[] = { /* chip init verbs */ {0x15, 0x70D, 0xF0}, {0x15, 0x70E, 0xFE}, @@ -7692,7 +7692,7 @@ static struct hda_verb ca0132_init_verbs0[] = { };
/* Extra init verbs for desktop cards. */ -static struct hda_verb ca0132_init_verbs1[] = { +static const struct hda_verb ca0132_init_verbs1[] = { {0x15, 0x70D, 0x20}, {0x15, 0x70E, 0x19}, {0x15, 0x707, 0x00}, @@ -8869,7 +8869,7 @@ static int patch_ca0132(struct hda_codec *codec) /* * patch entries */ -static struct hda_device_id snd_hda_id_ca0132[] = { +static const struct hda_device_id snd_hda_id_ca0132[] = { HDA_CODEC_ENTRY(0x11020011, "CA0132", patch_ca0132), {} /* terminator */ };
Apply const prefix to each possible place: the static tables for registers and bits, the quirk tables, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ac97/ac97_codec.c | 10 +++++----- sound/pci/ac97/ac97_patch.c | 26 +++++++++++++------------- sound/pci/ac97/ac97_pcm.c | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index fcfa8499e453..6758c072000e 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -1753,10 +1753,10 @@ static unsigned int snd_ac97_determine_spdif_rates(struct snd_ac97 *ac97) { unsigned int result = 0; int i; - static unsigned short ctl_bits[] = { + static const unsigned short ctl_bits[] = { AC97_SC_SPSR_44K, AC97_SC_SPSR_32K, AC97_SC_SPSR_48K }; - static unsigned int rate_bits[] = { + static const unsigned int rate_bits[] = { SNDRV_PCM_RATE_44100, SNDRV_PCM_RATE_32000, SNDRV_PCM_RATE_48000 };
@@ -2346,7 +2346,7 @@ struct ac97_power_reg {
enum { PWIDX_ADC, PWIDX_FRONT, PWIDX_CLFE, PWIDX_SURR, PWIDX_MIC, PWIDX_SIZE };
-static struct ac97_power_reg power_regs[PWIDX_SIZE] = { +static const struct ac97_power_reg power_regs[PWIDX_SIZE] = { [PWIDX_ADC] = { AC97_PCM_LR_ADC_RATE, AC97_POWERDOWN, AC97_PD_PR0}, [PWIDX_FRONT] = { AC97_PCM_FRONT_DAC_RATE, AC97_POWERDOWN, AC97_PD_PR1}, [PWIDX_CLFE] = { AC97_PCM_LFE_DAC_RATE, AC97_EXTENDED_STATUS, @@ -2829,7 +2829,7 @@ struct quirk_table { int (*func)(struct snd_ac97 *); };
-static struct quirk_table applicable_quirks[] = { +static const struct quirk_table applicable_quirks[] = { { "none", NULL }, { "hp_only", tune_hp_only }, { "swap_hp", tune_swap_hp }, @@ -2857,7 +2857,7 @@ static int apply_quirk(struct snd_ac97 *ac97, int type) static int apply_quirk_str(struct snd_ac97 *ac97, const char *typestr) { int i; - struct quirk_table *q; + const struct quirk_table *q;
for (i = 0; i < ARRAY_SIZE(applicable_quirks); i++) { q = &applicable_quirks[i]; diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 524f9d2dcb3c..ebf926728c5f 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -1211,25 +1211,25 @@ static const struct snd_ac97_build_ops patch_sigmatel_stac9758_ops = {
static int patch_sigmatel_stac9758(struct snd_ac97 * ac97) { - static unsigned short regs[4] = { + static const unsigned short regs[4] = { AC97_SIGMATEL_OUTSEL, AC97_SIGMATEL_IOMISC, AC97_SIGMATEL_INSEL, AC97_SIGMATEL_VARIOUS }; - static unsigned short def_regs[4] = { + static const unsigned short def_regs[4] = { /* OUTSEL */ 0xd794, /* CL:CL, SR:SR, LO:MX, LI:DS, MI:DS */ /* IOMISC */ 0x2001, /* INSEL */ 0x0201, /* LI:LI, MI:M1 */ /* VARIOUS */ 0x0040 }; - static unsigned short m675_regs[4] = { + static const unsigned short m675_regs[4] = { /* OUTSEL */ 0xfc70, /* CL:MX, SR:MX, LO:DS, LI:MX, MI:DS */ /* IOMISC */ 0x2102, /* HP amp on */ /* INSEL */ 0x0203, /* LI:LI, MI:FR */ /* VARIOUS */ 0x0041 /* stereo mic */ }; - unsigned short *pregs = def_regs; + const unsigned short *pregs = def_regs; int i;
/* Gateway M675 notebook */ @@ -1361,7 +1361,7 @@ static int patch_cx20551(struct snd_ac97 *ac97) #ifdef CONFIG_PM static void ad18xx_resume(struct snd_ac97 *ac97) { - static unsigned short setup_regs[] = { + static const unsigned short setup_regs[] = { AC97_AD_MISC, AC97_AD_SERIAL_CFG, AC97_AD_JACK_SPDIF, }; int i, codec; @@ -1470,7 +1470,7 @@ static unsigned short patch_ad1881_unchained(struct snd_ac97 * ac97, int idx, un
static int patch_ad1881_chained1(struct snd_ac97 * ac97, int idx, unsigned short codec_bits) { - static int cfg_bits[3] = { 1<<12, 1<<14, 1<<13 }; + static const int cfg_bits[3] = { 1<<12, 1<<14, 1<<13 }; unsigned short val; snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, cfg_bits[idx]); @@ -1794,7 +1794,7 @@ static const struct snd_kcontrol_new snd_ac97_ad1981x_jack_sense[] = { /* black list to avoid HP/Line jack-sense controls * (SS vendor << 16 | device) */ -static unsigned int ad1981_jacks_blacklist[] = { +static const unsigned int ad1981_jacks_blacklist[] = { 0x10140523, /* Thinkpad R40 */ 0x10140534, /* Thinkpad X31 */ 0x10140537, /* Thinkpad T41p */ @@ -1838,7 +1838,7 @@ static const struct snd_ac97_build_ops patch_ad1981a_build_ops = { /* white list to enable HP jack-sense bits * (SS vendor << 16 | device) */ -static unsigned int ad1981_jacks_whitelist[] = { +static const unsigned int ad1981_jacks_whitelist[] = { 0x0e11005a, /* HP nc4000/4010 */ 0x103c0890, /* HP nc6000 */ 0x103c0938, /* HP nc4220 */ @@ -3116,22 +3116,22 @@ static void cm9761_update_jacks(struct snd_ac97 *ac97) /* FIXME: check the bits for each model * model 83 is confirmed to work */ - static unsigned short surr_on[3][2] = { + static const unsigned short surr_on[3][2] = { { 0x0008, 0x0000 }, /* 9761-78 & 82 */ { 0x0000, 0x0008 }, /* 9761-82 rev.B */ { 0x0000, 0x0008 }, /* 9761-83 */ }; - static unsigned short clfe_on[3][2] = { + static const unsigned short clfe_on[3][2] = { { 0x0000, 0x1000 }, /* 9761-78 & 82 */ { 0x1000, 0x0000 }, /* 9761-82 rev.B */ { 0x0000, 0x1000 }, /* 9761-83 */ }; - static unsigned short surr_shared[3][2] = { + static const unsigned short surr_shared[3][2] = { { 0x0000, 0x0400 }, /* 9761-78 & 82 */ { 0x0000, 0x0400 }, /* 9761-82 rev.B */ { 0x0000, 0x0400 }, /* 9761-83 */ }; - static unsigned short clfe_shared[3][2] = { + static const unsigned short clfe_shared[3][2] = { { 0x2000, 0x0880 }, /* 9761-78 & 82 */ { 0x0000, 0x2880 }, /* 9761-82 rev.B */ { 0x2000, 0x0800 }, /* 9761-83 */ @@ -3635,7 +3635,7 @@ struct vt1618_uaj_item {
/* This list reflects the vt1618 docs for Vendor Defined Register 0x60. */
-static struct vt1618_uaj_item vt1618_uaj[3] = { +static const struct vt1618_uaj_item vt1618_uaj[3] = { { /* speaker jack */ .mask = 0x03, diff --git a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c index 1c23a0f90559..491de1a623cb 100644 --- a/sound/pci/ac97/ac97_pcm.c +++ b/sound/pci/ac97/ac97_pcm.c @@ -26,7 +26,7 @@ * PCM support */
-static unsigned char rate_reg_tables[2][4][9] = { +static const unsigned char rate_reg_tables[2][4][9] = { { /* standard rates */ { @@ -129,7 +129,7 @@ static unsigned char rate_reg_tables[2][4][9] = { }};
/* FIXME: more various mappings for ADC? */ -static unsigned char rate_cregs[9] = { +static const unsigned char rate_cregs[9] = { AC97_PCM_LR_ADC_RATE, /* 3 */ AC97_PCM_LR_ADC_RATE, /* 4 */ 0xff, /* 5 */
Apply const prefix to the remaining places: the static table for the unit information, the mixer maps, the validator tables, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/usb/mixer.c | 60 +++++++++++++++++++++++----------------------- sound/usb/mixer_maps.c | 56 +++++++++++++++++++++---------------------- sound/usb/mixer_quirks.c | 6 ++--- sound/usb/mixer_scarlett.c | 14 +++++------ sound/usb/proc.c | 2 +- sound/usb/stream.c | 4 ++-- sound/usb/validate.c | 4 ++-- 7 files changed, 73 insertions(+), 73 deletions(-)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 6d9080b47d0f..d659fdb475e2 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1020,7 +1020,7 @@ struct usb_feature_control_info { int type_uac2; /* data type for uac2 if different from uac1, else -1 */ };
-static struct usb_feature_control_info audio_feature_info[] = { +static const struct usb_feature_control_info audio_feature_info[] = { { UAC_FU_MUTE, "Mute", USB_MIXER_INV_BOOLEAN, -1 }, { UAC_FU_VOLUME, "Volume", USB_MIXER_S16, -1 }, { UAC_FU_BASS, "Tone Control - Bass", USB_MIXER_S8, -1 }, @@ -1526,7 +1526,7 @@ static void check_no_speaker_on_headset(struct snd_kcontrol *kctl, strlcpy(kctl->id.name, "Headphone", sizeof(kctl->id.name)); }
-static struct usb_feature_control_info *get_feature_control_info(int control) +static const struct usb_feature_control_info *get_feature_control_info(int control) { int i;
@@ -1544,7 +1544,7 @@ static void __build_feature_ctl(struct usb_mixer_interface *mixer, struct usb_audio_term *oterm, int unitid, int nameid, int readonly_mask) { - struct usb_feature_control_info *ctl_info; + const struct usb_feature_control_info *ctl_info; unsigned int len = 0; int mapped_name = 0; struct snd_kcontrol *kctl; @@ -2198,7 +2198,7 @@ static const struct snd_kcontrol_new mixer_procunit_ctl = { */ struct procunit_value_info { int control; - char *suffix; + const char *suffix; int val_type; int min_value; }; @@ -2206,44 +2206,44 @@ struct procunit_value_info { struct procunit_info { int type; char *name; - struct procunit_value_info *values; + const struct procunit_value_info *values; };
-static struct procunit_value_info undefined_proc_info[] = { +static const struct procunit_value_info undefined_proc_info[] = { { 0x00, "Control Undefined", 0 }, { 0 } };
-static struct procunit_value_info updown_proc_info[] = { +static const struct procunit_value_info updown_proc_info[] = { { UAC_UD_ENABLE, "Switch", USB_MIXER_BOOLEAN }, { UAC_UD_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 }, { 0 } }; -static struct procunit_value_info prologic_proc_info[] = { +static const struct procunit_value_info prologic_proc_info[] = { { UAC_DP_ENABLE, "Switch", USB_MIXER_BOOLEAN }, { UAC_DP_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 }, { 0 } }; -static struct procunit_value_info threed_enh_proc_info[] = { +static const struct procunit_value_info threed_enh_proc_info[] = { { UAC_3D_ENABLE, "Switch", USB_MIXER_BOOLEAN }, { UAC_3D_SPACE, "Spaciousness", USB_MIXER_U8 }, { 0 } }; -static struct procunit_value_info reverb_proc_info[] = { +static const struct procunit_value_info reverb_proc_info[] = { { UAC_REVERB_ENABLE, "Switch", USB_MIXER_BOOLEAN }, { UAC_REVERB_LEVEL, "Level", USB_MIXER_U8 }, { UAC_REVERB_TIME, "Time", USB_MIXER_U16 }, { UAC_REVERB_FEEDBACK, "Feedback", USB_MIXER_U8 }, { 0 } }; -static struct procunit_value_info chorus_proc_info[] = { +static const struct procunit_value_info chorus_proc_info[] = { { UAC_CHORUS_ENABLE, "Switch", USB_MIXER_BOOLEAN }, { UAC_CHORUS_LEVEL, "Level", USB_MIXER_U8 }, { UAC_CHORUS_RATE, "Rate", USB_MIXER_U16 }, { UAC_CHORUS_DEPTH, "Depth", USB_MIXER_U16 }, { 0 } }; -static struct procunit_value_info dcr_proc_info[] = { +static const struct procunit_value_info dcr_proc_info[] = { { UAC_DCR_ENABLE, "Switch", USB_MIXER_BOOLEAN }, { UAC_DCR_RATE, "Ratio", USB_MIXER_U16 }, { UAC_DCR_MAXAMPL, "Max Amp", USB_MIXER_S16 }, @@ -2253,7 +2253,7 @@ static struct procunit_value_info dcr_proc_info[] = { { 0 } };
-static struct procunit_info procunits[] = { +static const struct procunit_info procunits[] = { { UAC_PROCESS_UP_DOWNMIX, "Up Down", updown_proc_info }, { UAC_PROCESS_DOLBY_PROLOGIC, "Dolby Prologic", prologic_proc_info }, { UAC_PROCESS_STEREO_EXTENDER, "3D Stereo Extender", threed_enh_proc_info }, @@ -2263,16 +2263,16 @@ static struct procunit_info procunits[] = { { 0 }, };
-static struct procunit_value_info uac3_updown_proc_info[] = { +static const struct procunit_value_info uac3_updown_proc_info[] = { { UAC3_UD_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 }, { 0 } }; -static struct procunit_value_info uac3_stereo_ext_proc_info[] = { +static const struct procunit_value_info uac3_stereo_ext_proc_info[] = { { UAC3_EXT_WIDTH_CONTROL, "Width Control", USB_MIXER_U8 }, { 0 } };
-static struct procunit_info uac3_procunits[] = { +static const struct procunit_info uac3_procunits[] = { { UAC3_PROCESS_UP_DOWNMIX, "Up Down", uac3_updown_proc_info }, { UAC3_PROCESS_STEREO_EXTENDER, "3D Stereo Extender", uac3_stereo_ext_proc_info }, { UAC3_PROCESS_MULTI_FUNCTION, "Multi-Function", undefined_proc_info }, @@ -2282,23 +2282,23 @@ static struct procunit_info uac3_procunits[] = { /* * predefined data for extension units */ -static struct procunit_value_info clock_rate_xu_info[] = { +static const struct procunit_value_info clock_rate_xu_info[] = { { USB_XU_CLOCK_RATE_SELECTOR, "Selector", USB_MIXER_U8, 0 }, { 0 } }; -static struct procunit_value_info clock_source_xu_info[] = { +static const struct procunit_value_info clock_source_xu_info[] = { { USB_XU_CLOCK_SOURCE_SELECTOR, "External", USB_MIXER_BOOLEAN }, { 0 } }; -static struct procunit_value_info spdif_format_xu_info[] = { +static const struct procunit_value_info spdif_format_xu_info[] = { { USB_XU_DIGITAL_FORMAT_SELECTOR, "SPDIF/AC3", USB_MIXER_BOOLEAN }, { 0 } }; -static struct procunit_value_info soft_limit_xu_info[] = { +static const struct procunit_value_info soft_limit_xu_info[] = { { USB_XU_SOFT_LIMIT_SELECTOR, " ", USB_MIXER_BOOLEAN }, { 0 } }; -static struct procunit_info extunits[] = { +static const struct procunit_info extunits[] = { { USB_XU_CLOCK_RATE, "Clock rate", clock_rate_xu_info }, { USB_XU_CLOCK_SOURCE, "DigitalIn CLK source", clock_source_xu_info }, { USB_XU_DIGITAL_IO_STATUS, "DigitalOut format:", spdif_format_xu_info }, @@ -2310,7 +2310,7 @@ static struct procunit_info extunits[] = { * build a processing/extension unit */ static int build_audio_procunit(struct mixer_build *state, int unitid, - void *raw_desc, struct procunit_info *list, + void *raw_desc, const struct procunit_info *list, bool extension_unit) { struct uac_processing_unit_descriptor *desc = raw_desc; @@ -2318,14 +2318,14 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, struct usb_mixer_elem_info *cval; struct snd_kcontrol *kctl; int i, err, nameid, type, len; - struct procunit_info *info; - struct procunit_value_info *valinfo; + const struct procunit_info *info; + const struct procunit_value_info *valinfo; const struct usbmix_name_map *map; - static struct procunit_value_info default_value_info[] = { + static const struct procunit_value_info default_value_info[] = { { 0x01, "Switch", USB_MIXER_BOOLEAN }, { 0 } }; - static struct procunit_info default_info = { + static const struct procunit_info default_info = { 0, NULL, default_value_info }; const char *name = extension_unit ? @@ -2803,7 +2803,7 @@ struct uac3_badd_profile { int st_chmask; /* side tone mixing channel mask */ };
-static struct uac3_badd_profile uac3_badd_profiles[] = { +static const struct uac3_badd_profile uac3_badd_profiles[] = { { /* * BAIF, BAOF or combination of both @@ -2864,7 +2864,7 @@ static struct uac3_badd_profile uac3_badd_profiles[] = { };
static bool uac3_badd_func_has_valid_channels(struct usb_mixer_interface *mixer, - struct uac3_badd_profile *f, + const struct uac3_badd_profile *f, int c_chmask, int p_chmask) { /* @@ -2908,7 +2908,7 @@ static int snd_usb_mixer_controls_badd(struct usb_mixer_interface *mixer, struct usb_device *dev = mixer->chip->dev; struct usb_interface_assoc_descriptor *assoc; int badd_profile = mixer->chip->badd_profile; - struct uac3_badd_profile *f; + const struct uac3_badd_profile *f; const struct usbmix_ctl_map *map; int p_chmask = 0, c_chmask = 0, st_chmask = 0; int i; @@ -3174,7 +3174,7 @@ static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer, struct usb_mixer_elem_list *list) { struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); - static char *val_types[] = {"BOOLEAN", "INV_BOOLEAN", + static const char * const val_types[] = {"BOOLEAN", "INV_BOOLEAN", "S8", "U8", "S16", "U16"}; snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " "channels=%i, type="%s"\n", cval->head.id, diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c index d094934ae6c5..5ebca8013840 100644 --- a/sound/usb/mixer_maps.c +++ b/sound/usb/mixer_maps.c @@ -14,7 +14,7 @@ struct usbmix_name_map { int id; const char *name; int control; - struct usbmix_dB_map *dB; + const struct usbmix_dB_map *dB; };
struct usbmix_selector_map { @@ -52,7 +52,7 @@ Mic-IN[9] --+->FU[10]----------------------------+ | ++--+->SU[11]-->FU[12] --------------------------------------------------------------------------------------> USB_OUT[13] */
-static struct usbmix_name_map extigy_map[] = { +static const struct usbmix_name_map extigy_map[] = { /* 1: IT pcm */ { 2, "PCM Playback" }, /* FU */ /* 3: IT pcm */ @@ -93,12 +93,12 @@ static struct usbmix_name_map extigy_map[] = { * e.g. no Master and fake PCM volume * Pavel Mihaylov bin@bash.info */ -static struct usbmix_dB_map mp3plus_dB_1 = {.min = -4781, .max = 0}; +static const struct usbmix_dB_map mp3plus_dB_1 = {.min = -4781, .max = 0}; /* just guess */ -static struct usbmix_dB_map mp3plus_dB_2 = {.min = -1781, .max = 618}; +static const struct usbmix_dB_map mp3plus_dB_2 = {.min = -1781, .max = 618}; /* just guess */
-static struct usbmix_name_map mp3plus_map[] = { +static const struct usbmix_name_map mp3plus_map[] = { /* 1: IT pcm */ /* 2: IT mic */ /* 3: IT line */ @@ -139,7 +139,7 @@ Lin_IN[7]-+--->FU[8]---+ +->EU[23]->FU[28]------------->Spk_OUT[19] | ^ +->FU[13]--------------------------------------+ */ -static struct usbmix_name_map audigy2nx_map[] = { +static const struct usbmix_name_map audigy2nx_map[] = { /* 1: IT pcm playback */ /* 4: IT digital in */ { 6, "Digital In Playback" }, /* FU */ @@ -167,12 +167,12 @@ static struct usbmix_name_map audigy2nx_map[] = { { 0 } /* terminator */ };
-static struct usbmix_name_map mbox1_map[] = { +static const struct usbmix_name_map mbox1_map[] = { { 1, "Clock" }, { 0 } /* terminator */ };
-static struct usbmix_selector_map c400_selectors[] = { +static const struct usbmix_selector_map c400_selectors[] = { { .id = 0x80, .count = 2, @@ -181,7 +181,7 @@ static struct usbmix_selector_map c400_selectors[] = { { 0 } /* terminator */ };
-static struct usbmix_selector_map audigy2nx_selectors[] = { +static const struct usbmix_selector_map audigy2nx_selectors[] = { { .id = 14, /* Capture Source */ .count = 3, @@ -201,21 +201,21 @@ static struct usbmix_selector_map audigy2nx_selectors[] = { };
/* Creative SoundBlaster Live! 24-bit External */ -static struct usbmix_name_map live24ext_map[] = { +static const struct usbmix_name_map live24ext_map[] = { /* 2: PCM Playback Volume */ { 5, "Mic Capture" }, /* FU, default PCM Capture Volume */ { 0 } /* terminator */ };
/* LineX FM Transmitter entry - needed to bypass controls bug */ -static struct usbmix_name_map linex_map[] = { +static const struct usbmix_name_map linex_map[] = { /* 1: IT pcm */ /* 2: OT Speaker */ { 3, "Master" }, /* FU: master volume - left / right / mute */ { 0 } /* terminator */ };
-static struct usbmix_name_map maya44_map[] = { +static const struct usbmix_name_map maya44_map[] = { /* 1: IT line */ { 2, "Line Playback" }, /* FU */ /* 3: IT line */ @@ -238,7 +238,7 @@ static struct usbmix_name_map maya44_map[] = { * so this map removes all unwanted sliders from alsamixer */
-static struct usbmix_name_map justlink_map[] = { +static const struct usbmix_name_map justlink_map[] = { /* 1: IT pcm playback */ /* 2: Not present */ { 3, NULL}, /* IT mic (No mic input on device) */ @@ -255,7 +255,7 @@ static struct usbmix_name_map justlink_map[] = { };
/* TerraTec Aureon 5.1 MkII USB */ -static struct usbmix_name_map aureon_51_2_map[] = { +static const struct usbmix_name_map aureon_51_2_map[] = { /* 1: IT USB */ /* 2: IT Mic */ /* 3: IT Line */ @@ -274,7 +274,7 @@ static struct usbmix_name_map aureon_51_2_map[] = { {} /* terminator */ };
-static struct usbmix_name_map scratch_live_map[] = { +static const struct usbmix_name_map scratch_live_map[] = { /* 1: IT Line 1 (USB streaming) */ /* 2: OT Line 1 (Speaker) */ /* 3: IT Line 1 (Line connector) */ @@ -290,7 +290,7 @@ static struct usbmix_name_map scratch_live_map[] = { { 0 } /* terminator */ };
-static struct usbmix_name_map ebox44_map[] = { +static const struct usbmix_name_map ebox44_map[] = { { 4, NULL }, /* FU */ { 6, NULL }, /* MU */ { 7, NULL }, /* FU */ @@ -305,7 +305,7 @@ static struct usbmix_name_map ebox44_map[] = { * FIXME: or mp3plus_map should use "Capture Source" too, * so this maps can be merget */ -static struct usbmix_name_map hercules_usb51_map[] = { +static const struct usbmix_name_map hercules_usb51_map[] = { { 8, "Capture Source" }, /* SU, default "PCM Capture Source" */ { 9, "Master Playback" }, /* FU, default "Speaker Playback" */ { 10, "Mic Boost", 7 }, /* FU, default "Auto Gain Input" */ @@ -316,7 +316,7 @@ static struct usbmix_name_map hercules_usb51_map[] = { };
/* Plantronics Gamecom 780 has a broken volume control, better to disable it */ -static struct usbmix_name_map gamecom780_map[] = { +static const struct usbmix_name_map gamecom780_map[] = { { 9, NULL }, /* FU, speaker out */ {} }; @@ -330,8 +330,8 @@ static const struct usbmix_name_map scms_usb3318_map[] = { };
/* Bose companion 5, the dB conversion factor is 16 instead of 256 */ -static struct usbmix_dB_map bose_companion5_dB = {-5006, -6}; -static struct usbmix_name_map bose_companion5_map[] = { +static const struct usbmix_dB_map bose_companion5_dB = {-5006, -6}; +static const struct usbmix_name_map bose_companion5_map[] = { { 3, NULL, .dB = &bose_companion5_dB }, { 0 } /* terminator */ }; @@ -363,7 +363,7 @@ static const struct usbmix_name_map corsair_virtuoso_map[] = { * Control map entries */
-static struct usbmix_ctl_map usbmix_ctl_maps[] = { +static const struct usbmix_ctl_map usbmix_ctl_maps[] = { { .id = USB_ID(0x041e, 0x3000), .map = extigy_map, @@ -495,37 +495,37 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { * Control map entries for UAC3 BADD profiles */
-static struct usbmix_name_map uac3_badd_generic_io_map[] = { +static const struct usbmix_name_map uac3_badd_generic_io_map[] = { { UAC3_BADD_FU_ID2, "Generic Out Playback" }, { UAC3_BADD_FU_ID5, "Generic In Capture" }, { 0 } /* terminator */ }; -static struct usbmix_name_map uac3_badd_headphone_map[] = { +static const struct usbmix_name_map uac3_badd_headphone_map[] = { { UAC3_BADD_FU_ID2, "Headphone Playback" }, { 0 } /* terminator */ }; -static struct usbmix_name_map uac3_badd_speaker_map[] = { +static const struct usbmix_name_map uac3_badd_speaker_map[] = { { UAC3_BADD_FU_ID2, "Speaker Playback" }, { 0 } /* terminator */ }; -static struct usbmix_name_map uac3_badd_microphone_map[] = { +static const struct usbmix_name_map uac3_badd_microphone_map[] = { { UAC3_BADD_FU_ID5, "Mic Capture" }, { 0 } /* terminator */ }; /* Covers also 'headset adapter' profile */ -static struct usbmix_name_map uac3_badd_headset_map[] = { +static const struct usbmix_name_map uac3_badd_headset_map[] = { { UAC3_BADD_FU_ID2, "Headset Playback" }, { UAC3_BADD_FU_ID5, "Headset Capture" }, { UAC3_BADD_FU_ID7, "Sidetone Mixing" }, { 0 } /* terminator */ }; -static struct usbmix_name_map uac3_badd_speakerphone_map[] = { +static const struct usbmix_name_map uac3_badd_speakerphone_map[] = { { UAC3_BADD_FU_ID2, "Speaker Playback" }, { UAC3_BADD_FU_ID5, "Mic Capture" }, { 0 } /* terminator */ };
-static struct usbmix_ctl_map uac3_badd_usbmix_ctl_maps[] = { +static const struct usbmix_ctl_map uac3_badd_usbmix_ctl_maps[] = { { .id = UAC3_FUNCTION_SUBCLASS_GENERIC_IO, .map = uac3_badd_generic_io_map, diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 4cb8331d87a4..b9f5a9c18040 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -119,7 +119,7 @@ static int snd_create_std_mono_ctl(struct usb_mixer_interface *mixer, * Create a set of standard UAC controls from a table */ static int snd_create_std_mono_table(struct usb_mixer_interface *mixer, - struct std_mono_table *t) + const struct std_mono_table *t) { int err;
@@ -1386,7 +1386,7 @@ static int snd_c400_create_mixer(struct usb_mixer_interface *mixer) * are valid they presents mono controls as L and R channels of * stereo. So we provide a good mixer here. */ -static struct std_mono_table ebox44_table[] = { +static const struct std_mono_table ebox44_table[] = { { .unitid = 4, .control = 1, @@ -1691,7 +1691,7 @@ static const struct snd_kcontrol_new snd_microii_mixer_spdif[] = { static int snd_microii_controls_create(struct usb_mixer_interface *mixer) { int err, i; - static usb_mixer_elem_resume_func_t resume_funcs[] = { + const static usb_mixer_elem_resume_func_t resume_funcs[] = { snd_microii_spdif_default_update, NULL, snd_microii_spdif_switch_update diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c index 9d10cbf1b5ed..49fcd2505443 100644 --- a/sound/usb/mixer_scarlett.c +++ b/sound/usb/mixer_scarlett.c @@ -633,7 +633,7 @@ static int add_output_ctls(struct usb_mixer_interface *mixer, /********************** device-specific config *************************/
/* untested... */ -static struct scarlett_device_info s6i6_info = { +static const struct scarlett_device_info s6i6_info = { .matrix_in = 18, .matrix_out = 8, .input_len = 6, @@ -675,7 +675,7 @@ static struct scarlett_device_info s6i6_info = { };
/* untested... */ -static struct scarlett_device_info s8i6_info = { +static const struct scarlett_device_info s8i6_info = { .matrix_in = 18, .matrix_out = 6, .input_len = 8, @@ -714,7 +714,7 @@ static struct scarlett_device_info s8i6_info = { } };
-static struct scarlett_device_info s18i6_info = { +static const struct scarlett_device_info s18i6_info = { .matrix_in = 18, .matrix_out = 6, .input_len = 18, @@ -751,7 +751,7 @@ static struct scarlett_device_info s18i6_info = { } };
-static struct scarlett_device_info s18i8_info = { +static const struct scarlett_device_info s18i8_info = { .matrix_in = 18, .matrix_out = 8, .input_len = 18, @@ -793,7 +793,7 @@ static struct scarlett_device_info s18i8_info = { } };
-static struct scarlett_device_info s18i20_info = { +static const struct scarlett_device_info s18i20_info = { .matrix_in = 18, .matrix_out = 8, .input_len = 18, @@ -843,7 +843,7 @@ static struct scarlett_device_info s18i20_info = {
static int scarlett_controls_create_generic(struct usb_mixer_interface *mixer, - struct scarlett_device_info *info) + const struct scarlett_device_info *info) { int i, err; char mx[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; @@ -915,7 +915,7 @@ int snd_scarlett_controls_create(struct usb_mixer_interface *mixer) { int err, i, o; char mx[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; - struct scarlett_device_info *info; + const struct scarlett_device_info *info; struct usb_mixer_elem_info *elem; static char sample_rate_buffer[4] = { '\x80', '\xbb', '\x00', '\x00' };
diff --git a/sound/usb/proc.c b/sound/usb/proc.c index 49e3f176aaf5..ffbf4bd9208c 100644 --- a/sound/usb/proc.c +++ b/sound/usb/proc.c @@ -60,7 +60,7 @@ void snd_usb_audio_create_proc(struct snd_usb_audio *chip) static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct snd_info_buffer *buffer) { struct audioformat *fp; - static char *sync_types[4] = { + static const char * const sync_types[4] = { "NONE", "ASYNC", "ADAPTIVE", "SYNC" };
diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 11785f9652ad..afd5aa574611 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -239,7 +239,7 @@ static int add_chmap(struct snd_pcm *pcm, int stream, static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits, int protocol) { - static unsigned int uac1_maps[] = { + static const unsigned int uac1_maps[] = { SNDRV_CHMAP_FL, /* left front */ SNDRV_CHMAP_FR, /* right front */ SNDRV_CHMAP_FC, /* center front */ @@ -254,7 +254,7 @@ static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits, SNDRV_CHMAP_TC, /* top */ 0 /* terminator */ }; - static unsigned int uac2_maps[] = { + static const unsigned int uac2_maps[] = { SNDRV_CHMAP_FL, /* front left */ SNDRV_CHMAP_FR, /* front right */ SNDRV_CHMAP_FC, /* front center */ diff --git a/sound/usb/validate.c b/sound/usb/validate.c index 36ae78c3da3d..4034c2072415 100644 --- a/sound/usb/validate.c +++ b/sound/usb/validate.c @@ -233,7 +233,7 @@ static bool validate_midi_out_jack(const void *p, #define FIXED(p, t, s) { .protocol = (p), .type = (t), .size = sizeof(s) } #define FUNC(p, t, f) { .protocol = (p), .type = (t), .func = (f) }
-static struct usb_desc_validator audio_validators[] = { +static const struct usb_desc_validator audio_validators[] = { /* UAC1 */ FUNC(UAC_VERSION_1, UAC_HEADER, validate_uac1_header), FIXED(UAC_VERSION_1, UAC_INPUT_TERMINAL, @@ -288,7 +288,7 @@ static struct usb_desc_validator audio_validators[] = { { } /* terminator */ };
-static struct usb_desc_validator midi_validators[] = { +static const struct usb_desc_validator midi_validators[] = { FIXED(UAC_VERSION_ALL, USB_MS_HEADER, struct usb_ms_header_descriptor), FIXED(UAC_VERSION_ALL, USB_MS_MIDI_IN_JACK,
Apply const prefix to each possible place: the rate table, the controller tables, and the key tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/usb/caiaq/audio.c | 2 +- sound/usb/caiaq/control.c | 20 ++++++++++---------- sound/usb/caiaq/input.c | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 41993a5c0537..e9243d53a107 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c @@ -179,7 +179,7 @@ static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream *sub) #error "Change this table" #endif
-static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, +static const unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000 };
static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c index 532e354f6124..af459c49baf4 100644 --- a/sound/usb/caiaq/control.c +++ b/sound/usb/caiaq/control.c @@ -163,14 +163,14 @@ struct caiaq_controller { int index; };
-static struct caiaq_controller ak1_controller[] = { +static const struct caiaq_controller ak1_controller[] = { { "LED left", 2 }, { "LED middle", 1 }, { "LED right", 0 }, { "LED ring", 3 } };
-static struct caiaq_controller rk2_controller[] = { +static const struct caiaq_controller rk2_controller[] = { { "LED 1", 5 }, { "LED 2", 4 }, { "LED 3", 3 }, @@ -196,7 +196,7 @@ static struct caiaq_controller rk2_controller[] = { { "LED 7seg_3g", 23 } };
-static struct caiaq_controller rk3_controller[] = { +static const struct caiaq_controller rk3_controller[] = { { "LED 7seg_1a", 0 + 0 }, { "LED 7seg_1b", 0 + 1 }, { "LED 7seg_1c", 0 + 2 }, @@ -244,7 +244,7 @@ static struct caiaq_controller rk3_controller[] = { { "LED pedal", 32 + 8 } };
-static struct caiaq_controller kore_controller[] = { +static const struct caiaq_controller kore_controller[] = { { "LED F1", 8 | CNT_INTVAL }, { "LED F2", 12 | CNT_INTVAL }, { "LED F3", 0 | CNT_INTVAL }, @@ -278,7 +278,7 @@ static struct caiaq_controller kore_controller[] = { { "LED control", 26 | CNT_INTVAL } };
-static struct caiaq_controller a8dj_controller[] = { +static const struct caiaq_controller a8dj_controller[] = { { "Current input mode", 0 | CNT_INTVAL }, { "GND lift for TC Vinyl mode", 24 + 0 }, { "GND lift for TC CD/Line mode", 24 + 1 }, @@ -286,11 +286,11 @@ static struct caiaq_controller a8dj_controller[] = { { "Software lock", 40 } };
-static struct caiaq_controller a4dj_controller[] = { +static const struct caiaq_controller a4dj_controller[] = { { "Current input mode", 0 | CNT_INTVAL } };
-static struct caiaq_controller kontrolx1_controller[] = { +static const struct caiaq_controller kontrolx1_controller[] = { { "LED FX A: ON", 7 | CNT_INTVAL }, { "LED FX A: 1", 6 | CNT_INTVAL }, { "LED FX A: 2", 5 | CNT_INTVAL }, @@ -327,7 +327,7 @@ static struct caiaq_controller kontrolx1_controller[] = { { "LED Deck B: SYNC", 8 | CNT_INTVAL }, };
-static struct caiaq_controller kontrols4_controller[] = { +static const struct caiaq_controller kontrols4_controller[] = { { "LED: Master: Quant", 10 | CNT_INTVAL }, { "LED: Master: Headphone", 11 | CNT_INTVAL }, { "LED: Master: Master", 12 | CNT_INTVAL }, @@ -500,7 +500,7 @@ static struct caiaq_controller kontrols4_controller[] = { { "LED: FX2: Mode", 133 | CNT_INTVAL }, };
-static struct caiaq_controller maschine_controller[] = { +static const struct caiaq_controller maschine_controller[] = { { "LED: Pad 1", 3 | CNT_INTVAL }, { "LED: Pad 2", 2 | CNT_INTVAL }, { "LED: Pad 3", 1 | CNT_INTVAL }, @@ -568,7 +568,7 @@ static struct caiaq_controller maschine_controller[] = { { "Backlight Display", 59 | CNT_INTVAL } };
-static int add_controls(struct caiaq_controller *c, int num, +static int add_controls(const struct caiaq_controller *c, int num, struct snd_usb_caiaqdev *cdev) { int i, ret; diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c index 533eb69fe4e6..1e2cf2f08eec 100644 --- a/sound/usb/caiaq/input.c +++ b/sound/usb/caiaq/input.c @@ -14,13 +14,13 @@ #include "device.h" #include "input.h"
-static unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; -static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, +static const unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; +static const unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7 }; -static unsigned short keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4, +static const unsigned short keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9 };
-static unsigned short keycode_kore[] = { +static const unsigned short keycode_kore[] = { KEY_FN_F1, /* "menu" */ KEY_FN_F7, /* "lcd backlight */ KEY_FN_F2, /* "control" */ @@ -60,7 +60,7 @@ static unsigned short keycode_kore[] = { #define MASCHINE_PADS (16) #define MASCHINE_PAD(X) ((X) + ABS_PRESSURE)
-static unsigned short keycode_maschine[] = { +static const unsigned short keycode_maschine[] = { MASCHINE_BUTTON(40), /* mute */ MASCHINE_BUTTON(39), /* solo */ MASCHINE_BUTTON(38), /* select */
Apply const prefix to each possible place: the static register tables, the coef tables, the string arrays, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/au88x0/au88x0_core.c | 2 +- sound/pci/au88x0/au88x0_eq.c | 22 +++++++++++----------- sound/pci/au88x0/au88x0_eqdata.c | 18 +++++++++--------- sound/pci/au88x0/au88x0_pcm.c | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index ce0564c5392a..f5512b72b3e0 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c @@ -1989,7 +1989,7 @@ vortex_connect_codecrec(vortex_t * vortex, int en, unsigned char mixin0, // Higher level ADB audio path (de)allocator.
/* Resource manager */ -static int resnum[VORTEX_RESOURCE_LAST] = +static const int resnum[VORTEX_RESOURCE_LAST] = { NR_ADB, NR_SRC, NR_MIXIN, NR_MIXOUT, NR_A3D }; /* Checkout/Checkin resource of given type. diff --git a/sound/pci/au88x0/au88x0_eq.c b/sound/pci/au88x0/au88x0_eq.c index abaf9f912784..58e92f2a72c0 100644 --- a/sound/pci/au88x0/au88x0_eq.c +++ b/sound/pci/au88x0/au88x0_eq.c @@ -51,7 +51,7 @@ static inline u16 sign_invert(u16 a) return -a; }
-static void vortex_EqHw_SetLeftCoefs(vortex_t * vortex, u16 coefs[]) +static void vortex_EqHw_SetLeftCoefs(vortex_t *vortex, const u16 coefs[]) { eqhw_t *eqhw = &(vortex->eq.this04); int i = 0, n /*esp2c */; @@ -73,7 +73,7 @@ static void vortex_EqHw_SetLeftCoefs(vortex_t * vortex, u16 coefs[]) } }
-static void vortex_EqHw_SetRightCoefs(vortex_t * vortex, u16 coefs[]) +static void vortex_EqHw_SetRightCoefs(vortex_t *vortex, const u16 coefs[]) { eqhw_t *eqhw = &(vortex->eq.this04); int i = 0, n /*esp2c */; @@ -96,7 +96,7 @@ static void vortex_EqHw_SetRightCoefs(vortex_t * vortex, u16 coefs[])
}
-static void vortex_EqHw_SetLeftStates(vortex_t * vortex, u16 a[], u16 b[]) +static void vortex_EqHw_SetLeftStates(vortex_t *vortex, const u16 a[], const u16 b[]) { eqhw_t *eqhw = &(vortex->eq.this04); int i = 0, ebx; @@ -113,7 +113,7 @@ static void vortex_EqHw_SetLeftStates(vortex_t * vortex, u16 a[], u16 b[]) } }
-static void vortex_EqHw_SetRightStates(vortex_t * vortex, u16 a[], u16 b[]) +static void vortex_EqHw_SetRightStates(vortex_t *vortex, const u16 a[], const u16 b[]) { eqhw_t *eqhw = &(vortex->eq.this04); int i = 0, ebx; @@ -206,7 +206,7 @@ vortex_EqHw_SetRightGainsSingleTarget(vortex_t * vortex, u16 index, u16 b) hwwrite(vortex->mmio, 0x2b20c + (index * 0x30), b); }
-static void vortex_EqHw_SetLeftGainsTarget(vortex_t * vortex, u16 a[]) +static void vortex_EqHw_SetLeftGainsTarget(vortex_t *vortex, const u16 a[]) { eqhw_t *eqhw = &(vortex->eq.this04); int ebx; @@ -216,7 +216,7 @@ static void vortex_EqHw_SetLeftGainsTarget(vortex_t * vortex, u16 a[]) } }
-static void vortex_EqHw_SetRightGainsTarget(vortex_t * vortex, u16 a[]) +static void vortex_EqHw_SetRightGainsTarget(vortex_t *vortex, const u16 a[]) { eqhw_t *eqhw = &(vortex->eq.this04); int ebx; @@ -226,7 +226,7 @@ static void vortex_EqHw_SetRightGainsTarget(vortex_t * vortex, u16 a[]) } }
-static void vortex_EqHw_SetLeftGainsCurrent(vortex_t * vortex, u16 a[]) +static void vortex_EqHw_SetLeftGainsCurrent(vortex_t *vortex, const u16 a[]) { eqhw_t *eqhw = &(vortex->eq.this04); int ebx; @@ -236,7 +236,7 @@ static void vortex_EqHw_SetLeftGainsCurrent(vortex_t * vortex, u16 a[]) } }
-static void vortex_EqHw_SetRightGainsCurrent(vortex_t * vortex, u16 a[]) +static void vortex_EqHw_SetRightGainsCurrent(vortex_t *vortex, const u16 a[]) { eqhw_t *eqhw = &(vortex->eq.this04); int ebx; @@ -309,7 +309,7 @@ static void vortex_EqHw_GetRightGainsCurrent(vortex_t * vortex, u16 a[])
#endif /* EQ band levels settings */ -static void vortex_EqHw_SetLevels(vortex_t * vortex, u16 peaks[]) +static void vortex_EqHw_SetLevels(vortex_t *vortex, const u16 peaks[]) { eqhw_t *eqhw = &(vortex->eq.this04); int i; @@ -574,7 +574,7 @@ static int vortex_Eqlzr_SetAllBandsFromActiveCoeffSet(vortex_t * vortex) }
static int -vortex_Eqlzr_SetAllBands(vortex_t * vortex, u16 gains[], s32 count) +vortex_Eqlzr_SetAllBands(vortex_t *vortex, const u16 gains[], s32 count) { eqlzr_t *eq = &(vortex->eq); int i; @@ -852,7 +852,7 @@ static const struct snd_kcontrol_new vortex_levels_kcontrol = { };
/* EQ band gain labels. */ -static char *EqBandLabels[10] = { +static const char * const EqBandLabels[10] = { "EQ0 31Hz\0", "EQ1 63Hz\0", "EQ2 125Hz\0", diff --git a/sound/pci/au88x0/au88x0_eqdata.c b/sound/pci/au88x0/au88x0_eqdata.c index 49a52d298b1a..a74f266f0bd0 100644 --- a/sound/pci/au88x0/au88x0_eqdata.c +++ b/sound/pci/au88x0/au88x0_eqdata.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Data structs */
-static u16 asEqCoefsZeros[50] = { +static const u16 asEqCoefsZeros[50] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -14,7 +14,7 @@ static u16 asEqCoefsZeros[50] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, };
-static u16 asEqCoefsPipes[64] = { +static const u16 asEqCoefsPipes[64] = { 0x0000, 0x0000, 0x0000, 0x0666, 0x0000, 0x0000, 0x0666, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -33,7 +33,7 @@ static u16 asEqCoefsPipes[64] = { };
/* More coef sets can be found in the win2k "inf" file. */ -static auxxEqCoeffSet_t asEqCoefsNormal = { +static const auxxEqCoeffSet_t asEqCoefsNormal = { .LeftCoefs = { 0x7e60, 0xc19e, 0x0001, 0x0002, 0x0001, 0x7fa0, 0xc05f, 0x004f, 0x0000, 0xffb1, @@ -66,7 +66,7 @@ static auxxEqCoeffSet_t asEqCoefsNormal = { 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96} };
-static u16 eq_gains_normal[20] = { +static const u16 eq_gains_normal[20] = { 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, 0x3e96, @@ -74,22 +74,22 @@ static u16 eq_gains_normal[20] = { };
/* _rodatab60 */ -static u16 eq_gains_zero[10] = { +static const u16 eq_gains_zero[10] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 };
/* _rodatab7c: ProgramPipe */ -static u16 eq_gains_current[12] = { +static const u16 eq_gains_current[12] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff };
/* _rodatab78 */ -static u16 eq_states_zero[2] = { 0x0000, 0x0000 }; +static const u16 eq_states_zero[2] = { 0x0000, 0x0000 };
-static u16 asEqOutStateZeros[48] = { +static const u16 asEqOutStateZeros[48] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -105,7 +105,7 @@ static u16 asEqOutStateZeros[48] = { };
/*_rodataba0:*/ -static u16 eq_levels[64] = { +static const u16 eq_levels[64] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index 2cdb7845f651..d019aa566de3 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c @@ -433,14 +433,14 @@ static const struct snd_pcm_ops snd_vortex_playback_ops = { * definitions of capture are omitted here... */
-static char *vortex_pcm_prettyname[VORTEX_PCM_LAST] = { +static const char * const vortex_pcm_prettyname[VORTEX_PCM_LAST] = { CARD_NAME " ADB", CARD_NAME " SPDIF", CARD_NAME " A3D", CARD_NAME " WT", CARD_NAME " I2S", }; -static char *vortex_pcm_name[VORTEX_PCM_LAST] = { +static const char * const vortex_pcm_name[VORTEX_PCM_LAST] = { "adb", "spdif", "a3d",
Apply const prefix to the remaining possible places: the static tables for init verbs and registers, the string arrays, the conversion tables, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/emu10k1/emu10k1_main.c | 12 ++++++------ sound/pci/emu10k1/emufx.c | 14 +++++++------- sound/pci/emu10k1/emumixer.c | 28 ++++++++++++++-------------- sound/pci/emu10k1/emuproc.c | 16 ++++++++-------- sound/pci/emu10k1/io.c | 4 ++-- 5 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 51af766f57d2..a89a7e603ca8 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -100,7 +100,7 @@ void snd_emu10k1_voice_init(struct snd_emu10k1 *emu, int ch) } }
-static unsigned int spi_dac_init[] = { +static const unsigned int spi_dac_init[] = { 0x00ff, 0x02ff, 0x0400, @@ -124,7 +124,7 @@ static unsigned int spi_dac_init[] = { 0x1400, };
-static unsigned int i2c_adc_init[][2] = { +static const unsigned int i2c_adc_init[][2] = { { 0x17, 0x00 }, /* Reset */ { 0x07, 0x00 }, /* Timeout */ { 0x0b, 0x22 }, /* Interface control */ @@ -2050,7 +2050,7 @@ int snd_emu10k1_create(struct snd_card *card, }
#ifdef CONFIG_PM_SLEEP -static unsigned char saved_regs[] = { +static const unsigned char saved_regs[] = { CPF, PTRX, CVCF, VTFT, Z1, Z2, PSST, DSL, CCCA, CCR, CLP, FXRT, MAPA, MAPB, ENVVOL, ATKHLDV, DCYSUSV, LFOVAL1, ENVVAL, ATKHLDM, DCYSUSM, LFOVAL2, IP, IFATN, PEFE, FMMOD, TREMFRQ, FM2FRQ2, @@ -2059,7 +2059,7 @@ static unsigned char saved_regs[] = { SPBYPASS, AC97SLOT, CDSRCS, GPSRCS, ZVSRCS, MICIDX, ADCIDX, FXIDX, 0xff /* end */ }; -static unsigned char saved_regs_audigy[] = { +static const unsigned char saved_regs_audigy[] = { A_ADCIDX, A_MICIDX, A_FXWC1, A_FXWC2, A_SAMPLE_RATE, A_FXRT2, A_SENDAMOUNTS, A_FXRT1, 0xff /* end */ @@ -2094,7 +2094,7 @@ static void free_pm_buffer(struct snd_emu10k1 *emu) void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu) { int i; - unsigned char *reg; + const unsigned char *reg; unsigned int *val;
val = emu->saved_ptr; @@ -2127,7 +2127,7 @@ void snd_emu10k1_resume_init(struct snd_emu10k1 *emu) void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu) { int i; - unsigned char *reg; + const unsigned char *reg; unsigned int *val;
snd_emu10k1_audio_enable(emu); diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index e0e076a9c321..6b7ff4a94800 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -46,7 +46,7 @@ MODULE_PARM_DESC(high_res_gpr_volume, "GPR mixer controls use 31-bit range."); * Tables */
-static char *fxbuses[16] = { +static const char * const fxbuses[16] = { /* 0x00 */ "PCM Left", /* 0x01 */ "PCM Right", /* 0x02 */ "PCM Surround Left", @@ -65,7 +65,7 @@ static char *fxbuses[16] = { /* 0x0f */ NULL };
-static char *creative_ins[16] = { +static const char * const creative_ins[16] = { /* 0x00 */ "AC97 Left", /* 0x01 */ "AC97 Right", /* 0x02 */ "TTL IEC958 Left", @@ -84,7 +84,7 @@ static char *creative_ins[16] = { /* 0x0f */ NULL };
-static char *audigy_ins[16] = { +static const char * const audigy_ins[16] = { /* 0x00 */ "AC97 Left", /* 0x01 */ "AC97 Right", /* 0x02 */ "Audigy CD Left", @@ -103,7 +103,7 @@ static char *audigy_ins[16] = { /* 0x0f */ NULL };
-static char *creative_outs[32] = { +static const char * const creative_outs[32] = { /* 0x00 */ "AC97 Left", /* 0x01 */ "AC97 Right", /* 0x02 */ "Optical IEC958 Left", @@ -138,7 +138,7 @@ static char *creative_outs[32] = { /* 0x1f */ NULL, };
-static char *audigy_outs[32] = { +static const char * const audigy_outs[32] = { /* 0x00 */ "Digital Front Left", /* 0x01 */ "Digital Front Right", /* 0x02 */ "Digital Center", @@ -2485,7 +2485,7 @@ static int snd_emu10k1_fx8010_open(struct snd_hwdep * hw, struct file *file) return 0; }
-static void copy_string(char *dst, char *src, char *null, int idx) +static void copy_string(char *dst, const char *src, const char *null, int idx) { if (src == NULL) sprintf(dst, "%s %02X", null, idx); @@ -2496,7 +2496,7 @@ static void copy_string(char *dst, char *src, char *null, int idx) static void snd_emu10k1_fx8010_info(struct snd_emu10k1 *emu, struct snd_emu10k1_fx8010_info *info) { - char **fxbus, **extin, **extout; + const char * const *fxbus, * const *extin, * const *extout; unsigned short fxbus_mask, extin_mask, extout_mask; int res;
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index 46c79dfe9844..8a6cbe67e29d 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -183,7 +183,7 @@ static const char * const emu1616_src_texts[] = { /* * List of data sources available for each destination */ -static unsigned int emu1010_src_regs[] = { +static const unsigned int emu1010_src_regs[] = { EMU_SRC_SILENCE,/* 0 */ EMU_SRC_DOCK_MIC_A1, /* 1 */ EMU_SRC_DOCK_MIC_B1, /* 2 */ @@ -240,7 +240,7 @@ static unsigned int emu1010_src_regs[] = { };
/* 1616(m) cardbus */ -static unsigned int emu1616_src_regs[] = { +static const unsigned int emu1616_src_regs[] = { EMU_SRC_SILENCE, EMU_SRC_DOCK_MIC_A1, EMU_SRC_DOCK_MIC_B1, @@ -296,7 +296,7 @@ static unsigned int emu1616_src_regs[] = { * Data destinations - physical EMU outputs. * Each destination has an enum mixer control to choose a data source */ -static unsigned int emu1010_output_dst[] = { +static const unsigned int emu1010_output_dst[] = { EMU_DST_DOCK_DAC1_LEFT1, /* 0 */ EMU_DST_DOCK_DAC1_RIGHT1, /* 1 */ EMU_DST_DOCK_DAC2_LEFT1, /* 2 */ @@ -324,7 +324,7 @@ static unsigned int emu1010_output_dst[] = { };
/* 1616(m) cardbus */ -static unsigned int emu1616_output_dst[] = { +static const unsigned int emu1616_output_dst[] = { EMU_DST_DOCK_DAC1_LEFT1, EMU_DST_DOCK_DAC1_RIGHT1, EMU_DST_DOCK_DAC2_LEFT1, @@ -350,7 +350,7 @@ static unsigned int emu1616_output_dst[] = { * capture (EMU32 + I2S links) * Each destination has an enum mixer control to choose a data source */ -static unsigned int emu1010_input_dst[] = { +static const unsigned int emu1010_input_dst[] = { EMU_DST_ALICE2_EMU32_0, EMU_DST_ALICE2_EMU32_1, EMU_DST_ALICE2_EMU32_2, @@ -1778,8 +1778,8 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu, int err, pcm; struct snd_kcontrol *kctl; struct snd_card *card = emu->card; - char **c; - static char *emu10k1_remove_ctls[] = { + const char * const *c; + static const char * const emu10k1_remove_ctls[] = { /* no AC97 mono, surround, center/lfe */ "Master Mono Playback Switch", "Master Mono Playback Volume", @@ -1793,13 +1793,13 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu, "LFE Playback Volume", NULL }; - static char *emu10k1_rename_ctls[] = { + static const char * const emu10k1_rename_ctls[] = { "Surround Digital Playback Volume", "Surround Playback Volume", "Center Digital Playback Volume", "Center Playback Volume", "LFE Digital Playback Volume", "LFE Playback Volume", NULL }; - static char *audigy_remove_ctls[] = { + static const char * const audigy_remove_ctls[] = { /* Master/PCM controls on ac97 of Audigy has no effect */ /* On the Audigy2 the AC97 playback is piped into * the Philips ADC for 24bit capture */ @@ -1826,7 +1826,7 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu, "External Amplifier", NULL }; - static char *audigy_rename_ctls[] = { + static const char * const audigy_rename_ctls[] = { /* use conventional names */ "Wave Playback Volume", "PCM Playback Volume", /* "Wave Capture Volume", "PCM Capture Volume", */ @@ -1836,7 +1836,7 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu, "Master Mono Playback Volume", "Phone Output Playback Volume", NULL }; - static char *audigy_rename_ctls_i2c_adc[] = { + static const char * const audigy_rename_ctls_i2c_adc[] = { //"Analog Mix Capture Volume","OLD Analog Mix Capture Volume", "Line Capture Volume", "Analog Mix Capture Volume", "Wave Playback Volume", "OLD PCM Playback Volume", @@ -1845,7 +1845,7 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu, "CD Capture Volume", "IEC958 Optical Capture Volume", NULL }; - static char *audigy_remove_ctls_i2c_adc[] = { + static const char * const audigy_remove_ctls_i2c_adc[] = { /* On the Audigy2 ZS Notebook * Capture via WM8775 */ "Mic Capture Volume", @@ -1854,7 +1854,7 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu, "IEC958 Optical Capture Volume", NULL }; - static char *audigy_remove_ctls_1361t_adc[] = { + static const char * const audigy_remove_ctls_1361t_adc[] = { /* On the Audigy2 the AC97 playback is piped into * the Philips ADC for 24bit capture */ "PCM Playback Switch", @@ -1872,7 +1872,7 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu, "Line2 Capture Volume", NULL }; - static char *audigy_rename_ctls_1361t_adc[] = { + static const char * const audigy_rename_ctls_1361t_adc[] = { "Master Playback Switch", "Master Capture Switch", "Master Playback Volume", "Master Capture Volume", "Wave Master Playback Volume", "Master Playback Volume", diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index 637446f19598..6e20cca9c98f 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -26,10 +26,10 @@ static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu, int status_reg, int rate_reg) { - static char *clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" }; - static int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; - static char *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }; - static char *emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" }; + static const char * const clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" }; + static const int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + static const char * const channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }; + static const char * const emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" }; unsigned int status, rate = 0; status = snd_emu10k1_ptr_read(emu, status_reg, 0); @@ -67,7 +67,7 @@ static void snd_emu10k1_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { /* FIXME - output names are in emufx.c too */ - static char *creative_outs[32] = { + static const char * const creative_outs[32] = { /* 00 */ "AC97 Left", /* 01 */ "AC97 Right", /* 02 */ "Optical IEC958 Left", @@ -102,7 +102,7 @@ static void snd_emu10k1_proc_read(struct snd_info_entry *entry, /* 31 */ "???" };
- static char *audigy_outs[64] = { + static const char * const audigy_outs[64] = { /* 00 */ "Digital Front Left", /* 01 */ "Digital Front Right", /* 02 */ "Digital Center", @@ -172,7 +172,7 @@ static void snd_emu10k1_proc_read(struct snd_info_entry *entry, struct snd_emu10k1 *emu = entry->private_data; unsigned int val, val1; int nefx = emu->audigy ? 64 : 32; - char **outputs = emu->audigy ? audigy_outs : creative_outs; + const char * const *outputs = emu->audigy ? audigy_outs : creative_outs; int idx; snd_iprintf(buffer, "EMU10K1\n\n"); @@ -262,7 +262,7 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry, static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { - static int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 }; + static const int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 }; struct snd_emu10k1 *emu = entry->private_data; unsigned int val, tmp, n; val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0); diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index a3f1de7e5fee..e15092ce9848 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c @@ -510,7 +510,7 @@ void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned
unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate) { - static u32 logMagTable[128] = { + static const u32 logMagTable[128] = { 0x00000, 0x02dfc, 0x05b9e, 0x088e6, 0x0b5d6, 0x0e26f, 0x10eb3, 0x13aa2, 0x1663f, 0x1918a, 0x1bc84, 0x1e72e, 0x2118b, 0x23b9a, 0x2655d, 0x28ed5, 0x2b803, 0x2e0e8, 0x30985, 0x331db, 0x359eb, 0x381b6, 0x3a93d, 0x3d081, @@ -528,7 +528,7 @@ unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate) 0xe829f, 0xe9b31, 0xeb3a9, 0xecc08, 0xee44c, 0xefc78, 0xf148a, 0xf2c83, 0xf4463, 0xf5c2a, 0xf73da, 0xf8b71, 0xfa2f0, 0xfba57, 0xfd1a7, 0xfe8df }; - static char logSlopeTable[128] = { + static const char logSlopeTable[128] = { 0x5c, 0x5c, 0x5b, 0x5a, 0x5a, 0x59, 0x58, 0x58, 0x57, 0x56, 0x56, 0x55, 0x55, 0x54, 0x53, 0x53, 0x52, 0x52, 0x51, 0x51, 0x50, 0x50, 0x4f, 0x4f,
Apply const prefix to each lbus path table definition and its callers.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/riptide/riptide.c | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 625c85428955..b4f300281822 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -361,9 +361,9 @@ enum RT_CHANNEL_IDS { enum { SB_CMD = 0, MODEM_CMD, I2S_CMD0, I2S_CMD1, FM_CMD, MAX_CMD };
struct lbuspath { - unsigned char *noconv; - unsigned char *stereo; - unsigned char *mono; + const unsigned char *noconv; + const unsigned char *stereo; + const unsigned char *mono; };
struct cmdport { @@ -464,7 +464,7 @@ struct sgd { /* scatter gather desriptor */
struct pcmhw { /* pcm descriptor */ struct lbuspath paths; - unsigned char *lbuspath; + const unsigned char *lbuspath; unsigned char source; unsigned char intdec[2]; unsigned char mixer; @@ -517,7 +517,7 @@ MODULE_DEVICE_TABLE(pci, snd_riptide_ids); /* */
-static unsigned char lbusin2out[E2SINK_MAX + 1][2] = { +static const unsigned char lbusin2out[E2SINK_MAX + 1][2] = { {NO_OUT, LS_NONE1}, {NO_OUT, LS_NONE2}, {NO_OUT, LS_NONE1}, {NO_OUT, LS_NONE2}, {NO_OUT, LS_NONE1}, {NO_OUT, LS_NONE2}, {NO_OUT, LS_NONE1}, {NO_OUT, @@ -557,63 +557,63 @@ static unsigned char lbusin2out[E2SINK_MAX + 1][2] = { LS_NONE2}, };
-static unsigned char lbus_play_opl3[] = { +static const unsigned char lbus_play_opl3[] = { DIGITAL_MIXER_IN0 + FM_MIXER, 0xff }; -static unsigned char lbus_play_modem[] = { +static const unsigned char lbus_play_modem[] = { DIGITAL_MIXER_IN0 + MODEM_MIXER, 0xff }; -static unsigned char lbus_play_i2s[] = { +static const unsigned char lbus_play_i2s[] = { INTER0_IN + I2S_INTDEC, DIGITAL_MIXER_IN0 + I2S_MIXER, 0xff }; -static unsigned char lbus_play_out[] = { +static const unsigned char lbus_play_out[] = { PDAC2ACLNK, 0xff }; -static unsigned char lbus_play_outhp[] = { +static const unsigned char lbus_play_outhp[] = { HNDSPK2ACLNK, 0xff }; -static unsigned char lbus_play_noconv1[] = { +static const unsigned char lbus_play_noconv1[] = { DIGITAL_MIXER_IN0, 0xff }; -static unsigned char lbus_play_stereo1[] = { +static const unsigned char lbus_play_stereo1[] = { INTER0_IN, DIGITAL_MIXER_IN0, 0xff }; -static unsigned char lbus_play_mono1[] = { +static const unsigned char lbus_play_mono1[] = { INTERM0_IN, DIGITAL_MIXER_IN0, 0xff }; -static unsigned char lbus_play_noconv2[] = { +static const unsigned char lbus_play_noconv2[] = { DIGITAL_MIXER_IN1, 0xff }; -static unsigned char lbus_play_stereo2[] = { +static const unsigned char lbus_play_stereo2[] = { INTER1_IN, DIGITAL_MIXER_IN1, 0xff }; -static unsigned char lbus_play_mono2[] = { +static const unsigned char lbus_play_mono2[] = { INTERM1_IN, DIGITAL_MIXER_IN1, 0xff }; -static unsigned char lbus_play_noconv3[] = { +static const unsigned char lbus_play_noconv3[] = { DIGITAL_MIXER_IN2, 0xff }; -static unsigned char lbus_play_stereo3[] = { +static const unsigned char lbus_play_stereo3[] = { INTER2_IN, DIGITAL_MIXER_IN2, 0xff }; -static unsigned char lbus_play_mono3[] = { +static const unsigned char lbus_play_mono3[] = { INTERM2_IN, DIGITAL_MIXER_IN2, 0xff }; -static unsigned char lbus_rec_noconv1[] = { +static const unsigned char lbus_rec_noconv1[] = { LBUS2ARM_FIFO5, 0xff }; -static unsigned char lbus_rec_stereo1[] = { +static const unsigned char lbus_rec_stereo1[] = { DECIM0_IN, LBUS2ARM_FIFO5, 0xff }; -static unsigned char lbus_rec_mono1[] = { +static const unsigned char lbus_rec_mono1[] = { DECIMM3_IN, LBUS2ARM_FIFO5, 0xff };
-static unsigned char play_ids[] = { 4, 1, 2, }; -static unsigned char play_sources[] = { +static const unsigned char play_ids[] = { 4, 1, 2, }; +static const unsigned char play_sources[] = { ARM2LBUS_FIFO4, ARM2LBUS_FIFO1, ARM2LBUS_FIFO2, }; -static struct lbuspath lbus_play_paths[] = { +static const struct lbuspath lbus_play_paths[] = { { .noconv = lbus_play_noconv1, .stereo = lbus_play_stereo1, @@ -737,7 +737,7 @@ static int loadfirmware(struct cmdif *cif, const unsigned char *img,
static void alloclbuspath(struct cmdif *cif, unsigned char source, - unsigned char *path, unsigned char *mixer, unsigned char *s) + const unsigned char *path, unsigned char *mixer, unsigned char *s) { while (*path != 0xff) { unsigned char sink, type; @@ -765,7 +765,7 @@ alloclbuspath(struct cmdif *cif, unsigned char source, } } if (*path++ & SPLIT_PATH) { - unsigned char *npath = path; + const unsigned char *npath = path;
while (*npath != 0xff) npath++; @@ -775,7 +775,7 @@ alloclbuspath(struct cmdif *cif, unsigned char source, }
static void -freelbuspath(struct cmdif *cif, unsigned char source, unsigned char *path) +freelbuspath(struct cmdif *cif, unsigned char source, const unsigned char *path) { while (*path != 0xff) { unsigned char sink; @@ -787,7 +787,7 @@ freelbuspath(struct cmdif *cif, unsigned char source, unsigned char *path) source = lbusin2out[sink][0]; } if (*path++ & SPLIT_PATH) { - unsigned char *npath = path; + const unsigned char *npath = path;
while (*npath != 0xff) npath++; @@ -1441,7 +1441,7 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; struct pcmhw *data = get_pcmhwdev(substream); struct cmdif *cif = chip->cif; - unsigned char *lbuspath = NULL; + const unsigned char *lbuspath = NULL; unsigned int rate, channels; int err = 0; snd_pcm_format_t format;
Apply const prefix to each possible place: the EEPROM tables, the static string arrays, the init verb tables, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ice1712/aureon.c | 8 ++++---- sound/pci/ice1712/juli.c | 6 +++--- sound/pci/ice1712/maya44.c | 10 +++++----- sound/pci/ice1712/phase.c | 4 ++-- sound/pci/ice1712/pontis.c | 2 +- sound/pci/ice1712/prodigy192.c | 2 +- sound/pci/ice1712/prodigy_hifi.c | 16 ++++++++-------- sound/pci/ice1712/psc724.c | 2 +- sound/pci/ice1712/quartet.c | 8 ++++---- sound/pci/ice1712/se.c | 8 ++++---- sound/pci/ice1712/vt1720_mobo.c | 4 ++-- sound/pci/ice1712/wtm.c | 6 +++--- 12 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 025fe7820620..9a30f6d35d13 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c @@ -2133,7 +2133,7 @@ static int aureon_init(struct snd_ice1712 *ice) * hence the driver needs to sets up it properly. */
-static unsigned char aureon51_eeprom[] = { +static const unsigned char aureon51_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x0a, /* clock 512, spdif-in/ADC, 3DACs */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */ @@ -2149,7 +2149,7 @@ static unsigned char aureon51_eeprom[] = { [ICE_EEP2_GPIO_STATE2] = 0x00, };
-static unsigned char aureon71_eeprom[] = { +static const unsigned char aureon71_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x0b, /* clock 512, spdif-in/ADC, 4DACs */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */ @@ -2166,7 +2166,7 @@ static unsigned char aureon71_eeprom[] = { }; #define prodigy71_eeprom aureon71_eeprom
-static unsigned char aureon71_universe_eeprom[] = { +static const unsigned char aureon71_universe_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, spdif-in/ADC, * 4DACs */ @@ -2184,7 +2184,7 @@ static unsigned char aureon71_universe_eeprom[] = { [ICE_EEP2_GPIO_STATE2] = 0x00, };
-static unsigned char prodigy71lt_eeprom[] = { +static const unsigned char prodigy71lt_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x4b, /* clock 384, spdif-in/ADC, 4DACs */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */ diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index 079e58ec8b09..7be4eb42f05e 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c @@ -397,7 +397,7 @@ static const struct snd_kcontrol_new juli_mute_controls[] = { }, };
-static char *slave_vols[] = { +static const char * const slave_vols[] = { PCM_VOLUME, MONITOR_AN_IN_VOLUME, MONITOR_DIG_IN_VOLUME, @@ -420,7 +420,7 @@ static struct snd_kcontrol *ctl_find(struct snd_card *card,
static void add_slaves(struct snd_card *card, struct snd_kcontrol *master, - char * const *list) + const char * const *list) { for (; *list; list++) { struct snd_kcontrol *slave = ctl_find(card, *list); @@ -651,7 +651,7 @@ static int juli_init(struct snd_ice1712 *ice) * hence the driver needs to sets up it properly. */
-static unsigned char juli_eeprom[] = { +static const unsigned char juli_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, 1xADC, 1xDACs, SPDIF in */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ diff --git a/sound/pci/ice1712/maya44.c b/sound/pci/ice1712/maya44.c index c2761e009c67..b46df1821251 100644 --- a/sound/pci/ice1712/maya44.c +++ b/sound/pci/ice1712/maya44.c @@ -116,7 +116,7 @@ struct maya_vol_info { unsigned char mux_bits[2]; /* extra bits for ADC mute */ };
-static struct maya_vol_info vol_info[WM_NUM_VOLS] = { +static const struct maya_vol_info vol_info[WM_NUM_VOLS] = { [WM_VOL_HP] = { .maxval = 80, .regs = { WM8776_REG_HEADPHONE_L, WM8776_REG_HEADPHONE_R }, @@ -158,7 +158,7 @@ static int maya_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { unsigned int idx = kcontrol->private_value; - struct maya_vol_info *vol = &vol_info[idx]; + const struct maya_vol_info *vol = &vol_info[idx];
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -189,7 +189,7 @@ static int maya_vol_put(struct snd_kcontrol *kcontrol, struct snd_wm8776 *wm = &chip->wm[snd_ctl_get_ioff(kcontrol, &ucontrol->id)]; unsigned int idx = kcontrol->private_value; - struct maya_vol_info *vol = &vol_info[idx]; + const struct maya_vol_info *vol = &vol_info[idx]; unsigned int val, data; int ch, changed = 0;
@@ -662,7 +662,7 @@ static const struct snd_pcm_hw_constraint_list dac_rates = { /* * chip addresses on I2C bus */ -static unsigned char wm8776_addr[2] = { +static const unsigned char wm8776_addr[2] = { 0x34, 0x36, /* codec 0 & 1 */ };
@@ -712,7 +712,7 @@ static int maya44_init(struct snd_ice1712 *ice) * hence the driver needs to sets up it properly. */
-static unsigned char maya44_eeprom[] = { +static const unsigned char maya44_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x45, /* clock xin1=49.152MHz, mpu401, 2 stereo ADCs+DACs */ [ICE_EEP2_ACLINK] = 0x80, diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c index ced4a2bfd08e..1e47e46ab8ac 100644 --- a/sound/pci/ice1712/phase.c +++ b/sound/pci/ice1712/phase.c @@ -157,7 +157,7 @@ static int phase22_add_controls(struct snd_ice1712 *ice) return 0; }
-static unsigned char phase22_eeprom[] = { +static const unsigned char phase22_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x28, /* clock 512, mpu 401, spdif-in/1xADC, 1xDACs */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ @@ -174,7 +174,7 @@ static unsigned char phase22_eeprom[] = { [ICE_EEP2_GPIO_STATE2] = 0x00, };
-static unsigned char phase28_eeprom[] = { +static const unsigned char phase28_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, spdif-in/1xADC, 4xDACs */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c index 8ddb6c35a5e6..683909ca147c 100644 --- a/sound/pci/ice1712/pontis.c +++ b/sound/pci/ice1712/pontis.c @@ -778,7 +778,7 @@ static int pontis_init(struct snd_ice1712 *ice) * hence the driver needs to sets up it properly. */
-static unsigned char pontis_eeprom[] = { +static const unsigned char pontis_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x08, /* clock 256, mpu401, spdif-in/ADC, 1DAC */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ [ICE_EEP2_I2S] = 0xf8, /* vol, 96k, 24bit, 192k */ diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 105716961e39..8df14f63b10d 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c @@ -753,7 +753,7 @@ static int prodigy192_init(struct snd_ice1712 *ice) * hence the driver needs to sets up it properly. */
-static unsigned char prodigy71_eeprom[] = { +static const unsigned char prodigy71_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x6a, /* 49MHz crystal, mpu401, * spdif-in+ 1 stereo ADC, * 3 stereo DACs diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c index ba37f7eab166..91f83cef0e56 100644 --- a/sound/pci/ice1712/prodigy_hifi.c +++ b/sound/pci/ice1712/prodigy_hifi.c @@ -930,7 +930,7 @@ static int prodigy_hd2_add_controls(struct snd_ice1712 *ice)
static void wm8766_init(struct snd_ice1712 *ice) { - static unsigned short wm8766_inits[] = { + static const unsigned short wm8766_inits[] = { WM8766_RESET, 0x0000, WM8766_DAC_CTRL, 0x0120, WM8766_INT_CTRL, 0x0022, /* I2S Normal Mode, 24 bit */ @@ -953,7 +953,7 @@ static void wm8766_init(struct snd_ice1712 *ice)
static void wm8776_init(struct snd_ice1712 *ice) { - static unsigned short wm8776_inits[] = { + static const unsigned short wm8776_inits[] = { /* These come first to reduce init pop noise */ WM_ADC_MUX, 0x0003, /* ADC mute */ /* 0x00c0 replaced by 0x0003 */ @@ -973,7 +973,7 @@ static void wm8776_init(struct snd_ice1712 *ice) #ifdef CONFIG_PM_SLEEP static int prodigy_hifi_resume(struct snd_ice1712 *ice) { - static unsigned short wm8776_reinit_registers[] = { + static const unsigned short wm8776_reinit_registers[] = { WM_MASTER_CTRL, WM_DAC_INT, WM_ADC_INT, @@ -1033,7 +1033,7 @@ static int prodigy_hifi_resume(struct snd_ice1712 *ice) */ static int prodigy_hifi_init(struct snd_ice1712 *ice) { - static unsigned short wm8776_defaults[] = { + static const unsigned short wm8776_defaults[] = { WM_MASTER_CTRL, 0x0022, /* 256fs, slave mode */ WM_DAC_INT, 0x0022, /* I2S, normal polarity, 24bit */ WM_ADC_INT, 0x0022, /* I2S, normal polarity, 24bit */ @@ -1108,7 +1108,7 @@ static int prodigy_hifi_init(struct snd_ice1712 *ice) */ static void ak4396_init(struct snd_ice1712 *ice) { - static unsigned short ak4396_inits[] = { + static const unsigned short ak4396_inits[] = { AK4396_CTRL1, 0x87, /* I2S Normal Mode, 24 bit */ AK4396_CTRL2, 0x02, AK4396_CTRL3, 0x00, @@ -1180,7 +1180,7 @@ static int prodigy_hd2_init(struct snd_ice1712 *ice) }
-static unsigned char prodigy71hifi_eeprom[] = { +static const unsigned char prodigy71hifi_eeprom[] = { 0x4b, /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */ 0x80, /* ACLINK: I2S */ 0xfc, /* I2S: vol, 96k, 24bit, 192k */ @@ -1196,7 +1196,7 @@ static unsigned char prodigy71hifi_eeprom[] = { 0x00, /* GPIO_STATE2 */ };
-static unsigned char prodigyhd2_eeprom[] = { +static const unsigned char prodigyhd2_eeprom[] = { 0x4b, /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */ 0x80, /* ACLINK: I2S */ 0xfc, /* I2S: vol, 96k, 24bit, 192k */ @@ -1212,7 +1212,7 @@ static unsigned char prodigyhd2_eeprom[] = { 0x00, /* GPIO_STATE2 */ };
-static unsigned char fortissimo4_eeprom[] = { +static const unsigned char fortissimo4_eeprom[] = { 0x43, /* SYSCONF: clock 512, ADC, 4DACs */ 0x80, /* ACLINK: I2S */ 0xfc, /* I2S: vol, 96k, 24bit, 192k */ diff --git a/sound/pci/ice1712/psc724.c b/sound/pci/ice1712/psc724.c index 7287ebed2b5a..7aa3f92040d0 100644 --- a/sound/pci/ice1712/psc724.c +++ b/sound/pci/ice1712/psc724.c @@ -420,7 +420,7 @@ static void psc724_exit(struct snd_ice1712 *ice) }
/* PSC724 has buggy EEPROM (no 96&192kHz, all FFh GPIOs), so override it here */ -static unsigned char psc724_eeprom[] = { +static const unsigned char psc724_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x42, /* 49.152MHz, 1 ADC, 3 DACs */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ [ICE_EEP2_I2S] = 0xf0, /* I2S volume, 96kHz, 24bit */ diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c index bfd811a08d90..866596205710 100644 --- a/sound/pci/ice1712/quartet.c +++ b/sound/pci/ice1712/quartet.c @@ -657,7 +657,7 @@ static int qtet_php_put(struct snd_kcontrol *kcontrol, .get_register = get_##xreg,\ .texts = {xtext1, xtext2} }
-static struct qtet_kcontrol_private qtet_privates[] = { +static const struct qtet_kcontrol_private qtet_privates[] = { PRIV_ENUM2(IN12_SEL, CPLD_IN12_SEL, cpld, "An In 1/2", "An In 3/4"), PRIV_ENUM2(IN34_SEL, CPLD_IN34_SEL, cpld, "An In 3/4", "IEC958 In"), PRIV_ENUM2(AIN34_SEL, SCR_AIN34_SEL, scr, "Line In 3/4", "Hi-Z"), @@ -757,7 +757,7 @@ static const struct snd_kcontrol_new qtet_controls[] = { QTET_CONTROL("Output 3/4 to Monitor 1/2", sw, OUT34_MON12), };
-static char *slave_vols[] = { +static const char * const slave_vols[] = { PCM_12_PLAYBACK_VOLUME, PCM_34_PLAYBACK_VOLUME, NULL @@ -777,7 +777,7 @@ static struct snd_kcontrol *ctl_find(struct snd_card *card, }
static void add_slaves(struct snd_card *card, - struct snd_kcontrol *master, char * const *list) + struct snd_kcontrol *master, const char * const *list) { for (; *list; list++) { struct snd_kcontrol *slave = ctl_find(card, *list); @@ -1053,7 +1053,7 @@ static int qtet_init(struct snd_ice1712 *ice) return 0; }
-static unsigned char qtet_eeprom[] = { +static const unsigned char qtet_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x28, /* clock 256(24MHz), mpu401, 1xADC, 1xDACs, SPDIF in */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ diff --git a/sound/pci/ice1712/se.c b/sound/pci/ice1712/se.c index fdc502783e07..ffa9d8860a5a 100644 --- a/sound/pci/ice1712/se.c +++ b/sound/pci/ice1712/se.c @@ -245,7 +245,7 @@ static const char * const se200pci_sel[] = { static void se200pci_WM8776_set_input_selector(struct snd_ice1712 *ice, unsigned int sel) { - static unsigned char vals[] = { + static const unsigned char vals[] = { /* LINE, CD, MIC, ALL, GND */ 0x10, 0x04, 0x08, 0x1c, 0x03 }; @@ -288,7 +288,7 @@ static void se200pci_WM8776_set_agc(struct snd_ice1712 *ice, unsigned int agc) static void se200pci_WM8776_init(struct snd_ice1712 *ice) { int i; - static unsigned short default_values[] = { + static const unsigned short default_values[] = { 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x000, 0x090, 0x000, 0x000, @@ -701,7 +701,7 @@ static int se_add_controls(struct snd_ice1712 *ice) /* entry point */ /****************************************************************************/
-static unsigned char se200pci_eeprom[] = { +static const unsigned char se200pci_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x4b, /* 49.152Hz, spdif-in/ADC, 4DACs */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ [ICE_EEP2_I2S] = 0x78, /* 96k-ok, 24bit, 192k-ok */ @@ -720,7 +720,7 @@ static unsigned char se200pci_eeprom[] = { [ICE_EEP2_GPIO_STATE2] = 0x07, /* WM8766 ML/MC/MD */ };
-static unsigned char se90pci_eeprom[] = { +static const unsigned char se90pci_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x4b, /* 49.152Hz, spdif-in/ADC, 4DACs */ [ICE_EEP2_ACLINK] = 0x80, /* I2S */ [ICE_EEP2_I2S] = 0x78, /* 96k-ok, 24bit, 192k-ok */ diff --git a/sound/pci/ice1712/vt1720_mobo.c b/sound/pci/ice1712/vt1720_mobo.c index 3d240125a644..47470b07197c 100644 --- a/sound/pci/ice1712/vt1720_mobo.c +++ b/sound/pci/ice1712/vt1720_mobo.c @@ -39,7 +39,7 @@ static int k8x800_add_controls(struct snd_ice1712 *ice)
/* EEPROM image */
-static unsigned char k8x800_eeprom[] = { +static const unsigned char k8x800_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x01, /* clock 256, 1ADC, 2DACs */ [ICE_EEP2_ACLINK] = 0x02, /* ACLINK, packed */ [ICE_EEP2_I2S] = 0x00, /* - */ @@ -55,7 +55,7 @@ static unsigned char k8x800_eeprom[] = { [ICE_EEP2_GPIO_STATE2] = 0x00, /* - */ };
-static unsigned char sn25p_eeprom[] = { +static const unsigned char sn25p_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x01, /* clock 256, 1ADC, 2DACs */ [ICE_EEP2_ACLINK] = 0x02, /* ACLINK, packed */ [ICE_EEP2_I2S] = 0x00, /* - */ diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c index 4a7315ad51e8..f613f0067d8c 100644 --- a/sound/pci/ice1712/wtm.c +++ b/sound/pci/ice1712/wtm.c @@ -567,12 +567,12 @@ static int wtm_add_controls(struct snd_ice1712 *ice)
static int wtm_init(struct snd_ice1712 *ice) { - static unsigned short stac_inits_wtm[] = { + static const unsigned short stac_inits_wtm[] = { STAC946X_RESET, 0, STAC946X_MASTER_CLOCKING, 0x11, (unsigned short)-1 }; - unsigned short *p; + const unsigned short *p; struct wtm_spec *spec;
/*WTM 192M*/ @@ -599,7 +599,7 @@ static int wtm_init(struct snd_ice1712 *ice) }
-static unsigned char wtm_eeprom[] = { +static const unsigned char wtm_eeprom[] = { [ICE_EEP2_SYSCONF] = 0x67, /*SYSCONF: clock 192KHz, mpu401, 4ADC, 8DAC */ [ICE_EEP2_ACLINK] = 0x80, /* ACLINK : I2S */
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,
Apply const prefix to each channel map table and its callers.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/hdsp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 632f7878ff3e..ba2a47dd384c 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -479,7 +479,7 @@ struct hdsp { pid_t playback_pid; int running; int system_sample_rate; - char *channel_map; + const char *channel_map; int dev; int irq; unsigned long port; @@ -501,12 +501,12 @@ struct hdsp { where the data for that channel can be read/written from/to. */
-static char channel_map_df_ss[HDSP_MAX_CHANNELS] = { +static const char channel_map_df_ss[HDSP_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, 24, 25 };
-static char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */ +static const char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */ /* Analog */ 0, 1, 2, 3, 4, 5, 6, 7, /* ADAT 2 */ @@ -516,7 +516,7 @@ static char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */ -1, -1, -1, -1, -1, -1, -1, -1 };
-static char channel_map_ds[HDSP_MAX_CHANNELS] = { +static const char channel_map_ds[HDSP_MAX_CHANNELS] = { /* ADAT channels are remapped */ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, /* channels 12 and 13 are S/PDIF */ @@ -525,7 +525,7 @@ static char channel_map_ds[HDSP_MAX_CHANNELS] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
-static char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = { +static const char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = { /* ADAT channels */ 0, 1, 2, 3, 4, 5, 6, 7, /* SPDIF */ @@ -539,7 +539,7 @@ static char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = { -1, -1 };
-static char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = { +static const char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = { /* ADAT */ 1, 3, 5, 7, /* SPDIF */ @@ -553,7 +553,7 @@ static char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = { -1, -1, -1, -1, -1, -1 };
-static char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = { +static const char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = { /* ADAT is disabled in this mode */ /* SPDIF */ 8, 9,
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 */
Apply const prefix to the channel map tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/rme9652.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 2cb5b03f84d3..c20e590eb570 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -229,7 +229,7 @@ struct snd_rme9652 { int last_spdif_sample_rate; /* so that we can catch externally ... */ int last_adat_sample_rate; /* ... induced rate changes */
- char *channel_map; + const char *channel_map;
struct snd_card *card; struct snd_pcm *pcm; @@ -246,12 +246,12 @@ struct snd_rme9652 { where the data for that channel can be read/written from/to. */
-static char channel_map_9652_ss[26] = { +static const char channel_map_9652_ss[26] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 };
-static char channel_map_9636_ss[26] = { +static const char channel_map_9636_ss[26] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* channels 16 and 17 are S/PDIF */ 24, 25, @@ -259,7 +259,7 @@ static char channel_map_9636_ss[26] = { -1, -1, -1, -1, -1, -1, -1, -1 };
-static char channel_map_9652_ds[26] = { +static const char channel_map_9652_ds[26] = { /* ADAT channels are remapped */ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, /* channels 12 and 13 are S/PDIF */ @@ -268,7 +268,7 @@ static char channel_map_9652_ds[26] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
-static char channel_map_9636_ds[26] = { +static const char channel_map_9636_ds[26] = { /* ADAT channels are remapped */ 1, 3, 5, 7, 9, 11, 13, 15, /* channels 8 and 9 are S/PDIF */
Apply const prefix to each possible place: the MIDI data definitions, the static tables for volume parameters, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/synth/emux/emux_nrpn.c | 4 ++-- sound/synth/emux/emux_synth.c | 10 +++++----- sound/synth/emux/soundfont.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/sound/synth/emux/emux_nrpn.c b/sound/synth/emux/emux_nrpn.c index 1ac22676d464..7eed5791972c 100644 --- a/sound/synth/emux/emux_nrpn.c +++ b/sound/synth/emux/emux_nrpn.c @@ -63,7 +63,7 @@ static int send_converted_effect(const struct nrpn_conv_table *table, /* effect sensitivities for GS NRPN: * adjusted for chaos 8MB soundfonts */ -static int gs_sense[] = +static const int gs_sense[] = { DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE, DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY @@ -72,7 +72,7 @@ static int gs_sense[] = /* effect sensitivies for XG controls: * adjusted for chaos 8MB soundfonts */ -static int xg_sense[] = +static const int xg_sense[] = { DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE, DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c index 7c9eecd4d14e..a5385efcedb6 100644 --- a/sound/synth/emux/emux_synth.c +++ b/sound/synth/emux/emux_synth.c @@ -529,7 +529,7 @@ update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update)
#if 0 // not used /* table for volume target calculation */ -static unsigned short voltarget[16] = { +static const unsigned short voltarget[16] = { 0xEAC0, 0xE0C8, 0xD740, 0xCE20, 0xC560, 0xBD08, 0xB500, 0xAD58, 0xA5F8, 0x9EF0, 0x9830, 0x91C0, 0x8B90, 0x85A8, 0x8000, 0x7A90 }; @@ -616,7 +616,7 @@ setup_voice(struct snd_emux_voice *vp) /* * calculate pitch parameter */ -static unsigned char pan_volumes[256] = { +static const unsigned char pan_volumes[256] = { 0x00,0x03,0x06,0x09,0x0c,0x0f,0x12,0x14,0x17,0x1a,0x1d,0x20,0x22,0x25,0x28,0x2a, 0x2d,0x30,0x32,0x35,0x37,0x3a,0x3c,0x3f,0x41,0x44,0x46,0x49,0x4b,0x4d,0x50,0x52, 0x54,0x57,0x59,0x5b,0x5d,0x60,0x62,0x64,0x66,0x68,0x6a,0x6c,0x6f,0x71,0x73,0x75, @@ -684,7 +684,7 @@ calc_pan(struct snd_emux_voice *vp) */
/* tables for volume->attenuation calculation */ -static unsigned char voltab1[128] = { +static const unsigned char voltab1[128] = { 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x2b, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e, 0x1e, 0x1d, 0x1c, 0x1b, 0x1b, 0x1a, @@ -700,7 +700,7 @@ static unsigned char voltab1[128] = { 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static unsigned char voltab2[128] = { +static const unsigned char voltab2[128] = { 0x32, 0x31, 0x30, 0x2f, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x2a, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x24, 0x23, 0x22, 0x21, 0x21, 0x20, 0x1f, 0x1e, 0x1e, 0x1d, 0x1c, 0x1c, 0x1b, 0x1a, @@ -716,7 +716,7 @@ static unsigned char voltab2[128] = { 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
-static unsigned char expressiontab[128] = { +static const unsigned char expressiontab[128] = { 0x7f, 0x6c, 0x62, 0x5a, 0x54, 0x50, 0x4b, 0x48, 0x45, 0x42, 0x40, 0x3d, 0x3b, 0x39, 0x38, 0x36, 0x34, 0x33, 0x31, 0x30, 0x2f, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, 0x25, diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index dcc6a925a03e..9ebc711afa6b 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c @@ -751,7 +751,7 @@ load_data(struct snd_sf_list *sflist, const void __user *data, long count)
/* log2_tbl[i] = log2(i+128) * 0x10000 */ -static int log_tbl[129] = { +static const int log_tbl[129] = { 0x70000, 0x702df, 0x705b9, 0x7088e, 0x70b5d, 0x70e26, 0x710eb, 0x713aa, 0x71663, 0x71918, 0x71bc8, 0x71e72, 0x72118, 0x723b9, 0x72655, 0x728ed, 0x72b80, 0x72e0e, 0x73098, 0x7331d, 0x7359e, 0x7381b, 0x73a93, 0x73d08, @@ -857,7 +857,7 @@ calc_gus_envelope_time(int rate, int start, int end) /* convert envelope time parameter to soundfont parameters */
/* attack & decay/release time table (msec) */ -static short attack_time_tbl[128] = { +static const short attack_time_tbl[128] = { 32767, 32767, 5989, 4235, 2994, 2518, 2117, 1780, 1497, 1373, 1259, 1154, 1058, 970, 890, 816, 707, 691, 662, 634, 607, 581, 557, 533, 510, 489, 468, 448, 429, 411, 393, 377, 361, 345, 331, 317, 303, 290, 278, 266, 255, 244, 234, 224, 214, 205, 196, 188, @@ -868,7 +868,7 @@ static short attack_time_tbl[128] = { 11, 11, 10, 10, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 6, 0, };
-static short decay_time_tbl[128] = { +static const short decay_time_tbl[128] = { 32767, 32767, 22614, 15990, 11307, 9508, 7995, 6723, 5653, 5184, 4754, 4359, 3997, 3665, 3361, 3082, 2828, 2765, 2648, 2535, 2428, 2325, 2226, 2132, 2042, 1955, 1872, 1793, 1717, 1644, 1574, 1507, 1443, 1382, 1324, 1267, 1214, 1162, 1113, 1066, 978, 936, 897, 859, 822, 787, 754, 722, @@ -891,7 +891,7 @@ snd_sf_calc_parm_hold(int msec)
/* search an index for specified time from given time table */ static int -calc_parm_search(int msec, short *table) +calc_parm_search(int msec, const short *table) { int left = 1, right = 127, mid; while (left < right) {
Apply const prefix to each possible place: the string array and the parameter tables and callers.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/usb/usx2y/usX2Yhwdep.c | 2 +- sound/usb/usx2y/usbusx2yaudio.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 0e6d82b5778e..22412cd69e98 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c @@ -94,7 +94,7 @@ static __poll_t snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, poll static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, struct snd_hwdep_dsp_status *info) { - static char *type_ids[USX2Y_TYPE_NUMS] = { + static const char * const type_ids[USX2Y_TYPE_NUMS] = { [USX2Y_TYPE_122] = "us122", [USX2Y_TYPE_224] = "us224", [USX2Y_TYPE_428] = "us428", diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index c7dbc0f94efb..772f6f3ccbb1 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c @@ -549,7 +549,7 @@ static int snd_usX2Y_pcm_trigger(struct snd_pcm_substream *substream, int cmd) * if sg buffer is supported on the later version of alsa, we'll follow * that. */ -static struct s_c2 +static const struct s_c2 { char c1, c2; } @@ -589,7 +589,7 @@ static struct s_c2 { 0x18, 0x7C}, { 0x18, 0x7E} }; -static struct s_c2 SetRate48000[] = +static const struct s_c2 SetRate48000[] = { { 0x14, 0x09}, // this line sets 48000, well actually a little less { 0x18, 0x40}, // only tascam / frontier design knows the further lines ....... @@ -642,7 +642,7 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) int err = 0, i; struct snd_usX2Y_urbSeq *us = NULL; int *usbdata = NULL; - struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100; + const struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100;
if (usX2Y->rate != rate) { us = kzalloc(sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS, GFP_KERNEL);
Apply const prefix to each possible place: the board parameters and DSP command table, and the string arrays.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/pcxhr/pcxhr.c | 2 +- sound/pci/pcxhr/pcxhr_core.c | 6 +++--- sound/pci/pcxhr/pcxhr_hwdep.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 9e59d591217b..c2e4831c3a13 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -136,7 +136,7 @@ struct board_parameters { short fw_file_set; short firmware_num; }; -static struct board_parameters pcxhr_board_params[] = { +static const struct board_parameters pcxhr_board_params[] = { [PCI_ID_VX882HR] = { "VX882HR", 4, 4, 0, 41 }, [PCI_ID_PCX882HR] = { "PCX882HR", 4, 4, 0, 41 }, [PCI_ID_VX881HR] = { "VX881HR", 4, 4, 0, 41 }, diff --git a/sound/pci/pcxhr/pcxhr_core.c b/sound/pci/pcxhr/pcxhr_core.c index 495be27e3ba2..87d24224c042 100644 --- a/sound/pci/pcxhr/pcxhr_core.c +++ b/sound/pci/pcxhr/pcxhr_core.c @@ -466,7 +466,7 @@ enum { /* * Array of DSP commands */ -static struct pcxhr_cmd_info pcxhr_dsp_cmds[] = { +static const struct pcxhr_cmd_info pcxhr_dsp_cmds[] = { [CMD_VERSION] = { 0x010000, 1, RMH_SSIZE_FIXED }, [CMD_SUPPORTED] = { 0x020000, 4, RMH_SSIZE_FIXED }, [CMD_TEST_IT] = { 0x040000, 1, RMH_SSIZE_FIXED }, @@ -497,7 +497,7 @@ static struct pcxhr_cmd_info pcxhr_dsp_cmds[] = { };
#ifdef CONFIG_SND_DEBUG_VERBOSE -static char* cmd_names[] = { +static const char * const cmd_names[] = { [CMD_VERSION] = "CMD_VERSION", [CMD_SUPPORTED] = "CMD_SUPPORTED", [CMD_TEST_IT] = "CMD_TEST_IT", @@ -1006,7 +1006,7 @@ static int pcxhr_handle_async_err(struct pcxhr_mgr *mgr, u32 err, enum pcxhr_async_err_src err_src, int pipe, int is_capture) { - static char* err_src_name[] = { + static const char * const err_src_name[] = { [PCXHR_ERR_PIPE] = "Pipe", [PCXHR_ERR_STREAM] = "Stream", [PCXHR_ERR_AUDIO] = "Audio" diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c index 12a6bdb920b2..2258bd698844 100644 --- a/sound/pci/pcxhr/pcxhr_hwdep.c +++ b/sound/pci/pcxhr/pcxhr_hwdep.c @@ -348,7 +348,7 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index, */ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) { - static char *fw_files[][5] = { + static const char * const fw_files[][5] = { [0] = { "xlxint.dat", "xlxc882hr.dat", "dspe882.e56", "dspb882hr.b56", "dspd882.d56" }, [1] = { "xlxint.dat", "xlxc882e.dat",
Apply const prefix to each possible place: the string arrays and the static tables for volumes.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/mixart/mixart_hwdep.c | 2 +- sound/pci/mixart/mixart_mixer.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index 92b051c6572d..13dcb2fd0a85 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c @@ -548,7 +548,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
int snd_mixart_setup_firmware(struct mixart_mgr *mgr) { - static char *fw_files[3] = { + static const char * const fw_files[3] = { "miXart8.xlx", "miXart8.elf", "miXart8AES.xlx" }; char path[32]; diff --git a/sound/pci/mixart/mixart_mixer.c b/sound/pci/mixart/mixart_mixer.c index 1378f9ee70a9..d2e7c3381267 100644 --- a/sound/pci/mixart/mixart_mixer.c +++ b/sound/pci/mixart/mixart_mixer.c @@ -20,7 +20,7 @@ #include <sound/tlv.h> #include "mixart_mixer.h"
-static u32 mixart_analog_level[256] = { +static const u32 mixart_analog_level[256] = { 0xc2c00000, /* [000] -96.0 dB */ 0xc2bf0000, /* [001] -95.5 dB */ 0xc2be0000, /* [002] -95.0 dB */ @@ -443,7 +443,7 @@ static const struct snd_kcontrol_new mixart_control_output_switch = { .put = mixart_audio_sw_put };
-static u32 mixart_digital_level[256] = { +static const u32 mixart_digital_level[256] = { 0x00000000, /* [000] = 0.00e+000 = mute if <= -109.5dB */ 0x366e1c7a, /* [001] = 3.55e-006 = pow(10.0, 0.05 * -109.0dB) */ 0x367c3860, /* [002] = 3.76e-006 = pow(10.0, 0.05 * -108.5dB) */
Apply const prefix to each possible place: the static tables for sample rates, parameters and registers.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ymfpci/ymfpci_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 1cffd988b616..e07d70307d20 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -122,14 +122,14 @@ static u32 snd_ymfpci_calc_delta(u32 rate) } }
-static u32 def_rate[8] = { +static const u32 def_rate[8] = { 100, 2000, 8000, 11025, 16000, 22050, 32000, 48000 };
static u32 snd_ymfpci_calc_lpfK(u32 rate) { u32 i; - static u32 val[8] = { + static const u32 val[8] = { 0x00570000, 0x06AA0000, 0x18B20000, 0x20930000, 0x2B9A0000, 0x35A10000, 0x3EAA0000, 0x40000000 }; @@ -145,7 +145,7 @@ static u32 snd_ymfpci_calc_lpfK(u32 rate) static u32 snd_ymfpci_calc_lpfQ(u32 rate) { u32 i; - static u32 val[8] = { + static const u32 val[8] = { 0x35280000, 0x34A70000, 0x32020000, 0x31770000, 0x31390000, 0x31C90000, 0x33D00000, 0x40000000 }; @@ -2234,7 +2234,7 @@ static int snd_ymfpci_dev_free(struct snd_device *device) }
#ifdef CONFIG_PM_SLEEP -static int saved_regs_index[] = { +static const int saved_regs_index[] = { /* spdif */ YDSXGR_SPDIFOUTCTRL, YDSXGR_SPDIFOUTSTATUS,
Apply const prefix to the static tables for command and verbs.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/usb/bcd2000/bcd2000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/usb/bcd2000/bcd2000.c b/sound/usb/bcd2000/bcd2000.c index 6e3175826faf..010976d9ceb2 100644 --- a/sound/usb/bcd2000/bcd2000.c +++ b/sound/usb/bcd2000/bcd2000.c @@ -25,9 +25,9 @@ static const struct usb_device_id id_table[] = { { }, };
-static unsigned char device_cmd_prefix[] = {0x03, 0x00}; +static const unsigned char device_cmd_prefix[] = {0x03, 0x00};
-static unsigned char bcd2000_init_sequence[] = { +static const unsigned char bcd2000_init_sequence[] = { 0x07, 0x00, 0x00, 0x00, 0x78, 0x48, 0x1c, 0x81, 0xc4, 0x00, 0x00, 0x00, 0x5e, 0x53, 0x4a, 0xf7, 0x18, 0xfa, 0x11, 0xff, 0x6c, 0xf3, 0x90, 0xff,
Apply const prefix to the static tables coefs and init registers.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/nm256/nm256.c | 4 ++-- sound/pci/nm256/nm256_coef.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 25275a98e950..1726f2959ae8 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -299,7 +299,7 @@ snd_nm256_writel(struct nm256 *chip, int offset, u32 val) }
static inline void -snd_nm256_write_buffer(struct nm256 *chip, void *src, int offset, int size) +snd_nm256_write_buffer(struct nm256 *chip, const void *src, int offset, int size) { offset -= chip->buffer_start; #ifdef CONFIG_SND_DEBUG @@ -1179,7 +1179,7 @@ struct initialValues { unsigned short value; };
-static struct initialValues nm256_ac97_init_val[] = +static const struct initialValues nm256_ac97_init_val[] = { { AC97_MASTER, 0x8000 }, { AC97_HEADPHONE, 0x8000 }, diff --git a/sound/pci/nm256/nm256_coef.c b/sound/pci/nm256/nm256_coef.c index c757252119b1..f0599dbe8492 100644 --- a/sound/pci/nm256/nm256_coef.c +++ b/sound/pci/nm256/nm256_coef.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #define NM_TOTAL_COEFF_COUNT 0x3158
-static char coefficients[NM_TOTAL_COEFF_COUNT * 4] = { +static const char coefficients[NM_TOTAL_COEFF_COUNT * 4] = { 0xFF, 0xFF, 0x2F, 0x00, 0x4B, 0xFF, 0xA5, 0x01, 0xEF, 0xFC, 0x21, 0x05, 0x87, 0xF7, 0x62, 0x11, 0xE9, 0x45, 0x5E, 0xF9, 0xB5, 0x01, 0xDE, 0xFF, 0xA4, 0xFF, 0x60, 0x00, 0xCA, 0xFF, 0x0D, 0x00, 0xFD, @@ -4598,7 +4598,7 @@ static char coefficients[NM_TOTAL_COEFF_COUNT * 4] = { 0x01, 0x8D, 0xFF, 0x0F, 0x00 };
-static u16 +static const u16 coefficient_sizes[8 * 2] = { /* Playback */ 0x00C0, 0x5000, 0x0060, 0x2800, 0x0040, 0x0060, 0x1400, 0x0000,
Apply const prefix to each possible place: the string array, the static tables for clock selectors, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/korg1212/korg1212.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 685a60551c71..21ab9cc50c71 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -415,7 +415,7 @@ static const struct pci_device_id snd_korg1212_ids[] = {
MODULE_DEVICE_TABLE(pci, snd_korg1212_ids);
-static char *stateName[] = { +static const char * const stateName[] = { "Non-existent", "Uninitialized", "DSP download in process", @@ -455,7 +455,7 @@ static const char * const channelName[] = { "SPDIF-R", };
-static u16 ClockSourceSelector[] = { +static const u16 ClockSourceSelector[] = { 0x8000, // selects source as ADAT at 44.1 kHz 0x0000, // selects source as ADAT at 48 kHz 0x8001, // selects source as S/PDIF at 44.1 kHz @@ -813,12 +813,12 @@ static inline int snd_korg1212_use_is_exclusive(struct snd_korg1212 *korg1212)
static int snd_korg1212_SetRate(struct snd_korg1212 *korg1212, int rate) { - static enum ClockSourceIndex s44[] = { + static const enum ClockSourceIndex s44[] = { K1212_CLKIDX_AdatAt44_1K, K1212_CLKIDX_WordAt44_1K, K1212_CLKIDX_LocalAt44_1K }; - static enum ClockSourceIndex s48[] = { + static const enum ClockSourceIndex s48[] = { K1212_CLKIDX_AdatAt48K, K1212_CLKIDX_WordAt48K, K1212_CLKIDX_LocalAt48K
Apply const prefix to each possible place: the static tables for registers and op codes, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/cs46xx/cs46xx_lib.c | 2 +- sound/pci/cs46xx/dsp_spos.c | 4 ++-- sound/pci/cs46xx/dsp_spos_scb_lib.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index cbac9f1edc51..e46efae1e192 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -3745,7 +3745,7 @@ static struct cs_card_type cards[] = { * APM support */ #ifdef CONFIG_PM_SLEEP -static unsigned int saved_regs[] = { +static const unsigned int saved_regs[] = { BA0_ACOSV, /*BA0_ASER_FADDR,*/ BA0_ASER_MASTER, diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 887790ac33c6..05f3f6dc918d 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c @@ -27,7 +27,7 @@ static int cs46xx_dsp_async_init (struct snd_cs46xx *chip, struct dsp_scb_descriptor * fg_entry);
-static enum wide_opcode wide_opcodes[] = { +static const enum wide_opcode wide_opcodes[] = { WIDE_FOR_BEGIN_LOOP, WIDE_FOR_BEGIN_LOOP2, WIDE_COND_GOTO_ADDR, @@ -1038,7 +1038,7 @@ int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip) int fifo_addr, fifo_span, valid_slots;
- static struct dsp_spos_control_block sposcb = { + static const struct dsp_spos_control_block sposcb = { /* 0 */ HFG_TREE_SCB,HFG_STACK, /* 1 */ SPOSCB_ADDR,BG_TREE_SCB_ADDR, /* 2 */ DSP_SPOS_DC,0, diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index 715ead59613d..2c5c9d4c1d94 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c @@ -1145,7 +1145,7 @@ find_next_free_scb (struct snd_cs46xx * chip, struct dsp_scb_descriptor * from) return scb; }
-static u32 pcm_reader_buffer_addr[DSP_MAX_PCM_CHANNELS] = { +static const u32 pcm_reader_buffer_addr[DSP_MAX_PCM_CHANNELS] = { 0x0600, /* 1 */ 0x1500, /* 2 */ 0x1580, /* 3 */ @@ -1180,7 +1180,7 @@ static u32 pcm_reader_buffer_addr[DSP_MAX_PCM_CHANNELS] = { 0x2400, /* 32 */ };
-static u32 src_output_buffer_addr[DSP_MAX_SRC_NR] = { +static const u32 src_output_buffer_addr[DSP_MAX_SRC_NR] = { 0x2B80, 0x2BA0, 0x2BC0, @@ -1197,7 +1197,7 @@ static u32 src_output_buffer_addr[DSP_MAX_SRC_NR] = { 0x2E20 };
-static u32 src_delay_buffer_addr[DSP_MAX_SRC_NR] = { +static const u32 src_delay_buffer_addr[DSP_MAX_SRC_NR] = { 0x2480, 0x2500, 0x2580,
Apply const prefix to each possible place: the static tables for registers and verbs, and the string arrays.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ca0106/ca0106_main.c | 4 ++-- sound/pci/ca0106/ca0106_mixer.c | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 487b1aaafa1e..70d775ff967e 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -1360,7 +1360,7 @@ static int snd_ca0106_pcm(struct snd_ca0106 *emu, int device) }
#define SPI_REG(reg, value) (((reg) << SPI_REG_SHIFT) | (value)) -static unsigned int spi_dac_init[] = { +static const unsigned int spi_dac_init[] = { SPI_REG(SPI_LDA1_REG, SPI_DA_BIT_0dB), /* 0dB dig. attenuation */ SPI_REG(SPI_RDA1_REG, SPI_DA_BIT_0dB), SPI_REG(SPI_PL_REG, SPI_PL_BIT_L_L | SPI_PL_BIT_R_R | SPI_IZD_BIT), @@ -1378,7 +1378,7 @@ static unsigned int spi_dac_init[] = { SPI_REG(SPI_DACD4_REG, SPI_DACD4_BIT), };
-static unsigned int i2c_adc_init[][2] = { +static const unsigned int i2c_adc_init[][2] = { { 0x17, 0x00 }, /* Reset */ { 0x07, 0x00 }, /* Timeout */ { 0x0b, 0x22 }, /* Interface control */ diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c index c771995b12b9..3b8ec673dc0a 100644 --- a/sound/pci/ca0106/ca0106_mixer.c +++ b/sound/pci/ca0106/ca0106_mixer.c @@ -739,7 +739,7 @@ static int rename_ctl(struct snd_card *card, const char *src, const char *dst) static DECLARE_TLV_DB_SCALE(snd_ca0106_master_db_scale, -6375, 25, 1);
-static char *slave_vols[] = { +static const char * const slave_vols[] = { "Analog Front Playback Volume", "Analog Rear Playback Volume", "Analog Center/LFE Playback Volume", @@ -752,7 +752,7 @@ static char *slave_vols[] = { NULL };
-static char *slave_sws[] = { +static const char * const slave_sws[] = { "Analog Front Playback Switch", "Analog Rear Playback Switch", "Analog Center/LFE Playback Switch", @@ -762,7 +762,7 @@ static char *slave_sws[] = { };
static void add_slaves(struct snd_card *card, - struct snd_kcontrol *master, char **list) + struct snd_kcontrol *master, const char * const *list) { for (; *list; list++) { struct snd_kcontrol *slave = ctl_find(card, *list); @@ -775,9 +775,9 @@ int snd_ca0106_mixer(struct snd_ca0106 *emu) { int err; struct snd_card *card = emu->card; - char **c; + const char * const *c; struct snd_kcontrol *vmaster; - static char *ca0106_remove_ctls[] = { + static const char * const ca0106_remove_ctls[] = { "Master Mono Playback Switch", "Master Mono Playback Volume", "3D Control - Switch", @@ -801,7 +801,7 @@ int snd_ca0106_mixer(struct snd_ca0106 *emu) "Surround Phase Inversion Playback Switch", NULL }; - static char *ca0106_rename_ctls[] = { + static const char * const ca0106_rename_ctls[] = { "Master Playback Switch", "Capture Switch", "Master Playback Volume", "Capture Volume", "Line Playback Switch", "AC97 Line Capture Switch", @@ -875,7 +875,7 @@ struct ca0106_vol_tbl { unsigned int reg; };
-static struct ca0106_vol_tbl saved_volumes[NUM_SAVED_VOLUMES] = { +static const struct ca0106_vol_tbl saved_volumes[NUM_SAVED_VOLUMES] = { { CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2 }, { CONTROL_REAR_CHANNEL, PLAYBACK_VOLUME2 }, { CONTROL_CENTER_LFE_CHANNEL, PLAYBACK_VOLUME2 },
Apply const prefix to each possible place: the DAIO tables and the register offset table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ctxfi/ctdaio.c | 4 ++-- sound/pci/ctxfi/ctresource.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c index 27441d498968..4cb47b5a792c 100644 --- a/sound/pci/ctxfi/ctdaio.c +++ b/sound/pci/ctxfi/ctdaio.c @@ -29,7 +29,7 @@ struct daio_rsc_idx { unsigned short right; };
-static struct daio_rsc_idx idx_20k1[NUM_DAIOTYP] = { +static const struct daio_rsc_idx idx_20k1[NUM_DAIOTYP] = { [LINEO1] = {.left = 0x00, .right = 0x01}, [LINEO2] = {.left = 0x18, .right = 0x19}, [LINEO3] = {.left = 0x08, .right = 0x09}, @@ -40,7 +40,7 @@ static struct daio_rsc_idx idx_20k1[NUM_DAIOTYP] = { [SPDIFI1] = {.left = 0x95, .right = 0x9d}, };
-static struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = { +static const struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = { [LINEO1] = {.left = 0x40, .right = 0x41}, [LINEO2] = {.left = 0x60, .right = 0x61}, [LINEO3] = {.left = 0x50, .right = 0x51}, diff --git a/sound/pci/ctxfi/ctresource.c b/sound/pci/ctxfi/ctresource.c index 0bb5696e44b3..61e51e35ba16 100644 --- a/sound/pci/ctxfi/ctresource.c +++ b/sound/pci/ctxfi/ctresource.c @@ -92,7 +92,7 @@ int mgr_put_resource(struct rsc_mgr *mgr, unsigned int n, unsigned int idx) return 0; }
-static unsigned char offset_in_audio_slot_block[NUM_RSCTYP] = { +static const unsigned char offset_in_audio_slot_block[NUM_RSCTYP] = { /* SRC channel is at Audio Ring slot 1 every 16 slots. */ [SRC] = 0x1, [AMIXER] = 0x4,
Apply const prefix to each possible place: the static tables for formats, parameters, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/asihpi/asihpi.c | 4 ++-- sound/pci/asihpi/hpimsgx.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 1fdb9f9f0ae0..a9540c2c4a1a 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -300,7 +300,7 @@ static void print_hwparams(struct snd_pcm_substream *substream,
#define INVALID_FORMAT (__force snd_pcm_format_t)(-1)
-static snd_pcm_format_t hpi_to_alsa_formats[] = { +static const snd_pcm_format_t hpi_to_alsa_formats[] = { INVALID_FORMAT, /* INVALID */ SNDRV_PCM_FORMAT_U8, /* HPI_FORMAT_PCM8_UNSIGNED 1 */ SNDRV_PCM_FORMAT_S16, /* HPI_FORMAT_PCM16_SIGNED 2 */ @@ -2073,7 +2073,7 @@ static int snd_asihpi_meter_info(struct snd_kcontrol *kcontrol, }
/* linear values for 10dB steps */ -static int log2lin[] = { +static const int log2lin[] = { 0x7FFFFFFF, /* 0dB */ 679093956, 214748365, diff --git a/sound/pci/asihpi/hpimsgx.c b/sound/pci/asihpi/hpimsgx.c index 5fb0b98bec30..f7427f8eb630 100644 --- a/sound/pci/asihpi/hpimsgx.c +++ b/sound/pci/asihpi/hpimsgx.c @@ -17,7 +17,7 @@ Extended Message Function With Response Caching #include "hpimsgx.h" #include "hpidebug.h"
-static struct pci_device_id asihpi_pci_tbl[] = { +static const struct pci_device_id asihpi_pci_tbl[] = { #include "hpipcida.h" };
Apply const prefix to the static register tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/atiixp.c | 2 +- sound/pci/atiixp_modem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 4a840734e7a7..85d3b4e95489 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -1407,7 +1407,7 @@ static int snd_atiixp_mixer_new(struct atiixp *chip, int clock, .write = snd_atiixp_ac97_write, .read = snd_atiixp_ac97_read, }; - static unsigned int codec_skip[NUM_ATI_CODECS] = { + static const unsigned int codec_skip[NUM_ATI_CODECS] = { ATI_REG_ISR_CODEC0_NOT_READY, ATI_REG_ISR_CODEC1_NOT_READY, ATI_REG_ISR_CODEC2_NOT_READY, diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 3ec34e78ffef..ae88217d685a 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c @@ -1050,7 +1050,7 @@ static int snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock) .write = snd_atiixp_ac97_write, .read = snd_atiixp_ac97_read, }; - static unsigned int codec_skip[NUM_ATI_CODECS] = { + static const unsigned int codec_skip[NUM_ATI_CODECS] = { ATI_REG_ISR_CODEC0_NOT_READY, ATI_REG_ISR_CODEC1_NOT_READY, ATI_REG_ISR_CODEC2_NOT_READY,
Apply const prefix to the static register table and its callers.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/es1938.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 8336b20fbafc..b4a0adf7451c 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -1420,7 +1420,7 @@ static void snd_es1938_chip_init(struct es1938 *chip) * PM support */
-static unsigned char saved_regs[SAVED_REG_SIZE+1] = { +static const unsigned char saved_regs[SAVED_REG_SIZE+1] = { 0x14, 0x1a, 0x1c, 0x3a, 0x3c, 0x3e, 0x36, 0x38, 0x50, 0x52, 0x60, 0x61, 0x62, 0x63, 0x64, 0x68, 0x69, 0x6a, 0x6b, 0x6d, 0x6e, 0x6f, 0x7c, 0x7d, @@ -1432,7 +1432,8 @@ static int es1938_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); struct es1938 *chip = card->private_data; - unsigned char *s, *d; + const unsigned char *s; + unsigned char *d;
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
@@ -1454,7 +1455,8 @@ static int es1938_resume(struct device *dev) struct pci_dev *pci = to_pci_dev(dev); struct snd_card *card = dev_get_drvdata(dev); struct es1938 *chip = card->private_data; - unsigned char *s, *d; + const unsigned char *s; + unsigned char *d;
if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_SHARED, KBUILD_MODNAME, chip)) {
Apply const prefix to the quirk white/black lists.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/es1968.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index affd3e8d7a67..d26004b35a81 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -2631,7 +2631,7 @@ struct ess_device_list { unsigned short vendor; /* subsystem vendor id */ };
-static struct ess_device_list pm_whitelist[] = { +static const struct ess_device_list pm_whitelist[] = { { TYPE_MAESTRO2E, 0x0e11 }, /* Compaq Armada */ { TYPE_MAESTRO2E, 0x1028 }, { TYPE_MAESTRO2E, 0x103c }, @@ -2642,7 +2642,7 @@ static struct ess_device_list pm_whitelist[] = { { TYPE_MAESTRO2, 0x125d }, /* a PCI card, e.g. SF64-PCE2 */ };
-static struct ess_device_list mpu_blacklist[] = { +static const struct ess_device_list mpu_blacklist[] = { { TYPE_MAESTRO2, 0x125d }, };
Apply const prefix to the static tables for rates, ports and registers.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/cmipci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 7f91742ed6f0..7363d61eaec2 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -586,7 +586,7 @@ static int snd_cmipci_clear_bit_b(struct cmipci *cm, unsigned int cmd, unsigned * calculate frequency */
-static unsigned int rates[] = { 5512, 11025, 22050, 44100, 8000, 16000, 32000, 48000 }; +static const unsigned int rates[] = { 5512, 11025, 22050, 44100, 8000, 16000, 32000, 48000 };
static unsigned int snd_cmipci_rate_freq(unsigned int rate) { @@ -2826,7 +2826,7 @@ static void query_chip(struct cmipci *cm) #ifdef SUPPORT_JOYSTICK static int snd_cmipci_create_gameport(struct cmipci *cm, int dev) { - static int ports[] = { 0x201, 0x200, 0 }; /* FIXME: majority is 0x201? */ + static const int ports[] = { 0x201, 0x200, 0 }; /* FIXME: majority is 0x201? */ struct gameport *gp; struct resource *r = NULL; int i, io_port = 0; @@ -3289,7 +3289,7 @@ static void snd_cmipci_remove(struct pci_dev *pci) /* * power management */ -static unsigned char saved_regs[] = { +static const unsigned char saved_regs[] = { CM_REG_FUNCTRL1, CM_REG_CHFORMAT, CM_REG_LEGACY_CTRL, CM_REG_MISC_CTRL, CM_REG_MIXER0, CM_REG_MIXER1, CM_REG_MIXER2, CM_REG_MIXER3, CM_REG_PLL, CM_REG_CH0_FRAME1, CM_REG_CH0_FRAME2, @@ -3297,7 +3297,7 @@ static unsigned char saved_regs[] = { CM_REG_INT_STATUS, CM_REG_INT_HLDCLR, CM_REG_FUNCTRL0, };
-static unsigned char saved_mixers[] = { +static const unsigned char saved_mixers[] = { SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1, SB_DSP4_PCM_DEV, SB_DSP4_PCM_DEV + 1, SB_DSP4_SYNTH_DEV, SB_DSP4_SYNTH_DEV + 1,
Apply const prefix to the static tables for rates, bits and strings.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/sparc/cs4231.c | 4 ++-- sound/sparc/dbri.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 59f812b5ce59..0eed5f79a2bf 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c @@ -184,7 +184,7 @@ struct snd_cs4231 { * Some variables */
-static unsigned char freq_bits[14] = { +static const unsigned char freq_bits[14] = { /* 5510 */ 0x00 | CS4231_XTAL2, /* 6620 */ 0x0E | CS4231_XTAL2, /* 8000 */ 0x00 | CS4231_XTAL1, @@ -218,7 +218,7 @@ static int snd_cs4231_xrate(struct snd_pcm_runtime *runtime) &hw_constraints_rates); }
-static unsigned char snd_cs4231_original_image[32] = +static const unsigned char snd_cs4231_original_image[32] = { 0x00, /* 00/00 - lic */ 0x00, /* 01/01 - ric */ diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index aaa1493b9ef9..cf7049999261 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c @@ -104,7 +104,7 @@ module_param(dbri_debug, int, 0644); MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard.");
#ifdef DBRI_DEBUG -static char *cmds[] = { +static const char * const cmds[] = { "WAIT", "PAUSE", "JUMP", "IIQ", "REX", "SDP", "CDP", "DTS", "SSP", "CHI", "NT", "TE", "CDEC", "TEST", "CDM", "RESRV" };
Apply const prefix to the string array and its callers.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/core/info.c b/sound/core/info.c index e051a029ccfb..6801d8160866 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -20,7 +20,7 @@
int snd_info_check_reserved_words(const char *str) { - static char *reserved[] = + static const char * const reserved[] = { "version", "meminfo", @@ -35,7 +35,7 @@ int snd_info_check_reserved_words(const char *str) "seq", NULL }; - char **xstr = reserved; + const char * const *xstr = reserved;
while (*xstr) { if (!strcmp(*xstr, str))
Apply const prefix to the static jack switch table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/jack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/jack.c b/sound/core/jack.c index 6590b1b8d62a..503c8af79d55 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -19,7 +19,7 @@ struct snd_jack_kctl { };
#ifdef CONFIG_SND_JACK_INPUT_DEV -static int jack_switch_types[SND_JACK_SWITCH_TYPES] = { +static const int jack_switch_types[SND_JACK_SWITCH_TYPES] = { SW_HEADPHONE_INSERT, SW_MICROPHONE_INSERT, SW_LINEOUT_INSERT,
Apply const prefix to the static tables for strings and formats.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/oss/mixer_oss.c | 2 +- sound/core/oss/pcm_plugin.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 26502294f7d8..f702c96a7478 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -1109,7 +1109,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, /* */ #define MIXER_VOL(name) [SOUND_MIXER_##name] = #name -static char *oss_mixer_names[SNDRV_OSS_MAX_MIXERS] = { +static const char * const oss_mixer_names[SNDRV_OSS_MAX_MIXERS] = { MIXER_VOL(VOLUME), MIXER_VOL(BASS), MIXER_VOL(TREBLE), diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c index 31cb2acf8afc..240e4702c098 100644 --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c @@ -288,7 +288,7 @@ static int snd_pcm_plug_formats(const struct snd_mask *mask, return snd_mask_test(&formats, (__force int)format); }
-static snd_pcm_format_t preferred_formats[] = { +static const snd_pcm_format_t preferred_formats[] = { SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_FORMAT_S16_BE, SNDRV_PCM_FORMAT_U16_LE,
Apply const prefix to the static flag info table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/rawmidi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 7bc95c24f724..20dd08e1f675 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -249,7 +249,7 @@ static int assign_substream(struct snd_rawmidi *rmidi, int subdevice, { struct snd_rawmidi_substream *substream; struct snd_rawmidi_str *s = &rmidi->streams[stream]; - static unsigned int info_flags[2] = { + static const unsigned int info_flags[2] = { [SNDRV_RAWMIDI_STREAM_OUTPUT] = SNDRV_RAWMIDI_INFO_OUTPUT, [SNDRV_RAWMIDI_STREAM_INPUT] = SNDRV_RAWMIDI_INFO_INPUT, };
Apply const prefix to the static tables for drum, volume and notes.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/opl3/opl3_drums.c | 2 +- sound/drivers/opl3/opl3_midi.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/drivers/opl3/opl3_drums.c b/sound/drivers/opl3/opl3_drums.c index 318cd8a2ee3a..ccc49f39404d 100644 --- a/sound/drivers/opl3/opl3_drums.c +++ b/sound/drivers/opl3/opl3_drums.c @@ -7,7 +7,7 @@
#include "opl3_voice.h"
-static char snd_opl3_drum_table[47] = +static const char snd_opl3_drum_table[47] = { OPL3_BASSDRUM_ON, OPL3_BASSDRUM_ON, OPL3_HIHAT_ON, /* 35 - 37 */ OPL3_SNAREDRUM_ON, OPL3_HIHAT_ON, OPL3_SNAREDRUM_ON, /* 38 - 40 */ diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index 280cc79870cf..2f6e8023e05c 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c @@ -23,7 +23,7 @@ static void snd_opl3_note_off_unsafe(void *p, int note, int vel, * it saves a lot of log() calculations. (Rob Hooft hooft@chem.ruu.nl) */
-static char opl3_volume_table[128] = +static const char opl3_volume_table[128] = { -63, -48, -40, -35, -32, -29, -27, -26, -24, -23, -21, -20, -19, -18, -18, -17, @@ -69,7 +69,7 @@ void snd_opl3_calc_volume(unsigned char *volbyte, int vel, /* * Converts the note frequency to block and fnum values for the FM chip */ -static short opl3_note_table[16] = +static const short opl3_note_table[16] = { 305, 323, /* for pitch bending, -2 semitones */ 343, 363, 385, 408, 432, 458, 485, 514, 544, 577, 611, 647, @@ -266,7 +266,7 @@ static void snd_opl3_start_timer(struct snd_opl3 *opl3) /* ------------------------------ */
-static int snd_opl3_oss_map[MAX_OPL3_VOICES] = { +static const int snd_opl3_oss_map[MAX_OPL3_VOICES] = { 0, 1, 2, 9, 10, 11, 6, 7, 8, 15, 16, 17, 3, 4 ,5, 12, 13, 14 };
Apply const prefix to the static resource tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/cmi8328.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c index 250db35109a2..faca5dd95bfe 100644 --- a/sound/isa/cmi8328.c +++ b/sound/isa/cmi8328.c @@ -32,7 +32,7 @@ MODULE_LICENSE("GPL"); #endif
/* I/O port is configured by jumpers on the card to one of these */ -static int cmi8328_ports[] = { 0x530, 0xe80, 0xf40, 0x604 }; +static const int cmi8328_ports[] = { 0x530, 0xe80, 0xf40, 0x604 }; #define CMI8328_MAX ARRAY_SIZE(cmi8328_ports)
static int index[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = -1}; @@ -193,7 +193,7 @@ static int snd_cmi8328_mixer(struct snd_wss *chip) }
/* find index of an item in "-1"-ended array */ -static int array_find(int array[], int item) +static int array_find(const int array[], int item) { int i;
@@ -204,7 +204,7 @@ static int array_find(int array[], int item) return -1; } /* the same for long */ -static int array_find_l(long array[], long item) +static int array_find_l(const long array[], long item) { int i;
@@ -224,16 +224,16 @@ static int snd_cmi8328_probe(struct device *pdev, unsigned int ndev) struct resource *res; #endif int err, pos; - static long mpu_ports[] = { 0x330, 0x300, 0x310, 0x320, 0x332, 0x334, + static const long mpu_ports[] = { 0x330, 0x300, 0x310, 0x320, 0x332, 0x334, 0x336, -1 }; - static u8 mpu_port_bits[] = { 3, 0, 1, 2, 4, 5, 6 }; - static int mpu_irqs[] = { 9, 7, 5, 3, -1 }; - static u8 mpu_irq_bits[] = { 3, 2, 1, 0 }; - static int irqs[] = { 9, 10, 11, 7, -1 }; - static u8 irq_bits[] = { 2, 3, 4, 1 }; - static int dma1s[] = { 3, 1, 0, -1 }; - static u8 dma_bits[] = { 3, 2, 1 }; - static int dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, {0, -1} }; + static const u8 mpu_port_bits[] = { 3, 0, 1, 2, 4, 5, 6 }; + static const int mpu_irqs[] = { 9, 7, 5, 3, -1 }; + static const u8 mpu_irq_bits[] = { 3, 2, 1, 0 }; + static const int irqs[] = { 9, 10, 11, 7, -1 }; + static const u8 irq_bits[] = { 2, 3, 4, 1 }; + static const int dma1s[] = { 3, 1, 0, -1 }; + static const u8 dma_bits[] = { 3, 2, 1 }; + static const int dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, {0, -1} }; u16 port = cmi8328_ports[ndev]; u8 val;
Apply const prefix to the static mapping table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/cs423x/cs4236_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index ca6646f9b58d..4a028f42bb74 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -80,7 +80,7 @@ * */
-static unsigned char snd_cs4236_ext_map[18] = { +static const unsigned char snd_cs4236_ext_map[18] = { /* CS4236_LEFT_LINE */ 0xff, /* CS4236_RIGHT_LINE */ 0xff, /* CS4236_LEFT_MIC */ 0xdf,
Apply const prefix to each possible place: the static tables for the resources, controls, registers, values and parameters.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/sb/emu8000.c | 16 ++++++++-------- sound/isa/sb/jazz16.c | 10 +++++----- sound/isa/sb/sb16.c | 8 ++++---- sound/isa/sb/sb8.c | 2 +- sound/isa/sb/sb_mixer.c | 38 +++++++++++++++++++------------------- 5 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c index 455dd5fa3ccb..0aa545ac6e60 100644 --- a/sound/isa/sb/emu8000.c +++ b/sound/isa/sb/emu8000.c @@ -222,7 +222,7 @@ init_dma(struct snd_emu8000 *emu) /* * initialization arrays; from ADIP */ -static unsigned short init1[128] = { +static const unsigned short init1[128] = { 0x03ff, 0x0030, 0x07ff, 0x0130, 0x0bff, 0x0230, 0x0fff, 0x0330, 0x13ff, 0x0430, 0x17ff, 0x0530, 0x1bff, 0x0630, 0x1fff, 0x0730, 0x23ff, 0x0830, 0x27ff, 0x0930, 0x2bff, 0x0a30, 0x2fff, 0x0b30, @@ -244,7 +244,7 @@ static unsigned short init1[128] = { 0xf3ff, 0x0c30, 0xf7ff, 0x0d30, 0xfbff, 0x0e30, 0xffff, 0x0f30, };
-static unsigned short init2[128] = { +static const unsigned short init2[128] = { 0x03ff, 0x8030, 0x07ff, 0x8130, 0x0bff, 0x8230, 0x0fff, 0x8330, 0x13ff, 0x8430, 0x17ff, 0x8530, 0x1bff, 0x8630, 0x1fff, 0x8730, 0x23ff, 0x8830, 0x27ff, 0x8930, 0x2bff, 0x8a30, 0x2fff, 0x8b30, @@ -266,7 +266,7 @@ static unsigned short init2[128] = { 0xf3ff, 0x8c30, 0xf7ff, 0x8d30, 0xfbff, 0x8e30, 0xffff, 0x8f30, };
-static unsigned short init3[128] = { +static const unsigned short init3[128] = { 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x8F7C, 0x167E, 0xF254, 0x0000, 0x842A, 0x0001, 0x852A, 0x18E6, 0x8BAA, 0x1B6D, 0xF234, @@ -288,7 +288,7 @@ static unsigned short init3[128] = { 0x1342, 0xD36E, 0x3EC7, 0xB3FF, 0x0000, 0x8365, 0x1420, 0x9570, };
-static unsigned short init4[128] = { +static const unsigned short init4[128] = { 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x0F7C, 0x167E, 0x7254, 0x0000, 0x842A, 0x0001, 0x852A, 0x18E6, 0x0BAA, 0x1B6D, 0x7234, @@ -315,10 +315,10 @@ static unsigned short init4[128] = { * is meant to work */ static void -send_array(struct snd_emu8000 *emu, unsigned short *data, int size) +send_array(struct snd_emu8000 *emu, const unsigned short *data, int size) { int i; - unsigned short *p; + const unsigned short *p;
p = data; for (i = 0; i < size; i++, p++) @@ -548,7 +548,7 @@ snd_emu8000_init_hw(struct snd_emu8000 *emu) * Bass/Treble Equalizer *----------------------------------------------------------------*/
-static unsigned short bass_parm[12][3] = { +static const unsigned short bass_parm[12][3] = { {0xD26A, 0xD36A, 0x0000}, /* -12 dB */ {0xD25B, 0xD35B, 0x0000}, /* -8 */ {0xD24C, 0xD34C, 0x0000}, /* -6 */ @@ -563,7 +563,7 @@ static unsigned short bass_parm[12][3] = { {0xC26A, 0xC36A, 0x0002}, /* +12 dB */ };
-static unsigned short treble_parm[12][9] = { +static const unsigned short treble_parm[12][9] = { {0x821E, 0xC26A, 0x031E, 0xC36A, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, /* -12 dB */ {0x821E, 0xC25B, 0x031E, 0xC35B, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, {0x821E, 0xC24C, 0x031E, 0xC34C, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c index 7a313ff589c7..ee379bbf70a4 100644 --- a/sound/isa/sb/jazz16.c +++ b/sound/isa/sb/jazz16.c @@ -158,9 +158,9 @@ static int jazz16_detect_board(unsigned long port,
static int jazz16_configure_board(struct snd_sb *chip, int mpu_irq) { - static unsigned char jazz_irq_bits[] = { 0, 0, 2, 3, 0, 1, 0, 4, + static const unsigned char jazz_irq_bits[] = { 0, 0, 2, 3, 0, 1, 0, 4, 0, 2, 5, 0, 0, 0, 0, 6 }; - static unsigned char jazz_dma_bits[] = { 0, 1, 0, 2, 0, 3, 0, 4 }; + static const unsigned char jazz_dma_bits[] = { 0, 1, 0, 2, 0, 3, 0, 4 };
if (jazz_dma_bits[chip->dma8] == 0 || jazz_dma_bits[chip->dma16] == 0 || @@ -224,9 +224,9 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev) struct snd_card_jazz16 *jazz16; struct snd_sb *chip; struct snd_opl3 *opl3; - static int possible_irqs[] = {2, 3, 5, 7, 9, 10, 15, -1}; - static int possible_dmas8[] = {1, 3, -1}; - static int possible_dmas16[] = {5, 7, -1}; + static const int possible_irqs[] = {2, 3, 5, 7, 9, 10, 15, -1}; + static const int possible_dmas8[] = {1, 3, -1}; + static const int possible_dmas16[] = {5, 7, -1}; int err, xirq, xdma8, xdma16, xmpu_port, xmpu_irq;
err = snd_card_new(devptr, index[dev], id[dev], THIS_MODULE, diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index b528238675fe..479197c13803 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -509,9 +509,9 @@ static int snd_sb16_isa_match(struct device *pdev, unsigned int dev) static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev) { int err; - static int possible_irqs[] = {5, 9, 10, 7, -1}; - static int possible_dmas8[] = {1, 3, 0, -1}; - static int possible_dmas16[] = {5, 6, 7, -1}; + static const int possible_irqs[] = {5, 9, 10, 7, -1}; + static const int possible_dmas8[] = {1, 3, 0, -1}; + static const int possible_dmas16[] = {5, 6, 7, -1};
if (irq[dev] == SNDRV_AUTO_IRQ) { if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) { @@ -535,7 +535,7 @@ static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev) if (port[dev] != SNDRV_AUTO_PORT) return snd_sb16_isa_probe1(dev, pdev); else { - static int possible_ports[] = {0x220, 0x240, 0x260, 0x280}; + static const int possible_ports[] = {0x220, 0x240, 0x260, 0x280}; int i; for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { port[dev] = possible_ports[i]; diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index d67eae3988bd..438109f167d6 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c @@ -111,7 +111,7 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) goto _err; } else { /* auto-probe legacy ports */ - static unsigned long possible_ports[] = { + static const unsigned long possible_ports[] = { 0x220, 0x240, 0x260, }; int i; diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index 789dcf279a26..3f703b4a304d 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c @@ -494,14 +494,14 @@ int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int ty * SB 2.0 specific mixer elements */
-static struct sbmix_elem snd_sb20_controls[] = { +static const struct sbmix_elem snd_sb20_controls[] = { SB_SINGLE("Master Playback Volume", SB_DSP20_MASTER_DEV, 1, 7), SB_SINGLE("PCM Playback Volume", SB_DSP20_PCM_DEV, 1, 3), SB_SINGLE("Synth Playback Volume", SB_DSP20_FM_DEV, 1, 7), SB_SINGLE("CD Playback Volume", SB_DSP20_CD_DEV, 1, 7) };
-static unsigned char snd_sb20_init_values[][2] = { +static const unsigned char snd_sb20_init_values[][2] = { { SB_DSP20_MASTER_DEV, 0 }, { SB_DSP20_FM_DEV, 0 }, }; @@ -509,7 +509,7 @@ static unsigned char snd_sb20_init_values[][2] = { /* * SB Pro specific mixer elements */ -static struct sbmix_elem snd_sbpro_controls[] = { +static const struct sbmix_elem snd_sbpro_controls[] = { SB_DOUBLE("Master Playback Volume", SB_DSP_MASTER_DEV, SB_DSP_MASTER_DEV, 5, 1, 7), SB_DOUBLE("PCM Playback Volume", @@ -529,7 +529,7 @@ static struct sbmix_elem snd_sbpro_controls[] = { SB_SINGLE("Capture Low-Pass Filter", SB_DSP_CAPTURE_FILT, 3, 1) };
-static unsigned char snd_sbpro_init_values[][2] = { +static const unsigned char snd_sbpro_init_values[][2] = { { SB_DSP_MASTER_DEV, 0 }, { SB_DSP_PCM_DEV, 0 }, { SB_DSP_FM_DEV, 0 }, @@ -538,7 +538,7 @@ static unsigned char snd_sbpro_init_values[][2] = { /* * SB16 specific mixer elements */ -static struct sbmix_elem snd_sb16_controls[] = { +static const struct sbmix_elem snd_sb16_controls[] = { SB_DOUBLE("Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), SB_DOUBLE("PCM Playback Volume", @@ -576,7 +576,7 @@ static struct sbmix_elem snd_sb16_controls[] = { SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15) };
-static unsigned char snd_sb16_init_values[][2] = { +static const unsigned char snd_sb16_init_values[][2] = { { SB_DSP4_MASTER_DEV + 0, 0 }, { SB_DSP4_MASTER_DEV + 1, 0 }, { SB_DSP4_PCM_DEV + 0, 0 }, @@ -592,7 +592,7 @@ static unsigned char snd_sb16_init_values[][2] = { /* * DT019x specific mixer elements */ -static struct sbmix_elem snd_dt019x_controls[] = { +static const struct sbmix_elem snd_dt019x_controls[] = { /* ALS4000 below has some parts which we might be lacking, * e.g. snd_als4000_ctl_mono_playback_switch - check it! */ SB_DOUBLE("Master Playback Volume", @@ -622,7 +622,7 @@ static struct sbmix_elem snd_dt019x_controls[] = { } };
-static unsigned char snd_dt019x_init_values[][2] = { +static const unsigned char snd_dt019x_init_values[][2] = { { SB_DT019X_MASTER_DEV, 0 }, { SB_DT019X_PCM_DEV, 0 }, { SB_DT019X_SYNTH_DEV, 0 }, @@ -637,7 +637,7 @@ static unsigned char snd_dt019x_init_values[][2] = { /* * ALS4000 specific mixer elements */ -static struct sbmix_elem snd_als4000_controls[] = { +static const struct sbmix_elem snd_als4000_controls[] = { SB_DOUBLE("PCM Playback Switch", SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2, 1, 1), SB_DOUBLE("Synth Playback Switch", @@ -671,7 +671,7 @@ static struct sbmix_elem snd_als4000_controls[] = { #endif };
-static unsigned char snd_als4000_init_values[][2] = { +static const unsigned char snd_als4000_init_values[][2] = { { SB_DSP4_MASTER_DEV + 0, 0 }, { SB_DSP4_MASTER_DEV + 1, 0 }, { SB_DSP4_PCM_DEV + 0, 0 }, @@ -689,9 +689,9 @@ static unsigned char snd_als4000_init_values[][2] = { /* */ static int snd_sbmixer_init(struct snd_sb *chip, - struct sbmix_elem *controls, + const struct sbmix_elem *controls, int controls_count, - unsigned char map[][2], + const unsigned char map[][2], int map_count, char *name) { @@ -800,14 +800,14 @@ int snd_sbmixer_new(struct snd_sb *chip) }
#ifdef CONFIG_PM -static unsigned char sb20_saved_regs[] = { +static const unsigned char sb20_saved_regs[] = { SB_DSP20_MASTER_DEV, SB_DSP20_PCM_DEV, SB_DSP20_FM_DEV, SB_DSP20_CD_DEV, };
-static unsigned char sbpro_saved_regs[] = { +static const unsigned char sbpro_saved_regs[] = { SB_DSP_MASTER_DEV, SB_DSP_PCM_DEV, SB_DSP_PLAYBACK_FILT, @@ -819,7 +819,7 @@ static unsigned char sbpro_saved_regs[] = { SB_DSP_CAPTURE_FILT, };
-static unsigned char sb16_saved_regs[] = { +static const unsigned char sb16_saved_regs[] = { SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1, SB_DSP4_3DSE, SB_DSP4_BASS_DEV, SB_DSP4_BASS_DEV + 1, @@ -837,7 +837,7 @@ static unsigned char sb16_saved_regs[] = { SB_DSP4_MIC_AGC };
-static unsigned char dt019x_saved_regs[] = { +static const unsigned char dt019x_saved_regs[] = { SB_DT019X_MASTER_DEV, SB_DT019X_PCM_DEV, SB_DT019X_SYNTH_DEV, @@ -850,7 +850,7 @@ static unsigned char dt019x_saved_regs[] = { SB_DT019X_CAPTURE_SW, };
-static unsigned char als4000_saved_regs[] = { +static const unsigned char als4000_saved_regs[] = { /* please verify in dsheet whether regs to be added are actually real H/W or just dummy */ SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1, @@ -872,7 +872,7 @@ static unsigned char als4000_saved_regs[] = { SB_ALS4000_CR3_CONFIGURATION, };
-static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) +static void save_mixer(struct snd_sb *chip, const unsigned char *regs, int num_regs) { unsigned char *val = chip->saved_regs; if (snd_BUG_ON(num_regs > ARRAY_SIZE(chip->saved_regs))) @@ -881,7 +881,7 @@ static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) *val++ = snd_sbmixer_read(chip, *regs++); }
-static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) +static void restore_mixer(struct snd_sb *chip, const unsigned char *regs, int num_regs) { unsigned char *val = chip->saved_regs; if (snd_BUG_ON(num_regs > ARRAY_SIZE(chip->saved_regs)))
Apply const prefix to the static tables for the register, controls and callbacks.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/cmi8330.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 61d6944a69c7..4669eb0cc8ce 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -120,7 +120,7 @@ static int pnp_registered; #define CMI8330_LINGAIN 25 #define CMI8330_CDINGAIN 26
-static unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] = +static const unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] = { 0x40, /* 16 - recording mux (SB-mixer-enabled) */ #ifdef ENABLE_SB_MIXER @@ -235,7 +235,7 @@ WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", PLAYBACK, SWITCH), 0, };
#ifdef ENABLE_SB_MIXER -static struct sbmix_elem cmi8330_sb_mixers[] = { +static const struct sbmix_elem cmi8330_sb_mixers[] = { SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15), @@ -253,7 +253,7 @@ SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6 SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), };
-static unsigned char cmi8330_sb_init_values[][2] = { +static const unsigned char cmi8330_sb_init_values[][2] = { { SB_DSP4_MASTER_DEV + 0, 0 }, { SB_DSP4_MASTER_DEV + 1, 0 }, { SB_DSP4_PCM_DEV + 0, 0 }, @@ -428,7 +428,7 @@ static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip) struct snd_pcm *pcm; const struct snd_pcm_ops *ops; int err; - static snd_pcm_open_callback_t cmi_open_callbacks[2] = { + static const snd_pcm_open_callback_t cmi_open_callbacks[2] = { snd_cmi8330_playback_open, snd_cmi8330_capture_open };
Apply const prefix to the static resource tables and init tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/es1688/es1688.c | 6 +++--- sound/isa/es1688/es1688_lib.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 9be89377171b..ff3a05ad99c0 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@ -84,9 +84,9 @@ static int snd_es1688_legacy_create(struct snd_card *card, struct device *dev, unsigned int n) { struct snd_es1688 *chip = card->private_data; - static long possible_ports[] = {0x220, 0x240, 0x260}; - static int possible_irqs[] = {5, 9, 10, 7, -1}; - static int possible_dmas[] = {1, 3, 0, -1}; + static const long possible_ports[] = {0x220, 0x240, 0x260}; + static const int possible_irqs[] = {5, 9, 10, 7, -1}; + static const int possible_dmas[] = {1, 3, 0, -1};
int i, error;
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 1568d0bfd1a8..1816e55c6edf 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -180,7 +180,7 @@ static int snd_es1688_probe(struct snd_es1688 *chip)
static int snd_es1688_init(struct snd_es1688 * chip, int enable) { - static int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1}; + static const int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1}; unsigned long flags; int cfg, irq_bits, dma, dma_bits, tmp, tmp1;
@@ -946,7 +946,7 @@ ES1688_SINGLE("Capture Switch", 0, ES1688_REC_DEV, 4, 1, 1),
#define ES1688_INIT_TABLE_SIZE (sizeof(snd_es1688_init_table)/2)
-static unsigned char snd_es1688_init_table[][2] = { +static const unsigned char snd_es1688_init_table[][2] = { { ES1688_MASTER_DEV, 0 }, { ES1688_PCM_DEV, 0 }, { ES1688_LINE_DEV, 0 },
Apply const prefix to the static map tables and the static resource tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/es18xx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 6ce5b5c76980..d1135f6ae104 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -965,7 +965,7 @@ static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - static unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3}; + static const unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3}; struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); int muxSource = snd_es18xx_mixer_read(chip, 0x1c) & 0x07; if (!(chip->version == 0x1869 || chip->version == 0x1879)) { @@ -982,7 +982,7 @@ static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - static unsigned char map4Source[4] = {0, 2, 6, 7}; + static const unsigned char map4Source[4] = {0, 2, 6, 7}; struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); unsigned char val = ucontrol->value.enumerated.item[0]; unsigned char retVal = 0; @@ -2173,8 +2173,8 @@ static int snd_es18xx_isa_probe1(int dev, struct device *devptr) static int snd_es18xx_isa_probe(struct device *pdev, unsigned int dev) { int err; - static int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; - static int possible_dmas[] = {1, 0, 3, 5, -1}; + static const int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; + static const int possible_dmas[] = {1, 0, 3, 5, -1};
if (irq[dev] == SNDRV_AUTO_IRQ) { if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) { @@ -2198,7 +2198,7 @@ static int snd_es18xx_isa_probe(struct device *pdev, unsigned int dev) if (port[dev] != SNDRV_AUTO_PORT) { return snd_es18xx_isa_probe1(dev, pdev); } else { - static unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280}; + static const unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280}; int i; for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { port[dev] = possible_ports[i];
Apply const prefix to each possible place: the static resource tables, the volume table, etc.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/gus/gus_io.c | 2 +- sound/isa/gus/gus_main.c | 4 ++-- sound/isa/gus/gus_volume.c | 9 +++++---- sound/isa/gus/gusclassic.c | 6 +++--- sound/isa/gus/gusextreme.c | 10 +++++----- sound/isa/gus/gusmax.c | 6 +++--- sound/isa/gus/interwave.c | 10 +++++----- 7 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/sound/isa/gus/gus_io.c b/sound/isa/gus/gus_io.c index 0ab550bc80f2..fb7b5e2636b8 100644 --- a/sound/isa/gus/gus_io.c +++ b/sound/isa/gus/gus_io.c @@ -403,7 +403,7 @@ void snd_gf1_select_active_voices(struct snd_gus_card * gus) { unsigned short voices;
- static unsigned short voices_tbl[32 - 14 + 1] = + static const unsigned short voices_tbl[32 - 14 + 1] = { 44100, 41160, 38587, 36317, 34300, 32494, 30870, 29400, 28063, 26843, 25725, 24696, 23746, 22866, 22050, 21289, 20580, 19916, 19293 diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index e9fc333c0fcb..afc088f0377c 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -267,9 +267,9 @@ static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches) struct snd_card *card; unsigned long flags; int irq, dma1, dma2; - static unsigned char irqs[16] = + static const unsigned char irqs[16] = {0, 0, 1, 3, 0, 2, 0, 4, 0, 1, 0, 5, 6, 0, 0, 7}; - static unsigned char dmas[8] = + static const unsigned char dmas[8] = {6, 1, 0, 2, 0, 3, 4, 5};
if (snd_BUG_ON(!gus)) diff --git a/sound/isa/gus/gus_volume.c b/sound/isa/gus/gus_volume.c index 39a2e5bd6c0a..ed72196a361b 100644 --- a/sound/isa/gus/gus_volume.c +++ b/sound/isa/gus/gus_volume.c @@ -62,7 +62,7 @@ unsigned int snd_gf1_calc_ramp_rate(struct snd_gus_card * gus, unsigned short end, unsigned int us) { - static unsigned char vol_rates[19] = + static const unsigned char vol_rates[19] = { 23, 24, 26, 28, 29, 31, 32, 34, 36, 37, 39, 40, 42, 44, 45, 47, @@ -113,7 +113,7 @@ unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int fr
short snd_gf1_compute_vibrato(short cents, unsigned short fc_register) { - static short vibrato_table[] = + static const short vibrato_table[] = { 0, 0, 32, 592, 61, 1175, 93, 1808, 124, 2433, 152, 3007, 182, 3632, 213, 4290, @@ -121,7 +121,8 @@ short snd_gf1_compute_vibrato(short cents, unsigned short fc_register) };
long depth; - short *vi1, *vi2, pcents, v1; + const short *vi1, *vi2; + short pcents, v1;
pcents = cents < 0 ? -cents : cents; for (vi1 = vibrato_table, vi2 = vi1 + 2; pcents > *vi2; vi1 = vi2, vi2 += 2); @@ -145,7 +146,7 @@ short snd_gf1_compute_vibrato(short cents, unsigned short fc_register)
unsigned short snd_gf1_compute_pitchbend(unsigned short pitchbend, unsigned short sens) { - static long log_table[] = {1024, 1085, 1149, 1218, 1290, 1367, 1448, 1534, 1625, 1722, 1825, 1933}; + static const long log_table[] = {1024, 1085, 1149, 1218, 1290, 1367, 1448, 1534, 1625, 1722, 1825, 1933}; int wheel, sensitivity; unsigned int mantissa, f1, f2; unsigned short semitones, f1_index, f2_index, f1_power, f2_power; diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index f7e869771d16..7419b1939754 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -67,9 +67,9 @@ static int snd_gusclassic_create(struct snd_card *card, struct device *dev, unsigned int n, struct snd_gus_card **rgus) { - static long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260}; - static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; - static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; + static const long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260}; + static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; + static const int possible_dmas[] = {5, 6, 7, 1, 3, -1};
int i, error;
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 8cf366bbdd8d..ed2f9d64efae 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -83,9 +83,9 @@ static int snd_gusextreme_es1688_create(struct snd_card *card, struct snd_es1688 *chip, struct device *dev, unsigned int n) { - static long possible_ports[] = {0x220, 0x240, 0x260}; - static int possible_irqs[] = {5, 9, 10, 7, -1}; - static int possible_dmas[] = {1, 3, 0, -1}; + static const long possible_ports[] = {0x220, 0x240, 0x260}; + static const int possible_irqs[] = {5, 9, 10, 7, -1}; + static const int possible_dmas[] = {1, 3, 0, -1};
int i, error;
@@ -122,8 +122,8 @@ static int snd_gusextreme_gus_card_create(struct snd_card *card, struct device *dev, unsigned int n, struct snd_gus_card **rgus) { - static int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1}; - static int possible_dmas[] = {5, 6, 7, 3, 1, -1}; + static const int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1}; + static const int possible_dmas[] = {5, 6, 7, 3, 1, -1};
if (gf1_irq[n] == SNDRV_AUTO_IRQ) { gf1_irq[n] = snd_legacy_find_free_irq(possible_irqs); diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index efe576625f48..05cd9be4dd8a 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -191,8 +191,8 @@ static int snd_gusmax_match(struct device *pdev, unsigned int dev)
static int snd_gusmax_probe(struct device *pdev, unsigned int dev) { - static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; - static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; + static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; + static const int possible_dmas[] = {5, 6, 7, 1, 3, -1}; int xirq, xdma1, xdma2, err; struct snd_card *card; struct snd_gus_card *gus = NULL; @@ -241,7 +241,7 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev) pcm_channels[dev], 0, &gus); } else { - static unsigned long possible_ports[] = { + static const unsigned long possible_ports[] = { 0x220, 0x230, 0x240, 0x250, 0x260 }; int i; diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 5cd4aa477ba7..3e9ad930deae 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -364,7 +364,7 @@ struct rom_hdr {
static void snd_interwave_detect_memory(struct snd_gus_card *gus) { - static unsigned int lmc[13] = + static const unsigned int lmc[13] = { 0x00000001, 0x00000101, 0x01010101, 0x00000401, 0x04040401, 0x00040101, 0x04040101, 0x00000004, @@ -475,7 +475,7 @@ static void snd_interwave_init(int dev, struct snd_gus_card *gus)
}
-static struct snd_kcontrol_new snd_interwave_controls[] = { +static const struct snd_kcontrol_new snd_interwave_controls[] = { WSS_DOUBLE("Master Playback Switch", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1), WSS_DOUBLE("Master Playback Volume", 0, @@ -788,8 +788,8 @@ static int snd_interwave_isa_probe(struct device *pdev, unsigned int dev) { int err; - static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; - static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; + static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; + static const int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1};
if (irq[dev] == SNDRV_AUTO_IRQ) { if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) { @@ -813,7 +813,7 @@ static int snd_interwave_isa_probe(struct device *pdev, if (port[dev] != SNDRV_AUTO_PORT) return snd_interwave_isa_probe1(dev, pdev); else { - static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; + static const long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; int i; for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { port[dev] = possible_ports[i];
Apply const prefix to the static resource tables, the mc size tables and the string arrays.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/opti9xx/miro.c | 18 +++++++++--------- sound/isa/opti9xx/opti92x-ad1848.c | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index a9c773b9f471..e764816a8f7a 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c @@ -119,7 +119,7 @@ struct snd_miro {
static struct snd_miro_aci aci_device;
-static char * snd_opti9xx_names[] = { +static const char * const snd_opti9xx_names[] = { "unknown", "82C928", "82C929", "82C924", "82C925", @@ -637,7 +637,7 @@ static const struct snd_kcontrol_new snd_miro_capture_control[] = { .put = snd_miro_put_capture, }};
-static unsigned char aci_init_values[][2] = { +static const unsigned char aci_init_values[][2] = { { ACI_SET_MUTE, 0x00 }, { ACI_SET_POWERAMP, 0x00 }, { ACI_SET_PREAMP, 0x00 }, @@ -764,7 +764,7 @@ static int snd_miro_mixer(struct snd_card *card, static int snd_miro_init(struct snd_miro *chip, unsigned short hardware) { - static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; + static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
chip->hardware = hardware; strcpy(chip->name, snd_opti9xx_names[hardware]); @@ -1387,12 +1387,12 @@ static int snd_miro_isa_match(struct device *devptr, unsigned int n)
static int snd_miro_isa_probe(struct device *devptr, unsigned int n) { - static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; - static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; - static int possible_irqs[] = {11, 9, 10, 7, -1}; - static int possible_mpu_irqs[] = {10, 5, 9, 7, -1}; - static int possible_dma1s[] = {3, 1, 0, -1}; - static int possible_dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, + static const long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; + static const long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; + static const int possible_irqs[] = {11, 9, 10, 7, -1}; + static const int possible_mpu_irqs[] = {10, 5, 9, 7, -1}; + static const int possible_dma1s[] = {3, 1, 0, -1}; + static const int possible_dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, {0, -1} };
int error; diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 697576459f71..d06b29693c85 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -163,7 +163,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_opti9xx_pnpids);
#define DEV_NAME KBUILD_MODNAME
-static char * snd_opti9xx_names[] = { +static const char * const snd_opti9xx_names[] = { "unknown", "82C928", "82C929", "82C924", "82C925", @@ -173,7 +173,7 @@ static char * snd_opti9xx_names[] = { static int snd_opti9xx_init(struct snd_opti9xx *chip, unsigned short hardware) { - static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; + static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
chip->hardware = hardware; strcpy(chip->name, snd_opti9xx_names[hardware]); @@ -808,7 +808,7 @@ static void snd_card_opti9xx_free(struct snd_card *card)
static int snd_opti9xx_probe(struct snd_card *card) { - static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; + static const long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; int error; int xdma2; struct snd_opti9xx *chip = card->private_data; @@ -958,16 +958,16 @@ static int snd_opti9xx_isa_probe(struct device *devptr, { struct snd_card *card; int error; - static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; + static const long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; #ifdef OPTi93X - static int possible_irqs[] = {5, 9, 10, 11, 7, -1}; + static const int possible_irqs[] = {5, 9, 10, 11, 7, -1}; #else - static int possible_irqs[] = {9, 10, 11, 7, -1}; + static const int possible_irqs[] = {9, 10, 11, 7, -1}; #endif /* OPTi93X */ - static int possible_mpu_irqs[] = {5, 9, 10, 7, -1}; - static int possible_dma1s[] = {3, 1, 0, -1}; + static const int possible_mpu_irqs[] = {5, 9, 10, 7, -1}; + static const int possible_dma1s[] = {3, 1, 0, -1}; #if defined(CS4231) || defined(OPTi93X) - static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; + static const int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; #endif /* CS4231 || OPTi93X */
if (mpu_port == SNDRV_AUTO_PORT) {
Apply const prefix to the static tables for parameters.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/wss/wss_lib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index d37f4642162a..ea5d3cdfe4e4 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -38,7 +38,7 @@ MODULE_LICENSE("GPL"); * Some variables */
-static unsigned char freq_bits[14] = { +static const unsigned char freq_bits[14] = { /* 5510 */ 0x00 | CS4231_XTAL2, /* 6620 */ 0x0E | CS4231_XTAL2, /* 8000 */ 0x00 | CS4231_XTAL1, @@ -72,7 +72,7 @@ static int snd_wss_xrate(struct snd_pcm_runtime *runtime) &hw_constraints_rates); }
-static unsigned char snd_wss_original_image[32] = +static const unsigned char snd_wss_original_image[32] = { 0x00, /* 00/00 - lic */ 0x00, /* 01/01 - ric */ @@ -108,7 +108,7 @@ static unsigned char snd_wss_original_image[32] = 0x00, /* 1f/31 - cbrl */ };
-static unsigned char snd_opti93x_original_image[32] = +static const unsigned char snd_opti93x_original_image[32] = { 0x00, /* 00/00 - l_mixout_outctrl */ 0x00, /* 01/01 - r_mixout_outctrl */
Apply const prefix to the static resource tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/sc6000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c index 395ee3b1794d..3d0bea44f454 100644 --- a/sound/isa/sc6000.c +++ b/sound/isa/sc6000.c @@ -534,8 +534,8 @@ static int snd_sc6000_match(struct device *devptr, unsigned int dev)
static int snd_sc6000_probe(struct device *devptr, unsigned int dev) { - static int possible_irqs[] = { 5, 7, 9, 10, 11, -1 }; - static int possible_dmas[] = { 1, 3, 0, -1 }; + static const int possible_irqs[] = { 5, 7, 9, 10, 11, -1 }; + static const int possible_dmas[] = { 1, 3, 0, -1 }; int err; int xirq = irq[dev]; int xdma = dma[dev];
Apply const prefix to the static mapping tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/mts64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index eeef3c0215e4..9c708b693cb3 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c @@ -261,7 +261,7 @@ static int mts64_device_close(struct mts64 *mts) */ static u8 mts64_map_midi_input(u8 c) { - static u8 map[] = { 0, 1, 4, 2, 3 }; + static const u8 map[] = { 0, 1, 4, 2, 3 };
return map[c]; } @@ -353,7 +353,7 @@ static void mts64_smpte_start(struct parport *p, u8 seconds, u8 frames, u8 idx) { - static u8 fps[5] = { MTS64_CMD_SMPTE_FPS_24, + static const u8 fps[5] = { MTS64_CMD_SMPTE_FPS_24, MTS64_CMD_SMPTE_FPS_25, MTS64_CMD_SMPTE_FPS_2997, MTS64_CMD_SMPTE_FPS_30D,
Apply const prefix to the static parameter tables.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/aw2/aw2-tsl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/aw2/aw2-tsl.c b/sound/pci/aw2/aw2-tsl.c index 41fed546ea14..2f35b08809a3 100644 --- a/sound/pci/aw2/aw2-tsl.c +++ b/sound/pci/aw2/aw2-tsl.c @@ -59,7 +59,7 @@ /* SD3: >-------<_4-L___>-------<_4-R___> */ /* WS4: -------_______________/--------- */
-static int tsl1[8] = { +static const int tsl1[8] = { 1 * TSL_SDW_A1 | 3 * TSL_BSEL_A1 | 0 * TSL_DIS_A1 | 0 * TSL_DOD_A1 | TSL_LF_A1,
@@ -85,7 +85,7 @@ static int tsl1[8] = { 0 * TSL_DOD_A1 | TSL_WS1 | TSL_WS0 | TSL_SF_A1 | TSL_EOS, };
-static int tsl2[8] = { +static const int tsl2[8] = { 0 * TSL_SDW_A2 | 3 * TSL_BSEL_A2 | 2 * TSL_DOD_A2 | TSL_LF_A2, 0 * TSL_SDW_A2 | 2 * TSL_BSEL_A2 | 2 * TSL_DOD_A2, 0 * TSL_SDW_A2 | 3 * TSL_BSEL_A2 | 2 * TSL_DOD_A2,
Apply const prefix to the static tables for the DSP command and the peak map.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/lx6464es/lx_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c index dd3a873777eb..f884f5a6a61c 100644 --- a/sound/pci/lx6464es/lx_core.c +++ b/sound/pci/lx6464es/lx_core.c @@ -161,7 +161,7 @@ struct dsp_cmd_info { the number of status words (in addition to the return value) */
-static struct dsp_cmd_info dsp_commands[] = +static const struct dsp_cmd_info dsp_commands[] = { { (CMD_00_INFO_DEBUG << OPCODE_OFFSET) , 1 /*custom*/ , 1 , 0 /**/ , CMD_NAME("INFO_DEBUG") }, @@ -858,7 +858,7 @@ int lx_level_unmute(struct lx6464es *chip, int is_capture, int unmute) return err; }
-static u32 peak_map[] = { +static const u32 peak_map[] = { 0x00000109, /* -90.308dB */ 0x0000083B, /* -72.247dB */ 0x000020C4, /* -60.205dB */
Apply const prefix to the static channel list table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/arm/aaci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index d663bd7adae6..a0996c47e58f 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c @@ -380,7 +380,7 @@ static const struct snd_pcm_hardware aaci_hw_info = { static int aaci_rule_channels(struct snd_pcm_hw_params *p, struct snd_pcm_hw_rule *rule) { - static unsigned int channel_list[] = { 2, 4, 6 }; + static const unsigned int channel_list[] = { 2, 4, 6 }; struct aaci *aaci = rule->private; unsigned int mask = 1 << 0, slots;
Apply const prefix to the static volume table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/opl4/opl4_synth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/drivers/opl4/opl4_synth.c b/sound/drivers/opl4/opl4_synth.c index 7bc1e58c95aa..34e2bd52bba1 100644 --- a/sound/drivers/opl4/opl4_synth.c +++ b/sound/drivers/opl4/opl4_synth.c @@ -248,7 +248,7 @@ static const s16 snd_opl4_pitch_map[0x600] = { * Attenuation according to GM recommendations, in -0.375 dB units. * table[v] = 40 * log(v / 127) / -0.375 */ -static unsigned char snd_opl4_volume_table[128] = { +static const unsigned char snd_opl4_volume_table[128] = { 255,224,192,173,160,150,141,134, 128,122,117,113,109,105,102, 99, 96, 93, 90, 88, 85, 83, 81, 79,
Apply const prefix to the string array.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/serial-u16550.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 893c2b57331f..3947f084dd6b 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -42,7 +42,7 @@ MODULE_SUPPORTED_DEVICE("{{ALSA, MIDI serial u16550}}"); #define SNDRV_SERIAL_MS124W_MB 3 /* Midiator MS-124W in M/B mode */ #define SNDRV_SERIAL_GENERIC 4 /* Generic Interface */ #define SNDRV_SERIAL_MAX_ADAPTOR SNDRV_SERIAL_GENERIC -static char *adaptor_names[] = { +static const char * const adaptor_names[] = { "Soundcanvas", "MS-124T", "MS-124W S/A",
Apply const prefix to the initial register map.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ak4531_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/ak4531_codec.c b/sound/pci/ak4531_codec.c index c00c65726a34..e0a81f99f79a 100644 --- a/sound/pci/ak4531_codec.c +++ b/sound/pci/ak4531_codec.c @@ -335,7 +335,7 @@ static int snd_ak4531_dev_free(struct snd_device *device) return snd_ak4531_free(ak4531); }
-static u8 snd_ak4531_initial_map[0x19 + 1] = { +static const u8 snd_ak4531_initial_map[0x19 + 1] = { 0x9f, /* 00: Master Volume Lch */ 0x9f, /* 01: Master Volume Rch */ 0x9f, /* 02: Voice Volume Lch */
Apply const prefix to the static initial register table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/azt3328.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 73745352c55d..58167d8469e1 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -1152,7 +1152,7 @@ static const struct snd_kcontrol_new snd_azf3328_mixer_controls[] = { #endif };
-static u16 snd_azf3328_init_values[][2] = { +static const u16 snd_azf3328_init_values[][2] = { { IDX_MIXER_PLAY_MASTER, MIXER_MUTE_MASK|0x1f1f }, { IDX_MIXER_MODEMOUT, MIXER_MUTE_MASK|0x1f1f }, { IDX_MIXER_BASSTREBLE, 0x0000 },
Apply const prefix to the static register table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/cs4281.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index dc89ef906c9b..94d2a6a466a8 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -1939,7 +1939,7 @@ static void snd_cs4281_remove(struct pci_dev *pci) */ #ifdef CONFIG_PM_SLEEP
-static int saved_regs[SUSPEND_REGISTERS] = { +static const int saved_regs[SUSPEND_REGISTERS] = { BA0_JSCTL, BA0_GPIOR, BA0_SSCR,
Apply const prefix to the static channel list table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/echoaudio/echoaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index dae3a853a6e1..994ed51f813f 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -23,7 +23,7 @@ MODULE_PARM_DESC(id, "ID string for " ECHOCARD_NAME " soundcard."); module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable " ECHOCARD_NAME " soundcard.");
-static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999}; +static const unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999}; static const DECLARE_TLV_DB_SCALE(db_scale_output_gain, -12800, 100, 1);
Apply const prefix to the quirk entry, forgotten in the previous fix.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ens1370.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 7ef9b7a1b2e6..d9acef0826a9 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -1574,7 +1574,7 @@ static int es1371_quirk_lookup(struct ensoniq *ensoniq, return 0; }
-static struct es1371_quirk es1371_spdif_present[] = { +static const struct es1371_quirk es1371_spdif_present[] = { { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_C }, { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_D }, { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_E },
Apply const prefix to the static register table.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/fm801.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 40dfad74f8e1..181ebafa550a 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -1360,7 +1360,7 @@ static void snd_card_fm801_remove(struct pci_dev *pci) }
#ifdef CONFIG_PM_SLEEP -static unsigned char saved_regs[] = { +static const unsigned char saved_regs[] = { FM801_PCM_VOL, FM801_I2S_VOL, FM801_FM_VOL, FM801_REC_SRC, FM801_PLY_CTRL, FM801_PLY_COUNT, FM801_PLY_BUF1, FM801_PLY_BUF2, FM801_CAP_CTRL, FM801_CAP_COUNT, FM801_CAP_BUF1, FM801_CAP_BUF2,
Apply const prefix to the static table for the chip models.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/via82xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 6c83ad3275f9..799789c8eea9 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2403,7 +2403,7 @@ struct via823x_info { char *name; int type; }; -static struct via823x_info via823x_cards[] = { +static const struct via823x_info via823x_cards[] = { { VIA_REV_PRE_8233, "VIA 8233-Pre", TYPE_VIA8233 }, { VIA_REV_8233C, "VIA 8233C", TYPE_VIA8233 }, { VIA_REV_8233, "VIA 8233", TYPE_VIA8233 },
Apply const prefix to the static table for verbs.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pcmcia/pdaudiocf/pdaudiocf_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c index db3cd459b954..5537c0882aa5 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c @@ -179,7 +179,7 @@ int snd_pdacf_ak4117_create(struct snd_pdacf *chip) /* from AK4117 then INT1 pin from AK4117 will be high all time, because PCMCIA interrupts are */ /* egde based and FPGA does logical OR for all interrupt sources, we cannot use these */ /* high-rate sources */ - static unsigned char pgm[5] = { + static const unsigned char pgm[5] = { AK4117_XTL_24_576M | AK4117_EXCT, /* AK4117_REG_PWRDN */ AK4117_CM_PLL_XTAL | AK4117_PKCS_128fs | AK4117_XCKS_128fs, /* AK4117_REQ_CLOCK */ AK4117_EFH_1024LRCLK | AK4117_DIF_24R | AK4117_IPS, /* AK4117_REG_IO */
Apply const prefix to the static table for registers.
Just for minor optimization and no functional changes.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/spi/at73c213.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index e51bbf7836a2..76c0e37a838c 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c @@ -36,7 +36,7 @@ #define BITRATE_MAX 50000 /* Hardware limit. */
/* Initial (hardware reset) AT73C213 register values. */ -static u8 snd_at73c213_original_image[18] = +static const u8 snd_at73c213_original_image[18] = { 0x00, /* 00 - CTRL */ 0x05, /* 01 - LLIG */
A long-standing compile warning was seen during build test: sound/sh/aica.c: In function 'load_aica_firmware': sound/sh/aica.c:521:25: warning: passing argument 2 of 'spu_memload' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
Fixes: 198de43d758c ("[ALSA] Add ALSA support for the SEGA Dreamcast PCM device") Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/sh/aica.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/sh/aica.c b/sound/sh/aica.c index f3cd12ff09c3..8fa68432d3c1 100644 --- a/sound/sh/aica.c +++ b/sound/sh/aica.c @@ -101,10 +101,10 @@ static void spu_memset(u32 toi, u32 what, int length) }
/* spu_memload - write to SPU address space */ -static void spu_memload(u32 toi, void *from, int length) +static void spu_memload(u32 toi, const void *from, int length) { unsigned long flags; - u32 *froml = from; + const u32 *froml = from; u32 __iomem *to = (u32 __iomem *) (SPU_MEMORY_BASE + toi); int i; u32 val;
participants (1)
-
Takashi Iwai