diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-16 10:34:20 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 04:25:29 -0500 |
commit | 62932df8fb20ba2fb53a95fa52445eba22e821fe (patch) | |
tree | 335178d7438395a68a453a9c23624b3e9fc5ec40 /sound/pci/cs46xx/cs46xx_lib.c | |
parent | 8b7547f95cbe8a5940df62ed730646fdfcba5fda (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/cs46xx_lib.c')
-rw-r--r-- | sound/pci/cs46xx/cs46xx_lib.c | 52 |
1 files changed, 27 insertions, 25 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; |