[alsa-devel] [PATCH 0/2] sound: oss: make the function argument and structure const
Make the function argument of function sound_install_audiodrv const. After this change, make the structures audio_driver const as they are only passed to the const argument (made const in Patch[1/2]) of the function sound_install_audiodrv .
Bhumika Goyal (2): sound: oss: make the function argument as const sound: oss: make audio_driver structure const
sound/oss/dev_table.c | 2 +- sound/oss/dev_table.h | 2 +- sound/oss/pas2_pcm.c | 2 +- sound/oss/waveartist.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
Make the function argument struct audio_driver *driver of the function sound_install_audiodrv as const as it's memory contents are only copied during a memcpy call. So, the fields of the structure to which driver points to never gets modified and therefore the argument can be made const. Add const to the prototype too.
Signed-off-by: Bhumika Goyal bhumirks@gmail.com --- sound/oss/dev_table.c | 2 +- sound/oss/dev_table.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/oss/dev_table.c b/sound/oss/dev_table.c index 6dad515..dbb9a3b 100644 --- a/sound/oss/dev_table.c +++ b/sound/oss/dev_table.c @@ -48,7 +48,7 @@ struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] = {
static int sound_alloc_audiodev(void);
-int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver, +int sound_install_audiodrv(int vers, char *name, const struct audio_driver *driver, int driver_size, int flags, unsigned int format_mask, void *devc, int dma1, int dma2) { diff --git a/sound/oss/dev_table.h b/sound/oss/dev_table.h index 0199a31..b388ed0 100644 --- a/sound/oss/dev_table.h +++ b/sound/oss/dev_table.h @@ -371,7 +371,7 @@ struct sound_timer_operations
#define AUDIO_DRIVER_VERSION 2 #define MIXER_DRIVER_VERSION 2 -int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver, +int sound_install_audiodrv(int vers, char *name, const struct audio_driver *driver, int driver_size, int flags, unsigned int format_mask, void *devc, int dma1, int dma2); int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
This is a followup patch for [PATCH 1/2].
Make these structures const as they are only passed to the const argument of the function sound_install_audiodrv.
Signed-off-by: Bhumika Goyal bhumirks@gmail.com --- sound/oss/pas2_pcm.c | 2 +- sound/oss/waveartist.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c index 474803b..716c5c4 100644 --- a/sound/oss/pas2_pcm.c +++ b/sound/oss/pas2_pcm.c @@ -356,7 +356,7 @@ static int pas_audio_prepare_for_output(int dev, int bsize, int bcount) return 0; }
-static struct audio_driver pas_audio_driver = +static const struct audio_driver pas_audio_driver = { .owner = THIS_MODULE, .open = pas_audio_open, diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c index 4f0c3a2..7509777 100644 --- a/sound/oss/waveartist.c +++ b/sound/oss/waveartist.c @@ -826,7 +826,7 @@ static void vnc_configure_mixer(struct wavnc_info *devc, return arg; }
-static struct audio_driver waveartist_audio_driver = { +static const struct audio_driver waveartist_audio_driver = { .owner = THIS_MODULE, .open = waveartist_open, .close = waveartist_close,
On Fri, 13 Oct 2017 19:16:31 +0200, Bhumika Goyal wrote:
Make the function argument of function sound_install_audiodrv const. After this change, make the structures audio_driver const as they are only passed to the const argument (made const in Patch[1/2]) of the function sound_install_audiodrv .
Bhumika Goyal (2): sound: oss: make the function argument as const sound: oss: make audio_driver structure const
The OSS code is already disabled in Kconfig and will be dropped soon, so please don't touch it.
thanks,
Takashi
sound/oss/dev_table.c | 2 +- sound/oss/dev_table.h | 2 +- sound/oss/pas2_pcm.c | 2 +- sound/oss/waveartist.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
-- 1.9.1
participants (2)
-
Bhumika Goyal
-
Takashi Iwai