Skip to content

Commit 31cb1fb

Browse files
ArvindYadavCstiwai
authored andcommitted
ALSA: usb: constify snd_pcm_ops structures
snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by <sound/pcm.h> work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 7a205f5 commit 31cb1fb

7 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎sound/usb/6fire/pcm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static snd_pcm_uframes_t usb6fire_pcm_pointer(
555555
return ret;
556556
}
557557

558-
static struct snd_pcm_ops pcm_ops = {
558+
static const struct snd_pcm_ops pcm_ops = {
559559
.open = usb6fire_pcm_open,
560560
.close = usb6fire_pcm_close,
561561
.ioctl = snd_pcm_lib_ioctl,

‎sound/usb/caiaq/audio.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub)
338338
}
339339

340340
/* operators for both playback and capture */
341-
static struct snd_pcm_ops snd_usb_caiaq_ops = {
341+
static const struct snd_pcm_ops snd_usb_caiaq_ops = {
342342
.open = snd_usb_caiaq_substream_open,
343343
.close = snd_usb_caiaq_substream_close,
344344
.ioctl = snd_pcm_lib_ioctl,

‎sound/usb/hiface/pcm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static snd_pcm_uframes_t hiface_pcm_pointer(struct snd_pcm_substream *alsa_sub)
513513
return bytes_to_frames(alsa_sub->runtime, dma_offset);
514514
}
515515

516-
static struct snd_pcm_ops pcm_ops = {
516+
static const struct snd_pcm_ops pcm_ops = {
517517
.open = hiface_pcm_open,
518518
.close = hiface_pcm_close,
519519
.ioctl = snd_pcm_lib_ioctl,

‎sound/usb/misc/ua101.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ static snd_pcm_uframes_t playback_pcm_pointer(struct snd_pcm_substream *subs)
890890
return ua101_pcm_pointer(ua, &ua->playback);
891891
}
892892

893-
static struct snd_pcm_ops capture_pcm_ops = {
893+
static const struct snd_pcm_ops capture_pcm_ops = {
894894
.open = capture_pcm_open,
895895
.close = capture_pcm_close,
896896
.ioctl = snd_pcm_lib_ioctl,
@@ -903,7 +903,7 @@ static struct snd_pcm_ops capture_pcm_ops = {
903903
.mmap = snd_pcm_lib_mmap_vmalloc,
904904
};
905905

906-
static struct snd_pcm_ops playback_pcm_ops = {
906+
static const struct snd_pcm_ops playback_pcm_ops = {
907907
.open = playback_pcm_open,
908908
.close = playback_pcm_close,
909909
.ioctl = snd_pcm_lib_ioctl,

‎sound/usb/pcm.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
16901690
return -EINVAL;
16911691
}
16921692

1693-
static struct snd_pcm_ops snd_usb_playback_ops = {
1693+
static const struct snd_pcm_ops snd_usb_playback_ops = {
16941694
.open = snd_usb_playback_open,
16951695
.close = snd_usb_playback_close,
16961696
.ioctl = snd_pcm_lib_ioctl,
@@ -1703,7 +1703,7 @@ static struct snd_pcm_ops snd_usb_playback_ops = {
17031703
.mmap = snd_pcm_lib_mmap_vmalloc,
17041704
};
17051705

1706-
static struct snd_pcm_ops snd_usb_capture_ops = {
1706+
static const struct snd_pcm_ops snd_usb_capture_ops = {
17071707
.open = snd_usb_capture_open,
17081708
.close = snd_usb_capture_close,
17091709
.ioctl = snd_pcm_lib_ioctl,

‎sound/usb/usx2y/usbusx2yaudio.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ static int snd_usX2Y_pcm_close(struct snd_pcm_substream *substream)
905905
}
906906

907907

908-
static struct snd_pcm_ops snd_usX2Y_pcm_ops =
908+
static const struct snd_pcm_ops snd_usX2Y_pcm_ops =
909909
{
910910
.open = snd_usX2Y_pcm_open,
911911
.close = snd_usX2Y_pcm_close,

‎sound/usb/usx2y/usx2yhwdeppcm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ static int snd_usX2Y_usbpcm_close(struct snd_pcm_substream *substream)
587587
}
588588

589589

590-
static struct snd_pcm_ops snd_usX2Y_usbpcm_ops =
590+
static const struct snd_pcm_ops snd_usX2Y_usbpcm_ops =
591591
{
592592
.open = snd_usX2Y_usbpcm_open,
593593
.close = snd_usX2Y_usbpcm_close,

0 commit comments

Comments
 (0)