diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2016-09-11 09:05:43 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-09-12 02:17:19 -0400 |
commit | 071f1344f47946dfcb511bf0fbc998dd9a83be29 (patch) | |
tree | 607abf5569f74f57b051511b9ef93f96454d4399 | |
parent | 3d2f4d0c0d4f3b676ecca504a3916b8e9843a181 (diff) |
ALSA: pci: constify local structures
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.
Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/ctxfi/ctatc.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_ca0132.c | 10 | ||||
-rw-r--r-- | sound/pci/riptide/riptide.c | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 977a59855fa6..908658a00377 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -1623,7 +1623,7 @@ static int atc_resume(struct ct_atc *atc) | |||
1623 | } | 1623 | } |
1624 | #endif | 1624 | #endif |
1625 | 1625 | ||
1626 | static struct ct_atc atc_preset = { | 1626 | static const struct ct_atc atc_preset = { |
1627 | .map_audio_buffer = ct_map_audio_buffer, | 1627 | .map_audio_buffer = ct_map_audio_buffer, |
1628 | .unmap_audio_buffer = ct_unmap_audio_buffer, | 1628 | .unmap_audio_buffer = ct_unmap_audio_buffer, |
1629 | .pcm_playback_prepare = atc_pcm_playback_prepare, | 1629 | .pcm_playback_prepare = atc_pcm_playback_prepare, |
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 9ceb2bc36e68..ad06866d7c69 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c | |||
@@ -4018,7 +4018,7 @@ static int ca0132_build_controls(struct hda_codec *codec) | |||
4018 | /* | 4018 | /* |
4019 | * PCM | 4019 | * PCM |
4020 | */ | 4020 | */ |
4021 | static struct hda_pcm_stream ca0132_pcm_analog_playback = { | 4021 | static const struct hda_pcm_stream ca0132_pcm_analog_playback = { |
4022 | .substreams = 1, | 4022 | .substreams = 1, |
4023 | .channels_min = 2, | 4023 | .channels_min = 2, |
4024 | .channels_max = 6, | 4024 | .channels_max = 6, |
@@ -4029,7 +4029,7 @@ static struct hda_pcm_stream ca0132_pcm_analog_playback = { | |||
4029 | }, | 4029 | }, |
4030 | }; | 4030 | }; |
4031 | 4031 | ||
4032 | static struct hda_pcm_stream ca0132_pcm_analog_capture = { | 4032 | static const struct hda_pcm_stream ca0132_pcm_analog_capture = { |
4033 | .substreams = 1, | 4033 | .substreams = 1, |
4034 | .channels_min = 2, | 4034 | .channels_min = 2, |
4035 | .channels_max = 2, | 4035 | .channels_max = 2, |
@@ -4040,7 +4040,7 @@ static struct hda_pcm_stream ca0132_pcm_analog_capture = { | |||
4040 | }, | 4040 | }, |
4041 | }; | 4041 | }; |
4042 | 4042 | ||
4043 | static struct hda_pcm_stream ca0132_pcm_digital_playback = { | 4043 | static const struct hda_pcm_stream ca0132_pcm_digital_playback = { |
4044 | .substreams = 1, | 4044 | .substreams = 1, |
4045 | .channels_min = 2, | 4045 | .channels_min = 2, |
4046 | .channels_max = 2, | 4046 | .channels_max = 2, |
@@ -4052,7 +4052,7 @@ static struct hda_pcm_stream ca0132_pcm_digital_playback = { | |||
4052 | }, | 4052 | }, |
4053 | }; | 4053 | }; |
4054 | 4054 | ||
4055 | static struct hda_pcm_stream ca0132_pcm_digital_capture = { | 4055 | static const struct hda_pcm_stream ca0132_pcm_digital_capture = { |
4056 | .substreams = 1, | 4056 | .substreams = 1, |
4057 | .channels_min = 2, | 4057 | .channels_min = 2, |
4058 | .channels_max = 2, | 4058 | .channels_max = 2, |
@@ -4614,7 +4614,7 @@ static void ca0132_free(struct hda_codec *codec) | |||
4614 | kfree(codec->spec); | 4614 | kfree(codec->spec); |
4615 | } | 4615 | } |
4616 | 4616 | ||
4617 | static struct hda_codec_ops ca0132_patch_ops = { | 4617 | static const struct hda_codec_ops ca0132_patch_ops = { |
4618 | .build_controls = ca0132_build_controls, | 4618 | .build_controls = ca0132_build_controls, |
4619 | .build_pcms = ca0132_build_pcms, | 4619 | .build_pcms = ca0132_build_pcms, |
4620 | .init = ca0132_init, | 4620 | .init = ca0132_init, |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index ae41fcb89384..ada5f01d479c 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -644,7 +644,7 @@ static struct lbuspath lbus_play_paths[] = { | |||
644 | .mono = lbus_play_mono3, | 644 | .mono = lbus_play_mono3, |
645 | }, | 645 | }, |
646 | }; | 646 | }; |
647 | static struct lbuspath lbus_rec_path = { | 647 | static const struct lbuspath lbus_rec_path = { |
648 | .noconv = lbus_rec_noconv1, | 648 | .noconv = lbus_rec_noconv1, |
649 | .stereo = lbus_rec_stereo1, | 649 | .stereo = lbus_rec_stereo1, |
650 | .mono = lbus_rec_mono1, | 650 | .mono = lbus_rec_mono1, |