Commit 2eccd408 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: drivers: Constify snd_kcontrol_new items

Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.
Constify snd_kcontrol_new items

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-34-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent dde5199c
...@@ -1496,7 +1496,7 @@ static int loopback_channels_get(struct snd_kcontrol *kcontrol, ...@@ -1496,7 +1496,7 @@ static int loopback_channels_get(struct snd_kcontrol *kcontrol,
return 0; return 0;
} }
static struct snd_kcontrol_new loopback_controls[] = { static const struct snd_kcontrol_new loopback_controls[] = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = "PCM Rate Shift 100000", .name = "PCM Rate Shift 100000",
......
...@@ -849,7 +849,7 @@ static int snd_dummy_iobox_put(struct snd_kcontrol *kcontrol, ...@@ -849,7 +849,7 @@ static int snd_dummy_iobox_put(struct snd_kcontrol *kcontrol,
return changed; return changed;
} }
static struct snd_kcontrol_new snd_dummy_controls[] = { static const struct snd_kcontrol_new snd_dummy_controls[] = {
DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER), DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER),
DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER), DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER),
DUMMY_VOLUME("Synth Volume", 0, MIXER_ADDR_SYNTH), DUMMY_VOLUME("Synth Volume", 0, MIXER_ADDR_SYNTH),
......
...@@ -467,7 +467,7 @@ static int snd_mts64_ctl_smpte_switch_put(struct snd_kcontrol* kctl, ...@@ -467,7 +467,7 @@ static int snd_mts64_ctl_smpte_switch_put(struct snd_kcontrol* kctl,
return changed; return changed;
} }
static struct snd_kcontrol_new mts64_ctl_smpte_switch = { static const struct snd_kcontrol_new mts64_ctl_smpte_switch = {
.iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
.name = "SMPTE Playback Switch", .name = "SMPTE Playback Switch",
.index = 0, .index = 0,
...@@ -540,7 +540,7 @@ static int snd_mts64_ctl_smpte_time_put(struct snd_kcontrol *kctl, ...@@ -540,7 +540,7 @@ static int snd_mts64_ctl_smpte_time_put(struct snd_kcontrol *kctl,
return changed; return changed;
} }
static struct snd_kcontrol_new mts64_ctl_smpte_time_hours = { static const struct snd_kcontrol_new mts64_ctl_smpte_time_hours = {
.iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
.name = "SMPTE Time Hours", .name = "SMPTE Time Hours",
.index = 0, .index = 0,
...@@ -551,7 +551,7 @@ static struct snd_kcontrol_new mts64_ctl_smpte_time_hours = { ...@@ -551,7 +551,7 @@ static struct snd_kcontrol_new mts64_ctl_smpte_time_hours = {
.put = snd_mts64_ctl_smpte_time_put .put = snd_mts64_ctl_smpte_time_put
}; };
static struct snd_kcontrol_new mts64_ctl_smpte_time_minutes = { static const struct snd_kcontrol_new mts64_ctl_smpte_time_minutes = {
.iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
.name = "SMPTE Time Minutes", .name = "SMPTE Time Minutes",
.index = 0, .index = 0,
...@@ -562,7 +562,7 @@ static struct snd_kcontrol_new mts64_ctl_smpte_time_minutes = { ...@@ -562,7 +562,7 @@ static struct snd_kcontrol_new mts64_ctl_smpte_time_minutes = {
.put = snd_mts64_ctl_smpte_time_put .put = snd_mts64_ctl_smpte_time_put
}; };
static struct snd_kcontrol_new mts64_ctl_smpte_time_seconds = { static const struct snd_kcontrol_new mts64_ctl_smpte_time_seconds = {
.iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
.name = "SMPTE Time Seconds", .name = "SMPTE Time Seconds",
.index = 0, .index = 0,
...@@ -573,7 +573,7 @@ static struct snd_kcontrol_new mts64_ctl_smpte_time_seconds = { ...@@ -573,7 +573,7 @@ static struct snd_kcontrol_new mts64_ctl_smpte_time_seconds = {
.put = snd_mts64_ctl_smpte_time_put .put = snd_mts64_ctl_smpte_time_put
}; };
static struct snd_kcontrol_new mts64_ctl_smpte_time_frames = { static const struct snd_kcontrol_new mts64_ctl_smpte_time_frames = {
.iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
.name = "SMPTE Time Frames", .name = "SMPTE Time Frames",
.index = 0, .index = 0,
...@@ -625,7 +625,7 @@ static int snd_mts64_ctl_smpte_fps_put(struct snd_kcontrol *kctl, ...@@ -625,7 +625,7 @@ static int snd_mts64_ctl_smpte_fps_put(struct snd_kcontrol *kctl,
return changed; return changed;
} }
static struct snd_kcontrol_new mts64_ctl_smpte_fps = { static const struct snd_kcontrol_new mts64_ctl_smpte_fps = {
.iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
.name = "SMPTE Fps", .name = "SMPTE Fps",
.index = 0, .index = 0,
...@@ -641,7 +641,7 @@ static int snd_mts64_ctl_create(struct snd_card *card, ...@@ -641,7 +641,7 @@ static int snd_mts64_ctl_create(struct snd_card *card,
struct mts64 *mts) struct mts64 *mts)
{ {
int err, i; int err, i;
static struct snd_kcontrol_new *control[] = { static const struct snd_kcontrol_new *control[] = {
&mts64_ctl_smpte_switch, &mts64_ctl_smpte_switch,
&mts64_ctl_smpte_time_hours, &mts64_ctl_smpte_time_hours,
&mts64_ctl_smpte_time_minutes, &mts64_ctl_smpte_time_minutes,
......
...@@ -47,7 +47,7 @@ static int snd_opl4_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v ...@@ -47,7 +47,7 @@ static int snd_opl4_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
return value != old_value; return value != old_value;
} }
static struct snd_kcontrol_new snd_opl4_controls[] = { static const struct snd_kcontrol_new snd_opl4_controls[] = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "FM Playback Volume", .name = "FM Playback Volume",
......
...@@ -120,17 +120,17 @@ static int pcsp_pcspkr_put(struct snd_kcontrol *kcontrol, ...@@ -120,17 +120,17 @@ static int pcsp_pcspkr_put(struct snd_kcontrol *kcontrol,
.put = pcsp_##ctl_type##_put, \ .put = pcsp_##ctl_type##_put, \
} }
static struct snd_kcontrol_new snd_pcsp_controls_pcm[] = { static const struct snd_kcontrol_new snd_pcsp_controls_pcm[] = {
PCSP_MIXER_CONTROL(enable, "Master Playback Switch"), PCSP_MIXER_CONTROL(enable, "Master Playback Switch"),
PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"), PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"),
}; };
static struct snd_kcontrol_new snd_pcsp_controls_spkr[] = { static const struct snd_kcontrol_new snd_pcsp_controls_spkr[] = {
PCSP_MIXER_CONTROL(pcspkr, "Beep Playback Switch"), PCSP_MIXER_CONTROL(pcspkr, "Beep Playback Switch"),
}; };
static int snd_pcsp_ctls_add(struct snd_pcsp *chip, static int snd_pcsp_ctls_add(struct snd_pcsp *chip,
struct snd_kcontrol_new *ctls, int num) const struct snd_kcontrol_new *ctls, int num)
{ {
int i, err; int i, err;
struct snd_card *card = chip->card; struct snd_card *card = chip->card;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment