ALSA: Constify the snd_pcm_substream struct ops field
PATCH 1/1 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 <[email protected]>
--- include/sound/pcm.h | 5 +++-- sound/core/pcm_lib.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-)
include/sound/pcm.h +3 -2
@@ -384,7 +384,7 @@ struct snd_pcm_substream {unsigned int dma_buf_id;size_t dma_max;/* -- hardware operations -- */ -struct snd_pcm_ops *ops; +const struct snd_pcm_ops *ops;/* -- runtime information -- */ struct snd_pcm_runtime *runtime;/* -- timer section -- */
@@ -871,7 +871,8 @@ const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format);int snd_pcm_format_set_silence (snd_pcm_format_t format,void *buf,unsigned int frames);snd_pcm_format_t snd_pcm_build_linear_format (int width,int unsigned ,int big_endian); -void snd_pcm_set_ops (struct snd_pcm * pcm,int direction,struct snd_pcm_ops *ops); +void snd_pcm_set_ops (struct snd_pcm * pcm,int direction, +const struct snd_pcm_ops *ops);void snd_pcm_set_sync (struct snd_pcm_substream *substream);int snd_pcm_lib_interleave_len (struct snd_pcm_substream *substream); int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
sound/core/pcm_lib.c +2 -1
@@ -568,7 +568,8 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)* * Sets the given PCM operators to the pcm instance. */ -void snd_pcm_set_ops (struct snd_pcm *pcm,int direction,struct snd_pcm_ops *ops) +void snd_pcm_set_ops (struct snd_pcm *pcm,int direction, +const struct snd_pcm_ops *ops) {struct snd_pcm_str *stream = &pcm->streams[direction];struct snd_pcm_substream *substream;
Signature · 1 line
1.8.0
Takashi Iwai
AppliedAt Fri, 24 May 2013 15:18:10 +0200,
Quoted 6 lines · Lars-Peter Clausen
The ops field of the
snd_pcm_substreamstruct is never modified inside the ALSA core. Making it const allows drivers to declare theirsnd_pcm_opsstruct as const.Signed-off-by Lars-Peter Clausen <[email protected]>
Thanks, applied.
Takashi
Quoted 50 lines
--- include/sound/pcm.h | 5 +++-- sound/core/pcm_lib.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-)include/sound/pcm.h +3
-2@@ -384,7 +384,7 @@ struct snd_pcm_substream {unsigned int dma_buf_id;size_t dma_max;/* -- hardware operations -- */ -struct snd_pcm_ops *ops; +const struct snd_pcm_ops *ops;/* -- runtime information -- */ struct snd_pcm_runtime *runtime;/* -- timer section -- */ @@ -871,7 +871,8 @@ const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format);int snd_pcm_format_set_silence (snd_pcm_format_t format,void *buf,unsigned int frames);snd_pcm_format_t snd_pcm_build_linear_format (int width,int unsigned ,int big_endian); -void snd_pcm_set_ops (struct snd_pcm * pcm,int direction,struct snd_pcm_ops *ops); +void snd_pcm_set_ops (struct snd_pcm * pcm,int direction, +const struct snd_pcm_ops *ops);void snd_pcm_set_sync (struct snd_pcm_substream *substream);int snd_pcm_lib_interleave_len (struct snd_pcm_substream *substream); int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,sound/core/pcm_lib.c +2
-1@@ -568,7 +568,8 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)* * Sets the given PCM operators to the pcm instance. */ -void snd_pcm_set_ops (struct snd_pcm *pcm,int direction,struct snd_pcm_ops *ops) +void snd_pcm_set_ops (struct snd_pcm *pcm,int direction, +const struct snd_pcm_ops *ops) {struct snd_pcm_str *stream = &pcm->streams[direction];struct snd_pcm_substream *substream;Signature · 6 lines
1.8.0 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel