diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-16 10:29:08 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 04:24:50 -0500 |
commit | 1a60d4c5a0c4028559585a74e48593b16e1ca9b2 (patch) | |
tree | f03f8dfcd554f8ebbb295522dc46dfe4d110a484 /sound/core/pcm.c | |
parent | f0283f45a04d5cf31512e5e390a38504d97e7a97 (diff) |
[ALSA] semaphore -> mutex (core part)
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm.c')
-rw-r--r-- | sound/core/pcm.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index d92c3ce4a4c9..f903d1bd74d5 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/time.h> | 25 | #include <linux/time.h> |
26 | #include <linux/mutex.h> | ||
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | #include <sound/minors.h> | 28 | #include <sound/minors.h> |
28 | #include <sound/pcm.h> | 29 | #include <sound/pcm.h> |
@@ -35,7 +36,7 @@ MODULE_LICENSE("GPL"); | |||
35 | 36 | ||
36 | static LIST_HEAD(snd_pcm_devices); | 37 | static LIST_HEAD(snd_pcm_devices); |
37 | static LIST_HEAD(snd_pcm_notify_list); | 38 | static LIST_HEAD(snd_pcm_notify_list); |
38 | static DECLARE_MUTEX(register_mutex); | 39 | static DEFINE_MUTEX(register_mutex); |
39 | 40 | ||
40 | static int snd_pcm_free(struct snd_pcm *pcm); | 41 | static int snd_pcm_free(struct snd_pcm *pcm); |
41 | static int snd_pcm_dev_free(struct snd_device *device); | 42 | static int snd_pcm_dev_free(struct snd_device *device); |
@@ -67,7 +68,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card, | |||
67 | 68 | ||
68 | if (get_user(device, (int __user *)arg)) | 69 | if (get_user(device, (int __user *)arg)) |
69 | return -EFAULT; | 70 | return -EFAULT; |
70 | down(®ister_mutex); | 71 | mutex_lock(®ister_mutex); |
71 | device = device < 0 ? 0 : device + 1; | 72 | device = device < 0 ? 0 : device + 1; |
72 | while (device < SNDRV_PCM_DEVICES) { | 73 | while (device < SNDRV_PCM_DEVICES) { |
73 | if (snd_pcm_search(card, device)) | 74 | if (snd_pcm_search(card, device)) |
@@ -76,7 +77,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card, | |||
76 | } | 77 | } |
77 | if (device == SNDRV_PCM_DEVICES) | 78 | if (device == SNDRV_PCM_DEVICES) |
78 | device = -1; | 79 | device = -1; |
79 | up(®ister_mutex); | 80 | mutex_unlock(®ister_mutex); |
80 | if (put_user(device, (int __user *)arg)) | 81 | if (put_user(device, (int __user *)arg)) |
81 | return -EFAULT; | 82 | return -EFAULT; |
82 | return 0; | 83 | return 0; |
@@ -100,7 +101,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card, | |||
100 | return -EINVAL; | 101 | return -EINVAL; |
101 | if (get_user(subdevice, &info->subdevice)) | 102 | if (get_user(subdevice, &info->subdevice)) |
102 | return -EFAULT; | 103 | return -EFAULT; |
103 | down(®ister_mutex); | 104 | mutex_lock(®ister_mutex); |
104 | pcm = snd_pcm_search(card, device); | 105 | pcm = snd_pcm_search(card, device); |
105 | if (pcm == NULL) { | 106 | if (pcm == NULL) { |
106 | err = -ENXIO; | 107 | err = -ENXIO; |
@@ -125,7 +126,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card, | |||
125 | } | 126 | } |
126 | err = snd_pcm_info_user(substream, info); | 127 | err = snd_pcm_info_user(substream, info); |
127 | _error: | 128 | _error: |
128 | up(®ister_mutex); | 129 | mutex_unlock(®ister_mutex); |
129 | return err; | 130 | return err; |
130 | } | 131 | } |
131 | case SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE: | 132 | case SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE: |
@@ -262,6 +263,7 @@ static const char *snd_pcm_state_name(snd_pcm_state_t state) | |||
262 | 263 | ||
263 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 264 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) |
264 | #include <linux/soundcard.h> | 265 | #include <linux/soundcard.h> |
266 | |||
265 | static const char *snd_pcm_oss_format_name(int format) | 267 | static const char *snd_pcm_oss_format_name(int format) |
266 | { | 268 | { |
267 | switch (format) { | 269 | switch (format) { |
@@ -624,7 +626,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
624 | struct snd_pcm_substream *substream, *prev; | 626 | struct snd_pcm_substream *substream, *prev; |
625 | 627 | ||
626 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 628 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) |
627 | init_MUTEX(&pstr->oss.setup_mutex); | 629 | mutex_init(&pstr->oss.setup_mutex); |
628 | #endif | 630 | #endif |
629 | pstr->stream = stream; | 631 | pstr->stream = stream; |
630 | pstr->pcm = pcm; | 632 | pstr->pcm = pcm; |
@@ -718,7 +720,7 @@ int snd_pcm_new(struct snd_card *card, char *id, int device, | |||
718 | snd_pcm_free(pcm); | 720 | snd_pcm_free(pcm); |
719 | return err; | 721 | return err; |
720 | } | 722 | } |
721 | init_MUTEX(&pcm->open_mutex); | 723 | mutex_init(&pcm->open_mutex); |
722 | init_waitqueue_head(&pcm->open_wait); | 724 | init_waitqueue_head(&pcm->open_wait); |
723 | if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) { | 725 | if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) { |
724 | snd_pcm_free(pcm); | 726 | snd_pcm_free(pcm); |
@@ -904,9 +906,9 @@ static int snd_pcm_dev_register(struct snd_device *device) | |||
904 | struct snd_pcm *pcm = device->device_data; | 906 | struct snd_pcm *pcm = device->device_data; |
905 | 907 | ||
906 | snd_assert(pcm != NULL && device != NULL, return -ENXIO); | 908 | snd_assert(pcm != NULL && device != NULL, return -ENXIO); |
907 | down(®ister_mutex); | 909 | mutex_lock(®ister_mutex); |
908 | if (snd_pcm_search(pcm->card, pcm->device)) { | 910 | if (snd_pcm_search(pcm->card, pcm->device)) { |
909 | up(®ister_mutex); | 911 | mutex_unlock(®ister_mutex); |
910 | return -EBUSY; | 912 | return -EBUSY; |
911 | } | 913 | } |
912 | list_add_tail(&pcm->list, &snd_pcm_devices); | 914 | list_add_tail(&pcm->list, &snd_pcm_devices); |
@@ -930,7 +932,7 @@ static int snd_pcm_dev_register(struct snd_device *device) | |||
930 | pcm, str)) < 0) | 932 | pcm, str)) < 0) |
931 | { | 933 | { |
932 | list_del(&pcm->list); | 934 | list_del(&pcm->list); |
933 | up(®ister_mutex); | 935 | mutex_unlock(®ister_mutex); |
934 | return err; | 936 | return err; |
935 | } | 937 | } |
936 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) | 938 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) |
@@ -941,7 +943,7 @@ static int snd_pcm_dev_register(struct snd_device *device) | |||
941 | notify = list_entry(list, struct snd_pcm_notify, list); | 943 | notify = list_entry(list, struct snd_pcm_notify, list); |
942 | notify->n_register(pcm); | 944 | notify->n_register(pcm); |
943 | } | 945 | } |
944 | up(®ister_mutex); | 946 | mutex_unlock(®ister_mutex); |
945 | return 0; | 947 | return 0; |
946 | } | 948 | } |
947 | 949 | ||
@@ -952,7 +954,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) | |||
952 | struct snd_pcm_substream *substream; | 954 | struct snd_pcm_substream *substream; |
953 | int cidx; | 955 | int cidx; |
954 | 956 | ||
955 | down(®ister_mutex); | 957 | mutex_lock(®ister_mutex); |
956 | list_del_init(&pcm->list); | 958 | list_del_init(&pcm->list); |
957 | for (cidx = 0; cidx < 2; cidx++) | 959 | for (cidx = 0; cidx < 2; cidx++) |
958 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) | 960 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) |
@@ -963,7 +965,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) | |||
963 | notify = list_entry(list, struct snd_pcm_notify, list); | 965 | notify = list_entry(list, struct snd_pcm_notify, list); |
964 | notify->n_disconnect(pcm); | 966 | notify->n_disconnect(pcm); |
965 | } | 967 | } |
966 | up(®ister_mutex); | 968 | mutex_unlock(®ister_mutex); |
967 | return 0; | 969 | return 0; |
968 | } | 970 | } |
969 | 971 | ||
@@ -975,7 +977,7 @@ static int snd_pcm_dev_unregister(struct snd_device *device) | |||
975 | struct snd_pcm *pcm = device->device_data; | 977 | struct snd_pcm *pcm = device->device_data; |
976 | 978 | ||
977 | snd_assert(pcm != NULL, return -ENXIO); | 979 | snd_assert(pcm != NULL, return -ENXIO); |
978 | down(®ister_mutex); | 980 | mutex_lock(®ister_mutex); |
979 | list_del(&pcm->list); | 981 | list_del(&pcm->list); |
980 | for (cidx = 0; cidx < 2; cidx++) { | 982 | for (cidx = 0; cidx < 2; cidx++) { |
981 | devtype = -1; | 983 | devtype = -1; |
@@ -996,7 +998,7 @@ static int snd_pcm_dev_unregister(struct snd_device *device) | |||
996 | notify = list_entry(list, struct snd_pcm_notify, list); | 998 | notify = list_entry(list, struct snd_pcm_notify, list); |
997 | notify->n_unregister(pcm); | 999 | notify->n_unregister(pcm); |
998 | } | 1000 | } |
999 | up(®ister_mutex); | 1001 | mutex_unlock(®ister_mutex); |
1000 | return snd_pcm_free(pcm); | 1002 | return snd_pcm_free(pcm); |
1001 | } | 1003 | } |
1002 | 1004 | ||
@@ -1005,7 +1007,7 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree) | |||
1005 | struct list_head *p; | 1007 | struct list_head *p; |
1006 | 1008 | ||
1007 | snd_assert(notify != NULL && notify->n_register != NULL && notify->n_unregister != NULL, return -EINVAL); | 1009 | snd_assert(notify != NULL && notify->n_register != NULL && notify->n_unregister != NULL, return -EINVAL); |
1008 | down(®ister_mutex); | 1010 | mutex_lock(®ister_mutex); |
1009 | if (nfree) { | 1011 | if (nfree) { |
1010 | list_del(¬ify->list); | 1012 | list_del(¬ify->list); |
1011 | list_for_each(p, &snd_pcm_devices) | 1013 | list_for_each(p, &snd_pcm_devices) |
@@ -1016,7 +1018,7 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree) | |||
1016 | list_for_each(p, &snd_pcm_devices) | 1018 | list_for_each(p, &snd_pcm_devices) |
1017 | notify->n_register(list_entry(p, struct snd_pcm, list)); | 1019 | notify->n_register(list_entry(p, struct snd_pcm, list)); |
1018 | } | 1020 | } |
1019 | up(®ister_mutex); | 1021 | mutex_unlock(®ister_mutex); |
1020 | return 0; | 1022 | return 0; |
1021 | } | 1023 | } |
1022 | 1024 | ||
@@ -1031,7 +1033,7 @@ static void snd_pcm_proc_read(struct snd_info_entry *entry, | |||
1031 | struct list_head *p; | 1033 | struct list_head *p; |
1032 | struct snd_pcm *pcm; | 1034 | struct snd_pcm *pcm; |
1033 | 1035 | ||
1034 | down(®ister_mutex); | 1036 | mutex_lock(®ister_mutex); |
1035 | list_for_each(p, &snd_pcm_devices) { | 1037 | list_for_each(p, &snd_pcm_devices) { |
1036 | pcm = list_entry(p, struct snd_pcm, list); | 1038 | pcm = list_entry(p, struct snd_pcm, list); |
1037 | snd_iprintf(buffer, "%02i-%02i: %s : %s", | 1039 | snd_iprintf(buffer, "%02i-%02i: %s : %s", |
@@ -1044,7 +1046,7 @@ static void snd_pcm_proc_read(struct snd_info_entry *entry, | |||
1044 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count); | 1046 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count); |
1045 | snd_iprintf(buffer, "\n"); | 1047 | snd_iprintf(buffer, "\n"); |
1046 | } | 1048 | } |
1047 | up(®ister_mutex); | 1049 | mutex_unlock(®ister_mutex); |
1048 | } | 1050 | } |
1049 | 1051 | ||
1050 | static struct snd_info_entry *snd_pcm_proc_entry = NULL; | 1052 | static struct snd_info_entry *snd_pcm_proc_entry = NULL; |