sound: oss: make the function argument and structure const
cover 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(-)
Signature · 1 line
1.9.1
PATCH 1/2 sound: oss: make the function argument as const
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.
--- sound/oss/dev_table.c | 2 +- sound/oss/dev_table.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/oss/dev_table.c +1 -1
@@ -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) {
sound/oss/dev_table.h +1 -1
@@ -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,
Signature · 1 line
1.9.1
PATCH 2/2 sound: oss: make audio_driver structure const
In reply to Bhumika GoyalThis 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.
--- sound/oss/pas2_pcm.c | 2 +- sound/oss/waveartist.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/oss/pas2_pcm.c +1 -1
@@ -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,
sound/oss/waveartist.c +1 -1
@@ -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,
Signature · 1 line
1.9.1
Quoted 9 lines · Bhumika Goyal
Make the function argument of function
sound_install_audiodrvconst. After this change, make the structuresaudio_driverconst as they are only passed to the const argument (made const in Patch[1/2]) of the functionsound_install_audiodrv.Bhumika Goyal (2):
sound: oss: make the function argument as const
sound: oss: makeaudio_driverstructure const
The OSS code is already disabled in Kconfig and will be dropped soon, so please don't touch it.
thanks,
Takashi
Quoted 11 lines
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(-)Signature · 1 line
1.9.1