Skip to contentSkip to conversation

ALSA: line6: make snd_pcm_ops const

PATCH Applied Bhumika Goyal 3 participants 3 messages Sep 27, 2017 – Oct 2, 2017 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: line6: make snd_pcm_ops const

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.

---
 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(-)
sound/usb/line6/capture.c +1 -1
index 7c81256..947d616 100644
@@ -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,
sound/usb/line6/capture.h +1 -1
index 890b21b..b67ccc3 100644
@@ -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);
sound/usb/line6/playback.c +1 -1
index 812d181..819e9b2 100644
@@ -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,
sound/usb/line6/playback.h +1 -1
index 51fce29..d8d3b8a 100644
@@ -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);
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Bhumika Goyal

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.

Quoted 7 lines
---
  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.

Quoted 44 lines
sound/usb/line6/capture.c +1 -1
index 7c81256..947d616 100644
@@ -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,
sound/usb/line6/capture.h +1 -1
index 890b21b..b67ccc3 100644
@@ -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);
sound/usb/line6/playback.c +1 -1
index 812d181..819e9b2 100644
@@ -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,
sound/usb/line6/playback.h +0 -0
index 51fce29..d8d3b8a 100644

sound/usb/line6/playback.h line 33

Quoted 8 lines
sound/usb/line6/playback.h +1 -1
@@ -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

Applied
#2 lore raw
In reply to Bhumika Goyal
Quoted 8 lines · Bhumika Goyal

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.

Applied, thanks.

Takashi