aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/ac97_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/oss/ac97_codec.c')
-rw-r--r--sound/oss/ac97_codec.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c
index fd25aca25120..972327c97644 100644
--- a/sound/oss/ac97_codec.c
+++ b/sound/oss/ac97_codec.c
@@ -55,7 +55,7 @@
55#include <linux/pci.h> 55#include <linux/pci.h>
56#include <linux/ac97_codec.h> 56#include <linux/ac97_codec.h>
57#include <asm/uaccess.h> 57#include <asm/uaccess.h>
58#include <asm/semaphore.h> 58#include <linux/mutex.h>
59 59
60#define CODEC_ID_BUFSZ 14 60#define CODEC_ID_BUFSZ 14
61 61
@@ -304,7 +304,7 @@ static const unsigned int ac97_oss_rm[] = {
304 304
305static LIST_HEAD(codecs); 305static LIST_HEAD(codecs);
306static LIST_HEAD(codec_drivers); 306static LIST_HEAD(codec_drivers);
307static DECLARE_MUTEX(codec_sem); 307static DEFINE_MUTEX(codec_mutex);
308 308
309/* reads the given OSS mixer from the ac97 the caller must have insured that the ac97 knows 309/* reads the given OSS mixer from the ac97 the caller must have insured that the ac97 knows
310 about that given mixer, and should be holding a spinlock for the card */ 310 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)
769{ 769{
770 /* Remove from the list first, we don't want to be 770 /* Remove from the list first, we don't want to be
771 "rediscovered" */ 771 "rediscovered" */
772 down(&codec_sem); 772 mutex_lock(&codec_mutex);
773 list_del(&codec->list); 773 list_del(&codec->list);
774 up(&codec_sem); 774 mutex_unlock(&codec_mutex);
775 /* 775 /*
776 * The driver needs to deal with internal 776 * The driver needs to deal with internal
777 * locking to avoid accidents here. 777 * locking to avoid accidents here.
@@ -889,7 +889,7 @@ int ac97_probe_codec(struct ac97_codec *codec)
889 * callbacks. 889 * callbacks.
890 */ 890 */
891 891
892 down(&codec_sem); 892 mutex_lock(&codec_mutex);
893 list_add(&codec->list, &codecs); 893 list_add(&codec->list, &codecs);
894 894
895 list_for_each(l, &codec_drivers) { 895 list_for_each(l, &codec_drivers) {
@@ -903,7 +903,7 @@ int ac97_probe_codec(struct ac97_codec *codec)
903 } 903 }
904 } 904 }
905 905
906 up(&codec_sem); 906 mutex_unlock(&codec_mutex);
907 return 1; 907 return 1;
908} 908}
909 909
@@ -1439,7 +1439,7 @@ int ac97_register_driver(struct ac97_driver *driver)
1439 struct list_head *l; 1439 struct list_head *l;
1440 struct ac97_codec *c; 1440 struct ac97_codec *c;
1441 1441
1442 down(&codec_sem); 1442 mutex_lock(&codec_mutex);
1443 INIT_LIST_HEAD(&driver->list); 1443 INIT_LIST_HEAD(&driver->list);
1444 list_add(&driver->list, &codec_drivers); 1444 list_add(&driver->list, &codec_drivers);
1445 1445
@@ -1452,7 +1452,7 @@ int ac97_register_driver(struct ac97_driver *driver)
1452 continue; 1452 continue;
1453 c->driver = driver; 1453 c->driver = driver;
1454 } 1454 }
1455 up(&codec_sem); 1455 mutex_unlock(&codec_mutex);
1456 return 0; 1456 return 0;
1457} 1457}
1458 1458
@@ -1471,7 +1471,7 @@ void ac97_unregister_driver(struct ac97_driver *driver)
1471 struct list_head *l; 1471 struct list_head *l;
1472 struct ac97_codec *c; 1472 struct ac97_codec *c;
1473 1473
1474 down(&codec_sem); 1474 mutex_lock(&codec_mutex);
1475 list_del_init(&driver->list); 1475 list_del_init(&driver->list);
1476 1476
1477 list_for_each(l, &codecs) 1477 list_for_each(l, &codecs)
@@ -1483,7 +1483,7 @@ void ac97_unregister_driver(struct ac97_driver *driver)
1483 } 1483 }
1484 } 1484 }
1485 1485
1486 up(&codec_sem); 1486 mutex_unlock(&codec_mutex);
1487} 1487}
1488 1488
1489EXPORT_SYMBOL_GPL(ac97_unregister_driver); 1489EXPORT_SYMBOL_GPL(ac97_unregister_driver);
@@ -1494,14 +1494,14 @@ static int swap_headphone(int remove_master)
1494 struct ac97_codec *c; 1494 struct ac97_codec *c;
1495 1495
1496 if (remove_master) { 1496 if (remove_master) {
1497 down(&codec_sem); 1497 mutex_lock(&codec_mutex);
1498 list_for_each(l, &codecs) 1498 list_for_each(l, &codecs)
1499 { 1499 {
1500 c = list_entry(l, struct ac97_codec, list); 1500 c = list_entry(l, struct ac97_codec, list);
1501 if (supported_mixer(c, SOUND_MIXER_PHONEOUT)) 1501 if (supported_mixer(c, SOUND_MIXER_PHONEOUT))
1502 c->supported_mixers &= ~SOUND_MASK_PHONEOUT; 1502 c->supported_mixers &= ~SOUND_MASK_PHONEOUT;
1503 } 1503 }
1504 up(&codec_sem); 1504 mutex_unlock(&codec_mutex);
1505 } else 1505 } else
1506 ac97_hw[SOUND_MIXER_PHONEOUT].offset = AC97_MASTER_VOL_STEREO; 1506 ac97_hw[SOUND_MIXER_PHONEOUT].offset = AC97_MASTER_VOL_STEREO;
1507 1507