Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1274817 > unrolled thread

[PATCH] [ALSA] midi: constify snd_rawmidi_global_ops structures

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2015-11-22 09:10 +0100
Last post2015-11-22 09:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] [ALSA] midi: constify snd_rawmidi_global_ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2015-11-22 09:10 +0100
    Re: [PATCH] [ALSA] midi: constify snd_rawmidi_global_ops structures Takashi Iwai <tiwai@suse.de> - 2015-11-22 09:30 +0100

#1274817 — [PATCH] [ALSA] midi: constify snd_rawmidi_global_ops structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2015-11-22 09:10 +0100
Subject[PATCH] [ALSA] midi: constify snd_rawmidi_global_ops structures
Message-ID<qxxSF-10E-3@gated-at.bofh.it>
The snd_rawmidi_global_ops structures are never modified, so declare them
as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 include/sound/rawmidi.h      |    2 +-
 sound/core/seq/seq_virmidi.c |    2 +-
 sound/usb/midi.c             |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index f6cbef7..fdabbb4 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -130,7 +130,7 @@ struct snd_rawmidi {
 	int ossreg;
 #endif
 
-	struct snd_rawmidi_global_ops *ops;
+	const struct snd_rawmidi_global_ops *ops;
 
 	struct snd_rawmidi_str streams[2];
 
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index 56e0f4cd..3da2d48 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -468,7 +468,7 @@ static int snd_virmidi_dev_unregister(struct snd_rawmidi *rmidi)
 /*
  *
  */
-static struct snd_rawmidi_global_ops snd_virmidi_global_ops = {
+static const struct snd_rawmidi_global_ops snd_virmidi_global_ops = {
 	.dev_register = snd_virmidi_dev_register,
 	.dev_unregister = snd_virmidi_dev_unregister,
 };
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 5b4c58c..ee212e7 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -2206,7 +2206,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi *umidi,
 	return 0;
 }
 
-static struct snd_rawmidi_global_ops snd_usbmidi_ops = {
+static const struct snd_rawmidi_global_ops snd_usbmidi_ops = {
 	.get_port_info = snd_usbmidi_get_port_info,
 };
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1274818

FromTakashi Iwai <tiwai@suse.de>
Date2015-11-22 09:30 +0100
Message-ID<qxyc2-191-3@gated-at.bofh.it>
In reply to#1274817
On Sun, 22 Nov 2015 08:55:07 +0100,
Julia Lawall wrote:
> 
> The snd_rawmidi_global_ops structures are never modified, so declare them
> as const.
> 
> Done with the help of Coccinelle.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied, thanks.


Takashi

> 
> ---
>  include/sound/rawmidi.h      |    2 +-
>  sound/core/seq/seq_virmidi.c |    2 +-
>  sound/usb/midi.c             |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
> index f6cbef7..fdabbb4 100644
> --- a/include/sound/rawmidi.h
> +++ b/include/sound/rawmidi.h
> @@ -130,7 +130,7 @@ struct snd_rawmidi {
>  	int ossreg;
>  #endif
>  
> -	struct snd_rawmidi_global_ops *ops;
> +	const struct snd_rawmidi_global_ops *ops;
>  
>  	struct snd_rawmidi_str streams[2];
>  
> diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
> index 56e0f4cd..3da2d48 100644
> --- a/sound/core/seq/seq_virmidi.c
> +++ b/sound/core/seq/seq_virmidi.c
> @@ -468,7 +468,7 @@ static int snd_virmidi_dev_unregister(struct snd_rawmidi *rmidi)
>  /*
>   *
>   */
> -static struct snd_rawmidi_global_ops snd_virmidi_global_ops = {
> +static const struct snd_rawmidi_global_ops snd_virmidi_global_ops = {
>  	.dev_register = snd_virmidi_dev_register,
>  	.dev_unregister = snd_virmidi_dev_unregister,
>  };
> diff --git a/sound/usb/midi.c b/sound/usb/midi.c
> index 5b4c58c..ee212e7 100644
> --- a/sound/usb/midi.c
> +++ b/sound/usb/midi.c
> @@ -2206,7 +2206,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi *umidi,
>  	return 0;
>  }
>  
> -static struct snd_rawmidi_global_ops snd_usbmidi_ops = {
> +static const struct snd_rawmidi_global_ops snd_usbmidi_ops = {
>  	.get_port_info = snd_usbmidi_get_port_info,
>  };
>  
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web