aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2016-09-01 18:13:10 -0400
committerTakashi Iwai <tiwai@suse.de>2016-09-02 05:49:10 -0400
commit6769e988b0062bf8d63d35b0fdbb47b385dd3252 (patch)
treea45f07972e30404bb3f489a9631fbe31b8765ac8 /sound/pci/emu10k1
parent9d5262ae9b52d5dd96a4c5bd1b683570b84a011e (diff)
ALSA: constify snd_pcm_ops structures
Check for snd_pcm_ops structures that are only stored in the ops field of a snd_soc_platform_driver structure or passed as the third argument to snd_pcm_set_ops. The corresponding field or parameter is declared const, so snd_pcm_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_pcm_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_platform_driver e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i; expression e1, e2; position p; @@ snd_pcm_set_ops(e1, e2, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/emu10k1')
-rw-r--r--sound/pci/emu10k1/emu10k1x.c4
-rw-r--r--sound/pci/emu10k1/emupcm.c12
-rw-r--r--sound/pci/emu10k1/p16v.c4
3 files changed, 10 insertions, 10 deletions
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 6d1b98d14327..921037ed8468 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -548,7 +548,7 @@ snd_emu10k1x_pcm_pointer(struct snd_pcm_substream *substream)
548} 548}
549 549
550/* operators */ 550/* operators */
551static struct snd_pcm_ops snd_emu10k1x_playback_ops = { 551static const struct snd_pcm_ops snd_emu10k1x_playback_ops = {
552 .open = snd_emu10k1x_playback_open, 552 .open = snd_emu10k1x_playback_open,
553 .close = snd_emu10k1x_playback_close, 553 .close = snd_emu10k1x_playback_close,
554 .ioctl = snd_pcm_lib_ioctl, 554 .ioctl = snd_pcm_lib_ioctl,
@@ -694,7 +694,7 @@ snd_emu10k1x_pcm_pointer_capture(struct snd_pcm_substream *substream)
694 return ptr; 694 return ptr;
695} 695}
696 696
697static struct snd_pcm_ops snd_emu10k1x_capture_ops = { 697static const struct snd_pcm_ops snd_emu10k1x_capture_ops = {
698 .open = snd_emu10k1x_pcm_open_capture, 698 .open = snd_emu10k1x_pcm_open_capture,
699 .close = snd_emu10k1x_pcm_close_capture, 699 .close = snd_emu10k1x_pcm_close_capture,
700 .ioctl = snd_pcm_lib_ioctl, 700 .ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 14a305bd8a98..37be1e14d756 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1364,7 +1364,7 @@ static int snd_emu10k1_capture_efx_close(struct snd_pcm_substream *substream)
1364 return 0; 1364 return 0;
1365} 1365}
1366 1366
1367static struct snd_pcm_ops snd_emu10k1_playback_ops = { 1367static const struct snd_pcm_ops snd_emu10k1_playback_ops = {
1368 .open = snd_emu10k1_playback_open, 1368 .open = snd_emu10k1_playback_open,
1369 .close = snd_emu10k1_playback_close, 1369 .close = snd_emu10k1_playback_close,
1370 .ioctl = snd_pcm_lib_ioctl, 1370 .ioctl = snd_pcm_lib_ioctl,
@@ -1376,7 +1376,7 @@ static struct snd_pcm_ops snd_emu10k1_playback_ops = {
1376 .page = snd_pcm_sgbuf_ops_page, 1376 .page = snd_pcm_sgbuf_ops_page,
1377}; 1377};
1378 1378
1379static struct snd_pcm_ops snd_emu10k1_capture_ops = { 1379static const struct snd_pcm_ops snd_emu10k1_capture_ops = {
1380 .open = snd_emu10k1_capture_open, 1380 .open = snd_emu10k1_capture_open,
1381 .close = snd_emu10k1_capture_close, 1381 .close = snd_emu10k1_capture_close,
1382 .ioctl = snd_pcm_lib_ioctl, 1382 .ioctl = snd_pcm_lib_ioctl,
@@ -1388,7 +1388,7 @@ static struct snd_pcm_ops snd_emu10k1_capture_ops = {
1388}; 1388};
1389 1389
1390/* EFX playback */ 1390/* EFX playback */
1391static struct snd_pcm_ops snd_emu10k1_efx_playback_ops = { 1391static const struct snd_pcm_ops snd_emu10k1_efx_playback_ops = {
1392 .open = snd_emu10k1_efx_playback_open, 1392 .open = snd_emu10k1_efx_playback_open,
1393 .close = snd_emu10k1_efx_playback_close, 1393 .close = snd_emu10k1_efx_playback_close,
1394 .ioctl = snd_pcm_lib_ioctl, 1394 .ioctl = snd_pcm_lib_ioctl,
@@ -1455,7 +1455,7 @@ int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device)
1455} 1455}
1456 1456
1457 1457
1458static struct snd_pcm_ops snd_emu10k1_capture_mic_ops = { 1458static const struct snd_pcm_ops snd_emu10k1_capture_mic_ops = {
1459 .open = snd_emu10k1_capture_mic_open, 1459 .open = snd_emu10k1_capture_mic_open,
1460 .close = snd_emu10k1_capture_mic_close, 1460 .close = snd_emu10k1_capture_mic_close,
1461 .ioctl = snd_pcm_lib_ioctl, 1461 .ioctl = snd_pcm_lib_ioctl,
@@ -1550,7 +1550,7 @@ static struct snd_kcontrol_new snd_emu10k1_pcm_efx_voices_mask = {
1550 .put = snd_emu10k1_pcm_efx_voices_mask_put 1550 .put = snd_emu10k1_pcm_efx_voices_mask_put
1551}; 1551};
1552 1552
1553static struct snd_pcm_ops snd_emu10k1_capture_efx_ops = { 1553static const struct snd_pcm_ops snd_emu10k1_capture_efx_ops = {
1554 .open = snd_emu10k1_capture_efx_open, 1554 .open = snd_emu10k1_capture_efx_open,
1555 .close = snd_emu10k1_capture_efx_close, 1555 .close = snd_emu10k1_capture_efx_close,
1556 .ioctl = snd_pcm_lib_ioctl, 1556 .ioctl = snd_pcm_lib_ioctl,
@@ -1791,7 +1791,7 @@ static int snd_emu10k1_fx8010_playback_close(struct snd_pcm_substream *substream
1791 return 0; 1791 return 0;
1792} 1792}
1793 1793
1794static struct snd_pcm_ops snd_emu10k1_fx8010_playback_ops = { 1794static const struct snd_pcm_ops snd_emu10k1_fx8010_playback_ops = {
1795 .open = snd_emu10k1_fx8010_playback_open, 1795 .open = snd_emu10k1_fx8010_playback_open,
1796 .close = snd_emu10k1_fx8010_playback_close, 1796 .close = snd_emu10k1_fx8010_playback_close,
1797 .ioctl = snd_pcm_lib_ioctl, 1797 .ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 3c60b433de9f..fd9ab44174c2 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -601,7 +601,7 @@ snd_p16v_pcm_pointer_capture(struct snd_pcm_substream *substream)
601} 601}
602 602
603/* operators */ 603/* operators */
604static struct snd_pcm_ops snd_p16v_playback_front_ops = { 604static const struct snd_pcm_ops snd_p16v_playback_front_ops = {
605 .open = snd_p16v_pcm_open_playback_front, 605 .open = snd_p16v_pcm_open_playback_front,
606 .close = snd_p16v_pcm_close_playback, 606 .close = snd_p16v_pcm_close_playback,
607 .ioctl = snd_pcm_lib_ioctl, 607 .ioctl = snd_pcm_lib_ioctl,
@@ -612,7 +612,7 @@ static struct snd_pcm_ops snd_p16v_playback_front_ops = {
612 .pointer = snd_p16v_pcm_pointer_playback, 612 .pointer = snd_p16v_pcm_pointer_playback,
613}; 613};
614 614
615static struct snd_pcm_ops snd_p16v_capture_ops = { 615static const struct snd_pcm_ops snd_p16v_capture_ops = {
616 .open = snd_p16v_pcm_open_capture, 616 .open = snd_p16v_pcm_open_capture,
617 .close = snd_p16v_pcm_close_capture, 617 .close = snd_p16v_pcm_close_capture,
618 .ioctl = snd_pcm_lib_ioctl, 618 .ioctl = snd_pcm_lib_ioctl,