aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cs46xx
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-16 10:34:20 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-22 04:25:29 -0500
commit62932df8fb20ba2fb53a95fa52445eba22e821fe (patch)
tree335178d7438395a68a453a9c23624b3e9fc5ec40 /sound/pci/cs46xx
parent8b7547f95cbe8a5940df62ed730646fdfcba5fda (diff)
[ALSA] semaphore -> mutex (PCI 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/pci/cs46xx')
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c52
-rw-r--r--sound/pci/cs46xx/dsp_spos.c58
-rw-r--r--sound/pci/cs46xx/dsp_spos_scb_lib.c6
3 files changed, 61 insertions, 55 deletions
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 8fb275d6eb77..69dbf542a6de 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -53,6 +53,8 @@
53#include <linux/interrupt.h> 53#include <linux/interrupt.h>
54#include <linux/slab.h> 54#include <linux/slab.h>
55#include <linux/gameport.h> 55#include <linux/gameport.h>
56#include <linux/mutex.h>
57
56 58
57#include <sound/core.h> 59#include <sound/core.h>
58#include <sound/control.h> 60#include <sound/control.h>
@@ -909,22 +911,22 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
909#ifdef CONFIG_SND_CS46XX_NEW_DSP 911#ifdef CONFIG_SND_CS46XX_NEW_DSP
910 snd_assert (sample_rate != 0, return -ENXIO); 912 snd_assert (sample_rate != 0, return -ENXIO);
911 913
912 down (&chip->spos_mutex); 914 mutex_lock(&chip->spos_mutex);
913 915
914 if (_cs46xx_adjust_sample_rate (chip,cpcm,sample_rate)) { 916 if (_cs46xx_adjust_sample_rate (chip,cpcm,sample_rate)) {
915 up (&chip->spos_mutex); 917 mutex_unlock(&chip->spos_mutex);
916 return -ENXIO; 918 return -ENXIO;
917 } 919 }
918 920
919 snd_assert (cpcm->pcm_channel != NULL); 921 snd_assert (cpcm->pcm_channel != NULL);
920 if (!cpcm->pcm_channel) { 922 if (!cpcm->pcm_channel) {
921 up (&chip->spos_mutex); 923 mutex_unlock(&chip->spos_mutex);
922 return -ENXIO; 924 return -ENXIO;
923 } 925 }
924 926
925 927
926 if (cs46xx_dsp_pcm_channel_set_period (chip,cpcm->pcm_channel,period_size)) { 928 if (cs46xx_dsp_pcm_channel_set_period (chip,cpcm->pcm_channel,period_size)) {
927 up (&chip->spos_mutex); 929 mutex_unlock(&chip->spos_mutex);
928 return -EINVAL; 930 return -EINVAL;
929 } 931 }
930 932
@@ -965,7 +967,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
965 } 967 }
966 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) { 968 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) {
967#ifdef CONFIG_SND_CS46XX_NEW_DSP 969#ifdef CONFIG_SND_CS46XX_NEW_DSP
968 up (&chip->spos_mutex); 970 mutex_unlock(&chip->spos_mutex);
969#endif 971#endif
970 return err; 972 return err;
971 } 973 }
@@ -989,7 +991,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
989 } 991 }
990 992
991#ifdef CONFIG_SND_CS46XX_NEW_DSP 993#ifdef CONFIG_SND_CS46XX_NEW_DSP
992 up (&chip->spos_mutex); 994 mutex_unlock(&chip->spos_mutex);
993#endif 995#endif
994 996
995 return 0; 997 return 0;
@@ -1319,7 +1321,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
1319 1321
1320 cpcm->substream = substream; 1322 cpcm->substream = substream;
1321#ifdef CONFIG_SND_CS46XX_NEW_DSP 1323#ifdef CONFIG_SND_CS46XX_NEW_DSP
1322 down (&chip->spos_mutex); 1324 mutex_lock(&chip->spos_mutex);
1323 cpcm->pcm_channel = NULL; 1325 cpcm->pcm_channel = NULL;
1324 cpcm->pcm_channel_id = pcm_channel_id; 1326 cpcm->pcm_channel_id = pcm_channel_id;
1325 1327
@@ -1328,7 +1330,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
1328 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1330 SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1329 &hw_constraints_period_sizes); 1331 &hw_constraints_period_sizes);
1330 1332
1331 up (&chip->spos_mutex); 1333 mutex_unlock(&chip->spos_mutex);
1332#else 1334#else
1333 chip->playback_pcm = cpcm; /* HACK */ 1335 chip->playback_pcm = cpcm; /* HACK */
1334#endif 1336#endif
@@ -1367,9 +1369,9 @@ static int snd_cs46xx_playback_open_iec958(struct snd_pcm_substream *substream)
1367 1369
1368 snd_printdd("open raw iec958 channel\n"); 1370 snd_printdd("open raw iec958 channel\n");
1369 1371
1370 down (&chip->spos_mutex); 1372 mutex_lock(&chip->spos_mutex);
1371 cs46xx_iec958_pre_open (chip); 1373 cs46xx_iec958_pre_open (chip);
1372 up (&chip->spos_mutex); 1374 mutex_unlock(&chip->spos_mutex);
1373 1375
1374 return _cs46xx_playback_open_channel(substream,DSP_IEC958_CHANNEL); 1376 return _cs46xx_playback_open_channel(substream,DSP_IEC958_CHANNEL);
1375} 1377}
@@ -1385,9 +1387,9 @@ static int snd_cs46xx_playback_close_iec958(struct snd_pcm_substream *substream)
1385 1387
1386 err = snd_cs46xx_playback_close(substream); 1388 err = snd_cs46xx_playback_close(substream);
1387 1389
1388 down (&chip->spos_mutex); 1390 mutex_lock(&chip->spos_mutex);
1389 cs46xx_iec958_post_close (chip); 1391 cs46xx_iec958_post_close (chip);
1390 up (&chip->spos_mutex); 1392 mutex_unlock(&chip->spos_mutex);
1391 1393
1392 return err; 1394 return err;
1393} 1395}
@@ -1428,12 +1430,12 @@ static int snd_cs46xx_playback_close(struct snd_pcm_substream *substream)
1428 if (!cpcm) return -ENXIO; 1430 if (!cpcm) return -ENXIO;
1429 1431
1430#ifdef CONFIG_SND_CS46XX_NEW_DSP 1432#ifdef CONFIG_SND_CS46XX_NEW_DSP
1431 down (&chip->spos_mutex); 1433 mutex_lock(&chip->spos_mutex);
1432 if (cpcm->pcm_channel) { 1434 if (cpcm->pcm_channel) {
1433 cs46xx_dsp_destroy_pcm_channel(chip,cpcm->pcm_channel); 1435 cs46xx_dsp_destroy_pcm_channel(chip,cpcm->pcm_channel);
1434 cpcm->pcm_channel = NULL; 1436 cpcm->pcm_channel = NULL;
1435 } 1437 }
1436 up (&chip->spos_mutex); 1438 mutex_unlock(&chip->spos_mutex);
1437#else 1439#else
1438 chip->playback_pcm = NULL; 1440 chip->playback_pcm = NULL;
1439#endif 1441#endif
@@ -1848,7 +1850,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
1848 1850
1849 switch (kcontrol->private_value) { 1851 switch (kcontrol->private_value) {
1850 case CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT: 1852 case CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT:
1851 down (&chip->spos_mutex); 1853 mutex_lock(&chip->spos_mutex);
1852 change = (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED); 1854 change = (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED);
1853 if (ucontrol->value.integer.value[0] && !change) 1855 if (ucontrol->value.integer.value[0] && !change)
1854 cs46xx_dsp_enable_spdif_out(chip); 1856 cs46xx_dsp_enable_spdif_out(chip);
@@ -1856,7 +1858,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
1856 cs46xx_dsp_disable_spdif_out(chip); 1858 cs46xx_dsp_disable_spdif_out(chip);
1857 1859
1858 res = (change != (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED)); 1860 res = (change != (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED));
1859 up (&chip->spos_mutex); 1861 mutex_unlock(&chip->spos_mutex);
1860 break; 1862 break;
1861 case CS46XX_MIXER_SPDIF_INPUT_ELEMENT: 1863 case CS46XX_MIXER_SPDIF_INPUT_ELEMENT:
1862 change = chip->dsp_spos_instance->spdif_status_in; 1864 change = chip->dsp_spos_instance->spdif_status_in;
@@ -1997,12 +1999,12 @@ static int snd_cs46xx_spdif_default_get(struct snd_kcontrol *kcontrol,
1997 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); 1999 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol);
1998 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 2000 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1999 2001
2000 down (&chip->spos_mutex); 2002 mutex_lock(&chip->spos_mutex);
2001 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_default >> 24) & 0xff); 2003 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_default >> 24) & 0xff);
2002 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_default >> 16) & 0xff); 2004 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_default >> 16) & 0xff);
2003 ucontrol->value.iec958.status[2] = 0; 2005 ucontrol->value.iec958.status[2] = 0;
2004 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_default) & 0xff); 2006 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_default) & 0xff);
2005 up (&chip->spos_mutex); 2007 mutex_unlock(&chip->spos_mutex);
2006 2008
2007 return 0; 2009 return 0;
2008} 2010}
@@ -2015,7 +2017,7 @@ static int snd_cs46xx_spdif_default_put(struct snd_kcontrol *kcontrol,
2015 unsigned int val; 2017 unsigned int val;
2016 int change; 2018 int change;
2017 2019
2018 down (&chip->spos_mutex); 2020 mutex_lock(&chip->spos_mutex);
2019 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) | 2021 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) |
2020 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[2]) << 16) | 2022 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[2]) << 16) |
2021 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) | 2023 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) |
@@ -2029,7 +2031,7 @@ static int snd_cs46xx_spdif_default_put(struct snd_kcontrol *kcontrol,
2029 if ( !(ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN) ) 2031 if ( !(ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN) )
2030 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val); 2032 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val);
2031 2033
2032 up (&chip->spos_mutex); 2034 mutex_unlock(&chip->spos_mutex);
2033 2035
2034 return change; 2036 return change;
2035} 2037}
@@ -2050,12 +2052,12 @@ static int snd_cs46xx_spdif_stream_get(struct snd_kcontrol *kcontrol,
2050 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); 2052 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol);
2051 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 2053 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
2052 2054
2053 down (&chip->spos_mutex); 2055 mutex_lock(&chip->spos_mutex);
2054 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_stream >> 24) & 0xff); 2056 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_stream >> 24) & 0xff);
2055 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_stream >> 16) & 0xff); 2057 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_stream >> 16) & 0xff);
2056 ucontrol->value.iec958.status[2] = 0; 2058 ucontrol->value.iec958.status[2] = 0;
2057 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_stream) & 0xff); 2059 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_stream) & 0xff);
2058 up (&chip->spos_mutex); 2060 mutex_unlock(&chip->spos_mutex);
2059 2061
2060 return 0; 2062 return 0;
2061} 2063}
@@ -2068,7 +2070,7 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol,
2068 unsigned int val; 2070 unsigned int val;
2069 int change; 2071 int change;
2070 2072
2071 down (&chip->spos_mutex); 2073 mutex_lock(&chip->spos_mutex);
2072 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) | 2074 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) |
2073 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[1]) << 16) | 2075 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[1]) << 16) |
2074 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) | 2076 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) |
@@ -2082,7 +2084,7 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol,
2082 if ( ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN ) 2084 if ( ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN )
2083 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val); 2085 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val);
2084 2086
2085 up (&chip->spos_mutex); 2087 mutex_unlock(&chip->spos_mutex);
2086 2088
2087 return change; 2089 return change;
2088} 2090}
@@ -3755,7 +3757,7 @@ int __devinit snd_cs46xx_create(struct snd_card *card,
3755 } 3757 }
3756 spin_lock_init(&chip->reg_lock); 3758 spin_lock_init(&chip->reg_lock);
3757#ifdef CONFIG_SND_CS46XX_NEW_DSP 3759#ifdef CONFIG_SND_CS46XX_NEW_DSP
3758 init_MUTEX(&chip->spos_mutex); 3760 mutex_init(&chip->spos_mutex);
3759#endif 3761#endif
3760 chip->card = card; 3762 chip->card = card;
3761 chip->pci = pci; 3763 chip->pci = pci;
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 445a448949e7..8726a68051e7 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -28,6 +28,8 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/vmalloc.h> 30#include <linux/vmalloc.h>
31#include <linux/mutex.h>
32
31#include <sound/core.h> 33#include <sound/core.h>
32#include <sound/control.h> 34#include <sound/control.h>
33#include <sound/info.h> 35#include <sound/info.h>
@@ -287,7 +289,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
287 289
288 snd_assert(ins != NULL, return); 290 snd_assert(ins != NULL, return);
289 291
290 down(&chip->spos_mutex); 292 mutex_lock(&chip->spos_mutex);
291 for (i = 0; i < ins->nscb; ++i) { 293 for (i = 0; i < ins->nscb; ++i) {
292 if (ins->scbs[i].deleted) continue; 294 if (ins->scbs[i].deleted) continue;
293 295
@@ -298,7 +300,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
298 vfree(ins->symbol_table.symbols); 300 vfree(ins->symbol_table.symbols);
299 kfree(ins->modules); 301 kfree(ins->modules);
300 kfree(ins); 302 kfree(ins);
301 up(&chip->spos_mutex); 303 mutex_unlock(&chip->spos_mutex);
302} 304}
303 305
304int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module) 306int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module)
@@ -497,7 +499,7 @@ static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
497 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 499 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
498 int i,j; 500 int i,j;
499 501
500 down(&chip->spos_mutex); 502 mutex_lock(&chip->spos_mutex);
501 snd_iprintf(buffer, "MODULES:\n"); 503 snd_iprintf(buffer, "MODULES:\n");
502 for ( i = 0; i < ins->nmodules; ++i ) { 504 for ( i = 0; i < ins->nmodules; ++i ) {
503 snd_iprintf(buffer, "\n%s:\n", ins->modules[i].module_name); 505 snd_iprintf(buffer, "\n%s:\n", ins->modules[i].module_name);
@@ -510,7 +512,7 @@ static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
510 desc->segment_type,desc->offset, desc->size); 512 desc->segment_type,desc->offset, desc->size);
511 } 513 }
512 } 514 }
513 up(&chip->spos_mutex); 515 mutex_unlock(&chip->spos_mutex);
514} 516}
515 517
516static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry, 518static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
@@ -521,7 +523,7 @@ static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
521 int i, j, col; 523 int i, j, col;
522 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; 524 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET;
523 525
524 down(&chip->spos_mutex); 526 mutex_lock(&chip->spos_mutex);
525 snd_iprintf(buffer, "TASK TREES:\n"); 527 snd_iprintf(buffer, "TASK TREES:\n");
526 for ( i = 0; i < ins->ntask; ++i) { 528 for ( i = 0; i < ins->ntask; ++i) {
527 snd_iprintf(buffer,"\n%04x %s:\n",ins->tasks[i].address,ins->tasks[i].task_name); 529 snd_iprintf(buffer,"\n%04x %s:\n",ins->tasks[i].address,ins->tasks[i].task_name);
@@ -538,7 +540,7 @@ static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
538 } 540 }
539 541
540 snd_iprintf(buffer,"\n"); 542 snd_iprintf(buffer,"\n");
541 up(&chip->spos_mutex); 543 mutex_unlock(&chip->spos_mutex);
542} 544}
543 545
544static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry, 546static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
@@ -548,7 +550,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
548 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 550 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
549 int i; 551 int i;
550 552
551 down(&chip->spos_mutex); 553 mutex_lock(&chip->spos_mutex);
552 snd_iprintf(buffer, "SCB's:\n"); 554 snd_iprintf(buffer, "SCB's:\n");
553 for ( i = 0; i < ins->nscb; ++i) { 555 for ( i = 0; i < ins->nscb; ++i) {
554 if (ins->scbs[i].deleted) 556 if (ins->scbs[i].deleted)
@@ -571,7 +573,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
571 } 573 }
572 574
573 snd_iprintf(buffer,"\n"); 575 snd_iprintf(buffer,"\n");
574 up(&chip->spos_mutex); 576 mutex_unlock(&chip->spos_mutex);
575} 577}
576 578
577static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry, 579static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry,
@@ -852,14 +854,14 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
852 } 854 }
853 ins->proc_scb_info_entry = entry; 855 ins->proc_scb_info_entry = entry;
854 856
855 down(&chip->spos_mutex); 857 mutex_lock(&chip->spos_mutex);
856 /* register/update SCB's entries on proc */ 858 /* register/update SCB's entries on proc */
857 for (i = 0; i < ins->nscb; ++i) { 859 for (i = 0; i < ins->nscb; ++i) {
858 if (ins->scbs[i].deleted) continue; 860 if (ins->scbs[i].deleted) continue;
859 861
860 cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i)); 862 cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i));
861 } 863 }
862 up(&chip->spos_mutex); 864 mutex_unlock(&chip->spos_mutex);
863 865
864 return 0; 866 return 0;
865} 867}
@@ -899,12 +901,12 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
899 ins->proc_task_info_entry = NULL; 901 ins->proc_task_info_entry = NULL;
900 } 902 }
901 903
902 down(&chip->spos_mutex); 904 mutex_lock(&chip->spos_mutex);
903 for (i = 0; i < ins->nscb; ++i) { 905 for (i = 0; i < ins->nscb; ++i) {
904 if (ins->scbs[i].deleted) continue; 906 if (ins->scbs[i].deleted) continue;
905 cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); 907 cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) );
906 } 908 }
907 up(&chip->spos_mutex); 909 mutex_unlock(&chip->spos_mutex);
908 910
909 if (ins->proc_dsp_dir) { 911 if (ins->proc_dsp_dir) {
910 snd_info_unregister (ins->proc_dsp_dir); 912 snd_info_unregister (ins->proc_dsp_dir);
@@ -1694,7 +1696,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
1694 snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL); 1696 snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL);
1695 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1697 snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
1696 1698
1697 down(&chip->spos_mutex); 1699 mutex_lock(&chip->spos_mutex);
1698 1700
1699 if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) { 1701 if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) {
1700 /* time countdown enable */ 1702 /* time countdown enable */
@@ -1738,7 +1740,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
1738 1740
1739 /* monitor state */ 1741 /* monitor state */
1740 ins->spdif_status_in = 1; 1742 ins->spdif_status_in = 1;
1741 up(&chip->spos_mutex); 1743 mutex_unlock(&chip->spos_mutex);
1742 1744
1743 return 0; 1745 return 0;
1744} 1746}
@@ -1750,7 +1752,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
1750 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL); 1752 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL);
1751 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1753 snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
1752 1754
1753 down(&chip->spos_mutex); 1755 mutex_lock(&chip->spos_mutex);
1754 1756
1755 /* Remove the asynchronous receiver SCB */ 1757 /* Remove the asynchronous receiver SCB */
1756 cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb); 1758 cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb);
@@ -1760,7 +1762,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
1760 1762
1761 /* monitor state */ 1763 /* monitor state */
1762 ins->spdif_status_in = 0; 1764 ins->spdif_status_in = 0;
1763 up(&chip->spos_mutex); 1765 mutex_unlock(&chip->spos_mutex);
1764 1766
1765 /* restore amplifier */ 1767 /* restore amplifier */
1766 chip->active_ctrl(chip, -1); 1768 chip->active_ctrl(chip, -1);
@@ -1776,10 +1778,10 @@ int cs46xx_dsp_enable_pcm_capture (struct snd_cs46xx *chip)
1776 snd_assert (ins->pcm_input == NULL,return -EINVAL); 1778 snd_assert (ins->pcm_input == NULL,return -EINVAL);
1777 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL); 1779 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL);
1778 1780
1779 down(&chip->spos_mutex); 1781 mutex_lock(&chip->spos_mutex);
1780 ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR, 1782 ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR,
1781 "PCMSerialInput_Wave"); 1783 "PCMSerialInput_Wave");
1782 up(&chip->spos_mutex); 1784 mutex_unlock(&chip->spos_mutex);
1783 1785
1784 return 0; 1786 return 0;
1785} 1787}
@@ -1790,10 +1792,10 @@ int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip)
1790 1792
1791 snd_assert (ins->pcm_input != NULL,return -EINVAL); 1793 snd_assert (ins->pcm_input != NULL,return -EINVAL);
1792 1794
1793 down(&chip->spos_mutex); 1795 mutex_lock(&chip->spos_mutex);
1794 cs46xx_dsp_remove_scb (chip,ins->pcm_input); 1796 cs46xx_dsp_remove_scb (chip,ins->pcm_input);
1795 ins->pcm_input = NULL; 1797 ins->pcm_input = NULL;
1796 up(&chip->spos_mutex); 1798 mutex_unlock(&chip->spos_mutex);
1797 1799
1798 return 0; 1800 return 0;
1799} 1801}
@@ -1805,10 +1807,10 @@ int cs46xx_dsp_enable_adc_capture (struct snd_cs46xx *chip)
1805 snd_assert (ins->adc_input == NULL,return -EINVAL); 1807 snd_assert (ins->adc_input == NULL,return -EINVAL);
1806 snd_assert (ins->codec_in_scb != NULL,return -EINVAL); 1808 snd_assert (ins->codec_in_scb != NULL,return -EINVAL);
1807 1809
1808 down(&chip->spos_mutex); 1810 mutex_lock(&chip->spos_mutex);
1809 ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR, 1811 ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR,
1810 "PCMSerialInput_ADC"); 1812 "PCMSerialInput_ADC");
1811 up(&chip->spos_mutex); 1813 mutex_unlock(&chip->spos_mutex);
1812 1814
1813 return 0; 1815 return 0;
1814} 1816}
@@ -1819,10 +1821,10 @@ int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip)
1819 1821
1820 snd_assert (ins->adc_input != NULL,return -EINVAL); 1822 snd_assert (ins->adc_input != NULL,return -EINVAL);
1821 1823
1822 down(&chip->spos_mutex); 1824 mutex_lock(&chip->spos_mutex);
1823 cs46xx_dsp_remove_scb (chip,ins->adc_input); 1825 cs46xx_dsp_remove_scb (chip,ins->adc_input);
1824 ins->adc_input = NULL; 1826 ins->adc_input = NULL;
1825 up(&chip->spos_mutex); 1827 mutex_unlock(&chip->spos_mutex);
1826 1828
1827 return 0; 1829 return 0;
1828} 1830}
@@ -1869,7 +1871,7 @@ int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1869 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1871 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1870 struct dsp_scb_descriptor * scb; 1872 struct dsp_scb_descriptor * scb;
1871 1873
1872 down(&chip->spos_mutex); 1874 mutex_lock(&chip->spos_mutex);
1873 1875
1874 /* main output */ 1876 /* main output */
1875 scb = ins->master_mix_scb->sub_list_ptr; 1877 scb = ins->master_mix_scb->sub_list_ptr;
@@ -1888,7 +1890,7 @@ int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1888 ins->dac_volume_left = left; 1890 ins->dac_volume_left = left;
1889 ins->dac_volume_right = right; 1891 ins->dac_volume_right = right;
1890 1892
1891 up(&chip->spos_mutex); 1893 mutex_unlock(&chip->spos_mutex);
1892 1894
1893 return 0; 1895 return 0;
1894} 1896}
@@ -1897,7 +1899,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1897{ 1899{
1898 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1900 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1899 1901
1900 down(&chip->spos_mutex); 1902 mutex_lock(&chip->spos_mutex);
1901 1903
1902 if (ins->asynch_rx_scb != NULL) 1904 if (ins->asynch_rx_scb != NULL)
1903 cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb, 1905 cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb,
@@ -1906,7 +1908,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1906 ins->spdif_input_volume_left = left; 1908 ins->spdif_input_volume_left = left;
1907 ins->spdif_input_volume_right = right; 1909 ins->spdif_input_volume_right = right;
1908 1910
1909 up(&chip->spos_mutex); 1911 mutex_unlock(&chip->spos_mutex);
1910 1912
1911 return 0; 1913 return 0;
1912} 1914}
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c
index d4e0fb39bd06..2c4ee45fe10c 100644
--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c
+++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c
@@ -28,6 +28,8 @@
28#include <linux/pm.h> 28#include <linux/pm.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/mutex.h>
32
31#include <sound/core.h> 33#include <sound/core.h>
32#include <sound/control.h> 34#include <sound/control.h>
33#include <sound/info.h> 35#include <sound/info.h>
@@ -77,7 +79,7 @@ static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,
77 79
78 ins = chip->dsp_spos_instance; 80 ins = chip->dsp_spos_instance;
79 81
80 down(&chip->spos_mutex); 82 mutex_lock(&chip->spos_mutex);
81 snd_iprintf(buffer,"%04x %s:\n",scb->address,scb->scb_name); 83 snd_iprintf(buffer,"%04x %s:\n",scb->address,scb->scb_name);
82 84
83 for (col = 0,j = 0;j < 0x10; j++,col++) { 85 for (col = 0,j = 0;j < 0x10; j++,col++) {
@@ -105,7 +107,7 @@ static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,
105 scb->task_entry->address); 107 scb->task_entry->address);
106 108
107 snd_iprintf(buffer,"index [%d] ref_count [%d]\n",scb->index,scb->ref_count); 109 snd_iprintf(buffer,"index [%d] ref_count [%d]\n",scb->index,scb->ref_count);
108 up(&chip->spos_mutex); 110 mutex_unlock(&chip->spos_mutex);
109} 111}
110#endif 112#endif
111 113