X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Foss%2Fac97_codec.c;h=fd25aca251200dd63c469b464945849192d4d2e4;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=972327c97644f29bd37c09d0de4639ea3f9fb56f;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c index 972327c97..fd25aca25 100644 --- a/sound/oss/ac97_codec.c +++ b/sound/oss/ac97_codec.c @@ -55,7 +55,7 @@ #include #include #include -#include +#include #define CODEC_ID_BUFSZ 14 @@ -304,7 +304,7 @@ static const unsigned int ac97_oss_rm[] = { static LIST_HEAD(codecs); static LIST_HEAD(codec_drivers); -static DEFINE_MUTEX(codec_mutex); +static DECLARE_MUTEX(codec_sem); /* reads the given OSS mixer from the ac97 the caller must have insured that the ac97 knows about that given mixer, and should be holding a spinlock for the card */ @@ -769,9 +769,9 @@ void ac97_release_codec(struct ac97_codec *codec) { /* Remove from the list first, we don't want to be "rediscovered" */ - mutex_lock(&codec_mutex); + down(&codec_sem); list_del(&codec->list); - mutex_unlock(&codec_mutex); + up(&codec_sem); /* * The driver needs to deal with internal * locking to avoid accidents here. @@ -889,7 +889,7 @@ int ac97_probe_codec(struct ac97_codec *codec) * callbacks. */ - mutex_lock(&codec_mutex); + down(&codec_sem); list_add(&codec->list, &codecs); list_for_each(l, &codec_drivers) { @@ -903,7 +903,7 @@ int ac97_probe_codec(struct ac97_codec *codec) } } - mutex_unlock(&codec_mutex); + up(&codec_sem); return 1; } @@ -1439,7 +1439,7 @@ int ac97_register_driver(struct ac97_driver *driver) struct list_head *l; struct ac97_codec *c; - mutex_lock(&codec_mutex); + down(&codec_sem); INIT_LIST_HEAD(&driver->list); list_add(&driver->list, &codec_drivers); @@ -1452,7 +1452,7 @@ int ac97_register_driver(struct ac97_driver *driver) continue; c->driver = driver; } - mutex_unlock(&codec_mutex); + up(&codec_sem); return 0; } @@ -1471,7 +1471,7 @@ void ac97_unregister_driver(struct ac97_driver *driver) struct list_head *l; struct ac97_codec *c; - mutex_lock(&codec_mutex); + down(&codec_sem); list_del_init(&driver->list); list_for_each(l, &codecs) @@ -1483,7 +1483,7 @@ void ac97_unregister_driver(struct ac97_driver *driver) } } - mutex_unlock(&codec_mutex); + up(&codec_sem); } EXPORT_SYMBOL_GPL(ac97_unregister_driver); @@ -1494,14 +1494,14 @@ static int swap_headphone(int remove_master) struct ac97_codec *c; if (remove_master) { - mutex_lock(&codec_mutex); + down(&codec_sem); list_for_each(l, &codecs) { c = list_entry(l, struct ac97_codec, list); if (supported_mixer(c, SOUND_MIXER_PHONEOUT)) c->supported_mixers &= ~SOUND_MASK_PHONEOUT; } - mutex_unlock(&codec_mutex); + up(&codec_sem); } else ac97_hw[SOUND_MIXER_PHONEOUT].offset = AC97_MASTER_VOL_STEREO;