diff options
Diffstat (limited to 'sound/pci/emu10k1/emufx.c')
-rw-r--r-- | sound/pci/emu10k1/emufx.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 509837252735..dfba00230d4d 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/vmalloc.h> | 33 | #include <linux/vmalloc.h> |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/mutex.h> | ||
36 | |||
35 | #include <sound/core.h> | 37 | #include <sound/core.h> |
36 | #include <sound/emu10k1.h> | 38 | #include <sound/emu10k1.h> |
37 | 39 | ||
@@ -874,7 +876,7 @@ static int snd_emu10k1_icode_poke(struct snd_emu10k1 *emu, | |||
874 | { | 876 | { |
875 | int err = 0; | 877 | int err = 0; |
876 | 878 | ||
877 | down(&emu->fx8010.lock); | 879 | mutex_lock(&emu->fx8010.lock); |
878 | if ((err = snd_emu10k1_verify_controls(emu, icode)) < 0) | 880 | if ((err = snd_emu10k1_verify_controls(emu, icode)) < 0) |
879 | goto __error; | 881 | goto __error; |
880 | strlcpy(emu->fx8010.name, icode->name, sizeof(emu->fx8010.name)); | 882 | strlcpy(emu->fx8010.name, icode->name, sizeof(emu->fx8010.name)); |
@@ -897,7 +899,7 @@ static int snd_emu10k1_icode_poke(struct snd_emu10k1 *emu, | |||
897 | else | 899 | else |
898 | snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg); | 900 | snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg); |
899 | __error: | 901 | __error: |
900 | up(&emu->fx8010.lock); | 902 | mutex_unlock(&emu->fx8010.lock); |
901 | return err; | 903 | return err; |
902 | } | 904 | } |
903 | 905 | ||
@@ -906,7 +908,7 @@ static int snd_emu10k1_icode_peek(struct snd_emu10k1 *emu, | |||
906 | { | 908 | { |
907 | int err; | 909 | int err; |
908 | 910 | ||
909 | down(&emu->fx8010.lock); | 911 | mutex_lock(&emu->fx8010.lock); |
910 | strlcpy(icode->name, emu->fx8010.name, sizeof(icode->name)); | 912 | strlcpy(icode->name, emu->fx8010.name, sizeof(icode->name)); |
911 | /* ok, do the main job */ | 913 | /* ok, do the main job */ |
912 | err = snd_emu10k1_gpr_peek(emu, icode); | 914 | err = snd_emu10k1_gpr_peek(emu, icode); |
@@ -916,7 +918,7 @@ static int snd_emu10k1_icode_peek(struct snd_emu10k1 *emu, | |||
916 | err = snd_emu10k1_code_peek(emu, icode); | 918 | err = snd_emu10k1_code_peek(emu, icode); |
917 | if (err >= 0) | 919 | if (err >= 0) |
918 | err = snd_emu10k1_list_controls(emu, icode); | 920 | err = snd_emu10k1_list_controls(emu, icode); |
919 | up(&emu->fx8010.lock); | 921 | mutex_unlock(&emu->fx8010.lock); |
920 | return err; | 922 | return err; |
921 | } | 923 | } |
922 | 924 | ||
@@ -932,7 +934,7 @@ static int snd_emu10k1_ipcm_poke(struct snd_emu10k1 *emu, | |||
932 | if (ipcm->channels > 32) | 934 | if (ipcm->channels > 32) |
933 | return -EINVAL; | 935 | return -EINVAL; |
934 | pcm = &emu->fx8010.pcm[ipcm->substream]; | 936 | pcm = &emu->fx8010.pcm[ipcm->substream]; |
935 | down(&emu->fx8010.lock); | 937 | mutex_lock(&emu->fx8010.lock); |
936 | spin_lock_irq(&emu->reg_lock); | 938 | spin_lock_irq(&emu->reg_lock); |
937 | if (pcm->opened) { | 939 | if (pcm->opened) { |
938 | err = -EBUSY; | 940 | err = -EBUSY; |
@@ -962,7 +964,7 @@ static int snd_emu10k1_ipcm_poke(struct snd_emu10k1 *emu, | |||
962 | } | 964 | } |
963 | __error: | 965 | __error: |
964 | spin_unlock_irq(&emu->reg_lock); | 966 | spin_unlock_irq(&emu->reg_lock); |
965 | up(&emu->fx8010.lock); | 967 | mutex_unlock(&emu->fx8010.lock); |
966 | return err; | 968 | return err; |
967 | } | 969 | } |
968 | 970 | ||
@@ -976,7 +978,7 @@ static int snd_emu10k1_ipcm_peek(struct snd_emu10k1 *emu, | |||
976 | if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT) | 978 | if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT) |
977 | return -EINVAL; | 979 | return -EINVAL; |
978 | pcm = &emu->fx8010.pcm[ipcm->substream]; | 980 | pcm = &emu->fx8010.pcm[ipcm->substream]; |
979 | down(&emu->fx8010.lock); | 981 | mutex_lock(&emu->fx8010.lock); |
980 | spin_lock_irq(&emu->reg_lock); | 982 | spin_lock_irq(&emu->reg_lock); |
981 | ipcm->channels = pcm->channels; | 983 | ipcm->channels = pcm->channels; |
982 | ipcm->tram_start = pcm->tram_start; | 984 | ipcm->tram_start = pcm->tram_start; |
@@ -992,7 +994,7 @@ static int snd_emu10k1_ipcm_peek(struct snd_emu10k1 *emu, | |||
992 | ipcm->res1 = ipcm->res2 = 0; | 994 | ipcm->res1 = ipcm->res2 = 0; |
993 | ipcm->pad = 0; | 995 | ipcm->pad = 0; |
994 | spin_unlock_irq(&emu->reg_lock); | 996 | spin_unlock_irq(&emu->reg_lock); |
995 | up(&emu->fx8010.lock); | 997 | mutex_unlock(&emu->fx8010.lock); |
996 | return err; | 998 | return err; |
997 | } | 999 | } |
998 | 1000 | ||
@@ -2308,9 +2310,9 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un | |||
2308 | return -EPERM; | 2310 | return -EPERM; |
2309 | if (get_user(addr, (unsigned int __user *)argp)) | 2311 | if (get_user(addr, (unsigned int __user *)argp)) |
2310 | return -EFAULT; | 2312 | return -EFAULT; |
2311 | down(&emu->fx8010.lock); | 2313 | mutex_lock(&emu->fx8010.lock); |
2312 | res = snd_emu10k1_fx8010_tram_setup(emu, addr); | 2314 | res = snd_emu10k1_fx8010_tram_setup(emu, addr); |
2313 | up(&emu->fx8010.lock); | 2315 | mutex_unlock(&emu->fx8010.lock); |
2314 | return res; | 2316 | return res; |
2315 | case SNDRV_EMU10K1_IOCTL_STOP: | 2317 | case SNDRV_EMU10K1_IOCTL_STOP: |
2316 | if (!capable(CAP_SYS_ADMIN)) | 2318 | if (!capable(CAP_SYS_ADMIN)) |