ALSA: i2c: Constify snd_kcontrol_new items
authorTakashi Iwai <tiwai@suse.de>
Fri, 3 Jan 2020 08:16:50 +0000 (09:16 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 3 Jan 2020 08:24:24 +0000 (09:24 +0100)
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-35-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/i2c/cs8427.c
sound/i2c/other/ak4113.c
sound/i2c/other/ak4114.c
sound/i2c/other/ak4117.c
sound/i2c/tea6330t.c

index bac4f00..8634d4f 100644 (file)
@@ -459,7 +459,7 @@ static int snd_cs8427_spdif_mask_get(struct snd_kcontrol *kcontrol,
        return 0;
 }
 
        return 0;
 }
 
-static struct snd_kcontrol_new snd_cs8427_iec958_controls[] = {
+static const struct snd_kcontrol_new snd_cs8427_iec958_controls[] = {
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
        .info =         snd_cs8427_in_status_info,
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
        .info =         snd_cs8427_in_status_info,
index 2700a84..e721309 100644 (file)
@@ -349,7 +349,7 @@ static int snd_ak4113_spdif_qget(struct snd_kcontrol *kcontrol,
 }
 
 /* Don't forget to change AK4113_CONTROLS define!!! */
 }
 
 /* Don't forget to change AK4113_CONTROLS define!!! */
-static struct snd_kcontrol_new snd_ak4113_iec958_controls[] = {
+static const struct snd_kcontrol_new snd_ak4113_iec958_controls[] = {
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
        .name =         "IEC958 Parity Errors",
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
        .name =         "IEC958 Parity Errors",
index e7325af..2ce0a97 100644 (file)
@@ -318,7 +318,7 @@ static int snd_ak4114_spdif_qget(struct snd_kcontrol *kcontrol,
 }
 
 /* Don't forget to change AK4114_CONTROLS define!!! */
 }
 
 /* Don't forget to change AK4114_CONTROLS define!!! */
-static struct snd_kcontrol_new snd_ak4114_iec958_controls[] = {
+static const struct snd_kcontrol_new snd_ak4114_iec958_controls[] = {
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
        .name =         "IEC958 Parity Errors",
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
        .name =         "IEC958 Parity Errors",
index 0d9e825..905be2d 100644 (file)
@@ -305,7 +305,7 @@ static int snd_ak4117_spdif_qget(struct snd_kcontrol *kcontrol,
 }
 
 /* Don't forget to change AK4117_CONTROLS define!!! */
 }
 
 /* Don't forget to change AK4117_CONTROLS define!!! */
-static struct snd_kcontrol_new snd_ak4117_iec958_controls[] = {
+static const struct snd_kcontrol_new snd_ak4117_iec958_controls[] = {
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
        .name =         "IEC958 Parity Errors",
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
        .name =         "IEC958 Parity Errors",
index 93ca8bb..08eb6a8 100644 (file)
@@ -260,7 +260,7 @@ static int snd_tea6330t_put_treble(struct snd_kcontrol *kcontrol,
        return change;
 }
 
        return change;
 }
 
-static struct snd_kcontrol_new snd_tea6330t_controls[] = {
+static const struct snd_kcontrol_new snd_tea6330t_controls[] = {
 TEA6330T_MASTER_SWITCH("Master Playback Switch", 0),
 TEA6330T_MASTER_VOLUME("Master Playback Volume", 0),
 TEA6330T_BASS("Tone Control - Bass", 0),
 TEA6330T_MASTER_SWITCH("Master Playback Switch", 0),
 TEA6330T_MASTER_VOLUME("Master Playback Volume", 0),
 TEA6330T_BASS("Tone Control - Bass", 0),
@@ -278,7 +278,7 @@ int snd_tea6330t_update_mixer(struct snd_card *card,
 {
        struct snd_i2c_device *device;
        struct tea6330t *tea;
 {
        struct snd_i2c_device *device;
        struct tea6330t *tea;
-       struct snd_kcontrol_new *knew;
+       const struct snd_kcontrol_new *knew;
        unsigned int idx;
        int err = -ENOMEM;
        u8 default_treble, default_bass;
        unsigned int idx;
        int err = -ENOMEM;
        u8 default_treble, default_bass;