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


Groups > linux.kernel > #1740413 > unrolled thread

[PATCH] ALSA: line6: make snd_pcm_ops const

Started byBhumika Goyal <bhumirks@gmail.com>
First post2017-09-27 08:20 +0200
Last post2017-10-02 14:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ALSA: line6: make snd_pcm_ops  const Bhumika Goyal <bhumirks@gmail.com> - 2017-09-27 08:20 +0200
    Re: [PATCH] ALSA: line6: make snd_pcm_ops const Takashi Sakamoto <o-takashi@sakamocchi.jp> - 2017-09-27 08:30 +0200
    Re: [PATCH] ALSA: line6: make snd_pcm_ops  const Takashi Iwai <tiwai@suse.de> - 2017-10-02 14:40 +0200

#1740413 — [PATCH] ALSA: line6: make snd_pcm_ops const

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-09-27 08:20 +0200
Subject[PATCH] ALSA: line6: make snd_pcm_ops const
Message-ID<uudRn-6ZU-11@gated-at.bofh.it>
Make these const as they are only passed to a const argument of the
function snd_pcm_set_ops in the file referencing them. Also, add const
to the declaration in the headers.

Structures found using Coccinelle and changes done by hand.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 sound/usb/line6/capture.c  | 2 +-
 sound/usb/line6/capture.h  | 2 +-
 sound/usb/line6/playback.c | 2 +-
 sound/usb/line6/playback.h | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c
index 7c81256..947d616 100644
--- a/sound/usb/line6/capture.c
+++ b/sound/usb/line6/capture.c
@@ -248,7 +248,7 @@ static int snd_line6_capture_close(struct snd_pcm_substream *substream)
 }
 
 /* capture operators */
