4141#include <sound/info.h>
4242#include <linux/soundcard.h>
4343#include <sound/initval.h>
44+ #include <sound/mixer_oss.h>
4445
4546#define OSS_ALSAEMULVER _SIOR ('M', 249, int)
4647
@@ -60,7 +61,6 @@ MODULE_PARM_DESC(nonblock_open, "Don't block opening busy PCM devices.");
6061MODULE_ALIAS_SNDRV_MINOR (SNDRV_MINOR_OSS_PCM );
6162MODULE_ALIAS_SNDRV_MINOR (SNDRV_MINOR_OSS_PCM1 );
6263
63- extern int snd_mixer_oss_ioctl_card (struct snd_card * card , unsigned int cmd , unsigned long arg );
6464static int snd_pcm_oss_get_rate (struct snd_pcm_oss_file * pcm_oss_file );
6565static int snd_pcm_oss_get_channels (struct snd_pcm_oss_file * pcm_oss_file );
6666static int snd_pcm_oss_get_format (struct snd_pcm_oss_file * pcm_oss_file );
@@ -656,7 +656,7 @@ snd_pcm_uframes_t get_hw_ptr_period(struct snd_pcm_runtime *runtime)
656656#define AFMT_AC3 0x00000400
657657#define AFMT_VORBIS 0x00000800
658658
659- static int snd_pcm_oss_format_from (int format )
659+ static snd_pcm_format_t snd_pcm_oss_format_from (int format )
660660{
661661 switch (format ) {
662662 case AFMT_MU_LAW : return SNDRV_PCM_FORMAT_MU_LAW ;
@@ -680,7 +680,7 @@ static int snd_pcm_oss_format_from(int format)
680680 }
681681}
682682
683- static int snd_pcm_oss_format_to (int format )
683+ static int snd_pcm_oss_format_to (snd_pcm_format_t format )
684684{
685685 switch (format ) {
686686 case SNDRV_PCM_FORMAT_MU_LAW : return AFMT_MU_LAW ;
@@ -843,7 +843,8 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
843843 size_t oss_frame_size ;
844844 int err ;
845845 int direct ;
846- int format , sformat , n ;
846+ snd_pcm_format_t format , sformat ;
847+ int n ;
847848 struct snd_mask sformat_mask ;
848849 struct snd_mask mask ;
849850
@@ -868,11 +869,11 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
868869 _snd_pcm_hw_param_min (sparams , SNDRV_PCM_HW_PARAM_PERIODS , 2 , 0 );
869870 snd_mask_none (& mask );
870871 if (atomic_read (& substream -> mmap_count ))
871- snd_mask_set (& mask , SNDRV_PCM_ACCESS_MMAP_INTERLEAVED );
872+ snd_mask_set (& mask , ( __force int ) SNDRV_PCM_ACCESS_MMAP_INTERLEAVED );
872873 else {
873- snd_mask_set (& mask , SNDRV_PCM_ACCESS_RW_INTERLEAVED );
874+ snd_mask_set (& mask , ( __force int ) SNDRV_PCM_ACCESS_RW_INTERLEAVED );
874875 if (!direct )
875- snd_mask_set (& mask , SNDRV_PCM_ACCESS_RW_NONINTERLEAVED );
876+ snd_mask_set (& mask , ( __force int ) SNDRV_PCM_ACCESS_RW_NONINTERLEAVED );
876877 }
877878 err = snd_pcm_hw_param_mask (substream , sparams , SNDRV_PCM_HW_PARAM_ACCESS , & mask );
878879 if (err < 0 ) {
@@ -891,19 +892,22 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
891892 else
892893 sformat = snd_pcm_plug_slave_format (format , & sformat_mask );
893894
894- if (sformat < 0 || !snd_mask_test (& sformat_mask , sformat )) {
895- for (sformat = 0 ; sformat <= SNDRV_PCM_FORMAT_LAST ; sformat ++ ) {
896- if (snd_mask_test (& sformat_mask , sformat ) &&
895+ if ((__force int )sformat < 0 ||
896+ !snd_mask_test (& sformat_mask , (__force int )sformat )) {
897+ for (sformat = (__force snd_pcm_format_t )0 ;
898+ (__force int )sformat <= (__force int )SNDRV_PCM_FORMAT_LAST ;
899+ sformat = (__force snd_pcm_format_t )((__force int )sformat + 1 )) {
900+ if (snd_mask_test (& sformat_mask , (__force int )sformat ) &&
897901 snd_pcm_oss_format_to (sformat ) >= 0 )
898902 break ;
899903 }
900- if (sformat > SNDRV_PCM_FORMAT_LAST ) {
904+ if (( __force int ) sformat > ( __force int ) SNDRV_PCM_FORMAT_LAST ) {
901905 snd_printd ("Cannot find a format!!!\n" );
902906 err = - EINVAL ;
903907 goto failure ;
904908 }
905909 }
906- err = _snd_pcm_hw_param_set (sparams , SNDRV_PCM_HW_PARAM_FORMAT , sformat , 0 );
910+ err = _snd_pcm_hw_param_set (sparams , SNDRV_PCM_HW_PARAM_FORMAT , ( __force int ) sformat , 0 );
907911 if (err < 0 )
908912 goto failure ;
909913
@@ -912,9 +916,9 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
912916 } else {
913917 _snd_pcm_hw_params_any (params );
914918 _snd_pcm_hw_param_set (params , SNDRV_PCM_HW_PARAM_ACCESS ,
915- SNDRV_PCM_ACCESS_RW_INTERLEAVED , 0 );
919+ ( __force int ) SNDRV_PCM_ACCESS_RW_INTERLEAVED , 0 );
916920 _snd_pcm_hw_param_set (params , SNDRV_PCM_HW_PARAM_FORMAT ,
917- snd_pcm_oss_format_from (runtime -> oss .format ), 0 );
921+ ( __force int ) snd_pcm_oss_format_from (runtime -> oss .format ), 0 );
918922 _snd_pcm_hw_param_set (params , SNDRV_PCM_HW_PARAM_CHANNELS ,
919923 runtime -> oss .channels , 0 );
920924 _snd_pcm_hw_param_set (params , SNDRV_PCM_HW_PARAM_RATE ,
@@ -1185,10 +1189,10 @@ snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const
11851189 if (in_kernel ) {
11861190 mm_segment_t fs ;
11871191 fs = snd_enter_user ();
1188- ret = snd_pcm_lib_write (substream , (void __user * )ptr , frames );
1192+ ret = snd_pcm_lib_write (substream , (void __force __user * )ptr , frames );
11891193 snd_leave_user (fs );
11901194 } else {
1191- ret = snd_pcm_lib_write (substream , (void __user * )ptr , frames );
1195+ ret = snd_pcm_lib_write (substream , (void __force __user * )ptr , frames );
11921196 }
11931197 if (ret != - EPIPE && ret != - ESTRPIPE )
11941198 break ;
@@ -1230,10 +1234,10 @@ snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *p
12301234 if (in_kernel ) {
12311235 mm_segment_t fs ;
12321236 fs = snd_enter_user ();
1233- ret = snd_pcm_lib_read (substream , (void __user * )ptr , frames );
1237+ ret = snd_pcm_lib_read (substream , (void __force __user * )ptr , frames );
12341238 snd_leave_user (fs );
12351239 } else {
1236- ret = snd_pcm_lib_read (substream , (void __user * )ptr , frames );
1240+ ret = snd_pcm_lib_read (substream , (void __force __user * )ptr , frames );
12371241 }
12381242 if (ret == - EPIPE ) {
12391243 if (runtime -> status -> state == SNDRV_PCM_STATE_DRAINING ) {
@@ -1333,7 +1337,7 @@ static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const cha
13331337 struct snd_pcm_plugin_channel * channels ;
13341338 size_t oss_frame_bytes = (runtime -> oss .plugin_first -> src_width * runtime -> oss .plugin_first -> src_format .channels ) / 8 ;
13351339 if (!in_kernel ) {
1336- if (copy_from_user (runtime -> oss .buffer , (const char __user * )buf , bytes ))
1340+ if (copy_from_user (runtime -> oss .buffer , (const char __force __user * )buf , bytes ))
13371341 return - EFAULT ;
13381342 buf = runtime -> oss .buffer ;
13391343 }
@@ -1429,7 +1433,7 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf,
14291433 struct snd_pcm_runtime * runtime = substream -> runtime ;
14301434 snd_pcm_sframes_t frames , frames1 ;
14311435#ifdef CONFIG_SND_PCM_OSS_PLUGINS
1432- char __user * final_dst = (char __user * )buf ;
1436+ char __user * final_dst = (char __force __user * )buf ;
14331437 if (runtime -> oss .plugin_first ) {
14341438 struct snd_pcm_plugin_channel * channels ;
14351439 size_t oss_frame_bytes = (runtime -> oss .plugin_last -> dst_width * runtime -> oss .plugin_last -> dst_format .channels ) / 8 ;
@@ -1549,6 +1553,7 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
15491553{
15501554 struct snd_pcm_runtime * runtime ;
15511555 ssize_t result = 0 ;
1556+ snd_pcm_state_t state ;
15521557 long res ;
15531558 wait_queue_t wait ;
15541559
@@ -1570,9 +1575,9 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
15701575 result = 0 ;
15711576 set_current_state (TASK_INTERRUPTIBLE );
15721577 snd_pcm_stream_lock_irq (substream );
1573- res = runtime -> status -> state ;
1578+ state = runtime -> status -> state ;
15741579 snd_pcm_stream_unlock_irq (substream );
1575- if (res != SNDRV_PCM_STATE_RUNNING ) {
1580+ if (state != SNDRV_PCM_STATE_RUNNING ) {
15761581 set_current_state (TASK_RUNNING );
15771582 break ;
15781583 }
@@ -1658,7 +1663,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
16581663 size1 );
16591664 size1 /= runtime -> channels ; /* frames */
16601665 fs = snd_enter_user ();
1661- snd_pcm_lib_write (substream , (void __user * )runtime -> oss .buffer , size1 );
1666+ snd_pcm_lib_write (substream , (void __force __user * )runtime -> oss .buffer , size1 );
16621667 snd_leave_user (fs );
16631668 }
16641669 } else if (runtime -> access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ) {
0 commit comments