All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] sound: oss: make the function argument and structure const
@ 2017-10-13 17:16 Bhumika Goyal
  2017-10-13 17:16 ` [PATCH 1/2] sound: oss: make the function argument as const Bhumika Goyal
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bhumika Goyal @ 2017-10-13 17:16 UTC (permalink / raw)
  To: julia.lawall, perex, tiwai, alsa-devel, linux-kernel; +Cc: Bhumika Goyal

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(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] sound: oss: make the function argument as const
  2017-10-13 17:16 [PATCH 0/2] sound: oss: make the function argument and structure const Bhumika Goyal
@ 2017-10-13 17:16 ` Bhumika Goyal
  2017-10-13 17:16 ` [PATCH 2/2] sound: oss: make audio_driver structure const Bhumika Goyal
  2017-10-16  8:52   ` Takashi Iwai
  2 siblings, 0 replies; 5+ messages in thread
From: Bhumika Goyal @ 2017-10-13 17:16 UTC (permalink / raw)
  To: julia.lawall, perex, tiwai, alsa-devel, linux-kernel; +Cc: Bhumika Goyal

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,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] sound: oss: make audio_driver structure const
  2017-10-13 17:16 [PATCH 0/2] sound: oss: make the function argument and structure const Bhumika Goyal
  2017-10-13 17:16 ` [PATCH 1/2] sound: oss: make the function argument as const Bhumika Goyal
@ 2017-10-13 17:16 ` Bhumika Goyal
  2017-10-16  8:52   ` Takashi Iwai
  2 siblings, 0 replies; 5+ messages in thread
From: Bhumika Goyal @ 2017-10-13 17:16 UTC (permalink / raw)
  To: julia.lawall, perex, tiwai, alsa-devel, linux-kernel; +Cc: Bhumika Goyal

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,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] sound: oss: make the function argument and structure const
  2017-10-13 17:16 [PATCH 0/2] sound: oss: make the function argument and structure const Bhumika Goyal
@ 2017-10-16  8:52   ` Takashi Iwai
  2017-10-13 17:16 ` [PATCH 2/2] sound: oss: make audio_driver structure const Bhumika Goyal
  2017-10-16  8:52   ` Takashi Iwai
  2 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2017-10-16  8:52 UTC (permalink / raw)
  To: Bhumika Goyal; +Cc: alsa-devel, julia.lawall, perex, linux-kernel

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
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] sound: oss: make the function argument and structure const
@ 2017-10-16  8:52   ` Takashi Iwai
  0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2017-10-16  8:52 UTC (permalink / raw)
  To: Bhumika Goyal; +Cc: alsa-devel, julia.lawall, perex, linux-kernel

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
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-16  8:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 17:16 [PATCH 0/2] sound: oss: make the function argument and structure const Bhumika Goyal
2017-10-13 17:16 ` [PATCH 1/2] sound: oss: make the function argument as const Bhumika Goyal
2017-10-13 17:16 ` [PATCH 2/2] sound: oss: make audio_driver structure const Bhumika Goyal
2017-10-16  8:52 ` [PATCH 0/2] sound: oss: make the function argument and " Takashi Iwai
2017-10-16  8:52   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.