aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-05-24 09:18:10 -0400
committerTakashi Iwai <tiwai@suse.de>2013-05-24 09:41:44 -0400
commite6c2e7eb27fc512af6875d7f2cf313e29c61be0b (patch)
tree6e254e4b5b673569b2910fb2a6d7a16c86298308
parent3cf981484a002fd02c410741d30b234227f89568 (diff)
ALSA: Constify the snd_pcm_substream struct ops field
The ops field of the snd_pcm_substream struct is never modified inside the ALSA core. Making it const allows drivers to declare their snd_pcm_ops struct as const. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/pcm.h5
-rw-r--r--sound/core/pcm_lib.c3
2 files changed, 5 insertions, 3 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index b48792fe386b..84b10f9a2832 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -384,7 +384,7 @@ struct snd_pcm_substream {
384 unsigned int dma_buf_id; 384 unsigned int dma_buf_id;
385 size_t dma_max; 385 size_t dma_max;
386 /* -- hardware operations -- */ 386 /* -- hardware operations -- */
387 struct snd_pcm_ops *ops; 387 const struct snd_pcm_ops *ops;
388 /* -- runtime information -- */ 388 /* -- runtime information -- */
389 struct snd_pcm_runtime *runtime; 389 struct snd_pcm_runtime *runtime;
390 /* -- timer section -- */ 390 /* -- timer section -- */
@@ -871,7 +871,8 @@ const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format);
871int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); 871int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames);
872snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsigned, int big_endian); 872snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsigned, int big_endian);
873 873
874void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops); 874void snd_pcm_set_ops(struct snd_pcm * pcm, int direction,
875 const struct snd_pcm_ops *ops);
875void snd_pcm_set_sync(struct snd_pcm_substream *substream); 876void snd_pcm_set_sync(struct snd_pcm_substream *substream);
876int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream); 877int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
877int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, 878int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 41b3dfe68698..82bb029d4414 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -568,7 +568,8 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
568 * 568 *
569 * Sets the given PCM operators to the pcm instance. 569 * Sets the given PCM operators to the pcm instance.
570 */ 570 */
571void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, struct snd_pcm_ops *ops) 571void snd_pcm_set_ops(struct snd_pcm *pcm, int direction,
572 const struct snd_pcm_ops *ops)
572{ 573{
573 struct snd_pcm_str *stream = &pcm->streams[direction]; 574 struct snd_pcm_str *stream = &pcm->streams[direction];
574 struct snd_pcm_substream *substream; 575 struct snd_pcm_substream *substream;