-struct snd_pcm_ops snd_line6_capture_ops = {
+const struct snd_pcm_ops snd_line6_capture_ops = {
 	.open = snd_line6_capture_open,
 	.close = snd_line6_capture_close,
 	.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/line6/capture.h b/sound/usb/line6/capture.h
index 890b21b..b67ccc3 100644
--- a/sound/usb/line6/capture.h
+++ b/sound/usb/line6/capture.h
@@ -17,7 +17,7 @@
 #include "driver.h"
 #include "pcm.h"
 
-extern struct snd_pcm_ops snd_line6_capture_ops;
+extern const struct snd_pcm_ops snd_line6_capture_ops;
 
 extern void line6_capture_copy(struct snd_line6_pcm *line6pcm, char *fbuf,
 			       int fsize);
diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c
index 812d181..819e9b2 100644
--- a/sound/usb/line6/playback.c
+++ b/sound/usb/line6/playback.c
@@ -393,7 +393,7 @@ static int snd_line6_playback_close(struct snd_pcm_substream *substream)
 }
 
 /* playback operators */
-struct snd_pcm_ops snd_line6_playback_ops = {
+const struct snd_pcm_ops snd_line6_playback_ops = {
 	.open = snd_line6_playback_open,
 	.close = snd_line6_playback_close,
 	.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/line6/playback.h b/sound/usb/line6/playback.h
index 51fce29..d8d3b8a 100644
--- a/sound/usb/line6/playback.h
+++ b/sound/usb/line6/playback.h
@@ -27,7 +27,7 @@
  */
 #define USE_CLEAR_BUFFER_WORKAROUND 1
 
-extern struct snd_pcm_ops snd_line6_playback_ops;
+extern const struct snd_pcm_ops snd_line6_playback_ops;
 
 extern int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm);
 extern int line6_submit_audio_out_all_urbs(struct snd_line6_pcm *line6pcm);
-- 
1.9.1

[toc] | [next] | [standalone]


#1740418 — Re: [PATCH] ALSA: line6: make snd_pcm_ops const

FromTakashi Sakamoto <o-takashi@sakamocchi.jp>
Date2017-09-27 08:30 +0200
SubjectRe: [PATCH] ALSA: line6: make snd_pcm_ops const
Message-ID<uue14-75a-27@gated-at.bofh.it>
In reply to#1740413
On Sep 27 2017 15:19, Bhumika Goyal wrote:
> Make these const as they are only passed to a const argument of the
> function snd_pcm_set_ops in the file referencing them. Also, add const
> to the declaration in the headers.
> 
> Structures found using Coccinelle and changes done by hand.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>   sound/usb/line6/capture.c  | 2 +-
>   sound/usb/line6/capture.h  | 2 +-
>   sound/usb/line6/playback.c | 2 +-
>   sound/usb/line6/playback.h | 2 +-
>   4 files changed, 4 insertions(+), 4 deletions(-)

This looks good to me.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

> diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c
> index 7c81256..947d616 100644
> --- a/sound/usb/line6/capture.c
> +++ b/sound/usb/line6/capture.c
> @@ -248,7 +248,7 @@ static int snd_line6_capture_close(struct snd_pcm_substream *substream)
>   }
>   
>   /* capture operators */
> -struct snd_pcm_ops snd_line6_capture_ops = {
> +const struct snd_pcm_ops snd_line6_capture_ops = {
>   	.open = snd_line6_capture_open,
>   	.close = snd_line6_capture_close,
>   	.ioctl = snd_pcm_lib_ioctl,
> diff --git a/sound/usb/line6/capture.h b/sound/usb/line6/capture.h
> index 890b21b..b67ccc3 100644
> --- a/sound/usb/line6/capture.h
> +++ b/sound/usb/line6/capture.h
> @@ -17,7 +17,7 @@
>   #include "driver.h"
>   #include "pcm.h"
>   
> -extern struct snd_pcm_ops snd_line6_capture_ops;
> +extern const struct snd_pcm_ops snd_line6_capture_ops;
>   
>   extern void line6_capture_copy(struct snd_line6_pcm *line6pcm, char *fbuf,
>   			       int fsize);
> diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c
> index 812d181..819e9b2 100644
> --- a/sound/usb/line6/playback.c
> +++ b/sound/usb/line6/playback.c
> @@ -393,7 +393,7 @@ static int snd_line6_playback_close(struct snd_pcm_substream *substream)
>   }
>   
>   /* playback operators */
> -struct snd_pcm_ops snd_line6_playback_ops = {
> +const struct snd_pcm_ops snd_line6_playback_ops = {
>   	.open = snd_line6_playback_open,
>   	.close = snd_line6_playback_close,
>   	.ioctl = snd_pcm_lib_ioctl,
> diff --git a/sound/usb/line6/playback.h b/sound/usb/line6/playback.h
> index 51fce29..d8d3b8a 100644
> --- a/sound/usb/line6/playback.h
> +++ b/sound/usb/line6/playback.h
> @@ -27,7 +27,7 @@
>    */
>   #define USE_CLEAR_BUFFER_WORKAROUND 1
>   
> -extern struct snd_pcm_ops snd_line6_playback_ops;
> +extern const struct snd_pcm_ops snd_line6_playback_ops;
>   
>   extern int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm);
>   extern int line6_submit_audio_out_all_urbs(struct snd_line6_pcm *line6pcm);

Thanks

Takashi Sakamoto

[toc] | [prev] | [next] | [standalone]


#1743186

FromTakashi Iwai <tiwai@suse.de>
Date2017-10-02 14:40 +0200
Message-ID<uw8aS-7hy-27@gated-at.bofh.it>
In reply to#1740413
On Wed, 27 Sep 2017 08:19:27 +0200,
Bhumika Goyal wrote:
> 
> Make these const as they are only passed to a const argument of the
> function snd_pcm_set_ops in the file referencing them. Also, add const
> to the declaration in the headers.
> 
> Structures found using Coccinelle and changes done by hand.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

Applied, thanks.


Takashi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web