aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-03-18 02:39:08 -0400
committerTakashi Iwai <tiwai@suse.de>2011-03-18 02:39:08 -0400
commitd351cf4603edb2a5bfa9a48d06c425511c63f2a3 (patch)
treeb03ea3cfd3ca3974237563cf87328386c3d49ff1 /sound/core
parent433e8327caf9f7c0432b2f2f6684a5b79cfe18e9 (diff)
parent4a122c10fbfe9020df469f0f669da129c5757671 (diff)
Merge branch 'topic/misc' into for-linus
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/control.c22
-rw-r--r--sound/core/device.c7
-rw-r--r--sound/core/memalloc.c3
-rw-r--r--sound/core/oss/linear.c7
-rw-r--r--sound/core/oss/mixer_oss.c10
-rw-r--r--sound/core/oss/mulaw.c2
-rw-r--r--sound/core/oss/pcm_oss.c51
-rw-r--r--sound/core/oss/pcm_plugin.c40
-rw-r--r--sound/core/oss/pcm_plugin.h11
-rw-r--r--sound/core/oss/route.c6
-rw-r--r--sound/core/pcm.c10
-rw-r--r--sound/core/pcm_misc.c35
-rw-r--r--sound/core/pcm_native.c2
-rw-r--r--sound/core/seq/seq_clientmgr.c7
-rw-r--r--sound/core/seq/seq_memory.c6
-rw-r--r--sound/core/seq/seq_memory.h4
-rw-r--r--sound/core/seq/seq_ports.c2
-rw-r--r--sound/core/timer.c8
-rw-r--r--sound/core/vmaster.c2
19 files changed, 125 insertions, 110 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index db51e4e64984..a08ad57c49b6 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -279,33 +279,31 @@ void snd_ctl_free_one(struct snd_kcontrol *kcontrol)
279 279
280EXPORT_SYMBOL(snd_ctl_free_one); 280EXPORT_SYMBOL(snd_ctl_free_one);
281 281
282static unsigned int snd_ctl_hole_check(struct snd_card *card, 282static bool snd_ctl_remove_numid_conflict(struct snd_card *card,
283 unsigned int count) 283 unsigned int count)
284{ 284{
285 struct snd_kcontrol *kctl; 285 struct snd_kcontrol *kctl;
286 286
287 list_for_each_entry(kctl, &card->controls, list) { 287 list_for_each_entry(kctl, &card->controls, list) {
288 if ((kctl->id.numid <= card->last_numid && 288 if (kctl->id.numid < card->last_numid + 1 + count &&
289 kctl->id.numid + kctl->count > card->last_numid) || 289 kctl->id.numid + kctl->count > card->last_numid + 1) {
290 (kctl->id.numid <= card->last_numid + count - 1 && 290 card->last_numid = kctl->id.numid + kctl->count - 1;
291 kctl->id.numid + kctl->count > card->last_numid + count - 1)) 291 return true;
292 return card->last_numid = kctl->id.numid + kctl->count - 1; 292 }
293 } 293 }
294 return card->last_numid; 294 return false;
295} 295}
296 296
297static int snd_ctl_find_hole(struct snd_card *card, unsigned int count) 297static int snd_ctl_find_hole(struct snd_card *card, unsigned int count)
298{ 298{
299 unsigned int last_numid, iter = 100000; 299 unsigned int iter = 100000;
300 300
301 last_numid = card->last_numid; 301 while (snd_ctl_remove_numid_conflict(card, count)) {
302 while (last_numid != snd_ctl_hole_check(card, count)) {
303 if (--iter == 0) { 302 if (--iter == 0) {
304 /* this situation is very unlikely */ 303 /* this situation is very unlikely */
305 snd_printk(KERN_ERR "unable to allocate new control numid\n"); 304 snd_printk(KERN_ERR "unable to allocate new control numid\n");
306 return -ENOMEM; 305 return -ENOMEM;
307 } 306 }
308 last_numid = card->last_numid;
309 } 307 }
310 return 0; 308 return 0;
311} 309}
diff --git a/sound/core/device.c b/sound/core/device.c
index a67dfac08c03..2d1ad4b0cd65 100644
--- a/sound/core/device.c
+++ b/sound/core/device.c
@@ -225,15 +225,16 @@ int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd)
225{ 225{
226 struct snd_device *dev; 226 struct snd_device *dev;
227 int err; 227 int err;
228 unsigned int range_low, range_high; 228 unsigned int range_low, range_high, type;
229 229
230 if (snd_BUG_ON(!card)) 230 if (snd_BUG_ON(!card))
231 return -ENXIO; 231 return -ENXIO;
232 range_low = cmd * SNDRV_DEV_TYPE_RANGE_SIZE; 232 range_low = (__force unsigned int)cmd * SNDRV_DEV_TYPE_RANGE_SIZE;
233 range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1; 233 range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1;
234 __again: 234 __again:
235 list_for_each_entry(dev, &card->devices, list) { 235 list_for_each_entry(dev, &card->devices, list) {
236 if (dev->type >= range_low && dev->type <= range_high) { 236 type = (__force unsigned int)dev->type;
237 if (type >= range_low && type <= range_high) {
237 if ((err = snd_device_free(card, dev->device_data)) < 0) 238 if ((err = snd_device_free(card, dev->device_data)) < 0)
238 return err; 239 return err;
239 goto __again; 240 goto __again;
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index 9e92441f9b78..16bd9c03679b 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -192,7 +192,8 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
192 dmab->bytes = 0; 192 dmab->bytes = 0;
193 switch (type) { 193 switch (type) {
194 case SNDRV_DMA_TYPE_CONTINUOUS: 194 case SNDRV_DMA_TYPE_CONTINUOUS:
195 dmab->area = snd_malloc_pages(size, (unsigned long)device); 195 dmab->area = snd_malloc_pages(size,
196 (__force gfp_t)(unsigned long)device);
196 dmab->addr = 0; 197 dmab->addr = 0;
197 break; 198 break;
198#ifdef CONFIG_HAS_DMA 199#ifdef CONFIG_HAS_DMA
diff --git a/sound/core/oss/linear.c b/sound/core/oss/linear.c
index 4c1d16827199..13b3f6f49fae 100644
--- a/sound/core/oss/linear.c
+++ b/sound/core/oss/linear.c
@@ -114,7 +114,8 @@ static snd_pcm_sframes_t linear_transfer(struct snd_pcm_plugin *plugin,
114 return frames; 114 return frames;
115} 115}
116 116
117static void init_data(struct linear_priv *data, int src_format, int dst_format) 117static void init_data(struct linear_priv *data,
118 snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
118{ 119{
119 int src_le, dst_le, src_bytes, dst_bytes; 120 int src_le, dst_le, src_bytes, dst_bytes;
120 121
@@ -140,9 +141,9 @@ static void init_data(struct linear_priv *data, int src_format, int dst_format)
140 if (snd_pcm_format_signed(src_format) != 141 if (snd_pcm_format_signed(src_format) !=
141 snd_pcm_format_signed(dst_format)) { 142 snd_pcm_format_signed(dst_format)) {
142 if (dst_le) 143 if (dst_le)
143 data->flip = cpu_to_le32(0x80000000); 144 data->flip = (__force u32)cpu_to_le32(0x80000000);
144 else 145 else
145 data->flip = cpu_to_be32(0x80000000); 146 data->flip = (__force u32)cpu_to_be32(0x80000000);
146 } 147 }
147} 148}
148 149
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 822dd56993ca..d8359cfeca15 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -190,9 +190,10 @@ static int snd_mixer_oss_get_recsrc(struct snd_mixer_oss_file *fmixer)
190 return -EIO; 190 return -EIO;
191 if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */ 191 if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */
192 int err; 192 int err;
193 if ((err = mixer->get_recsrc(fmixer, &result)) < 0) 193 unsigned int index;
194 if ((err = mixer->get_recsrc(fmixer, &index)) < 0)
194 return err; 195 return err;
195 result = 1 << result; 196 result = 1 << index;
196 } else { 197 } else {
197 struct snd_mixer_oss_slot *pslot; 198 struct snd_mixer_oss_slot *pslot;
198 int chn; 199 int chn;
@@ -214,6 +215,7 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr
214 struct snd_mixer_oss *mixer = fmixer->mixer; 215 struct snd_mixer_oss *mixer = fmixer->mixer;
215 struct snd_mixer_oss_slot *pslot; 216 struct snd_mixer_oss_slot *pslot;
216 int chn, active; 217 int chn, active;
218 unsigned int index;
217 int result = 0; 219 int result = 0;
218 220
219 if (mixer == NULL) 221 if (mixer == NULL)
@@ -222,8 +224,8 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr
222 if (recsrc & ~mixer->oss_recsrc) 224 if (recsrc & ~mixer->oss_recsrc)
223 recsrc &= ~mixer->oss_recsrc; 225 recsrc &= ~mixer->oss_recsrc;
224 mixer->put_recsrc(fmixer, ffz(~recsrc)); 226 mixer->put_recsrc(fmixer, ffz(~recsrc));
225 mixer->get_recsrc(fmixer, &result); 227 mixer->get_recsrc(fmixer, &index);
226 result = 1 << result; 228 result = 1 << index;
227 } 229 }
228 for (chn = 0; chn < 31; chn++) { 230 for (chn = 0; chn < 31; chn++) {
229 pslot = &mixer->slots[chn]; 231 pslot = &mixer->slots[chn];
diff --git a/sound/core/oss/mulaw.c b/sound/core/oss/mulaw.c
index f7649d4d950b..7915564bd394 100644
--- a/sound/core/oss/mulaw.c
+++ b/sound/core/oss/mulaw.c
@@ -274,7 +274,7 @@ static snd_pcm_sframes_t mulaw_transfer(struct snd_pcm_plugin *plugin,
274 return frames; 274 return frames;
275} 275}
276 276
277static void init_data(struct mulaw_priv *data, int format) 277static void init_data(struct mulaw_priv *data, snd_pcm_format_t format)
278{ 278{
279#ifdef SNDRV_LITTLE_ENDIAN 279#ifdef SNDRV_LITTLE_ENDIAN
280 data->cvt_endian = snd_pcm_format_big_endian(format) > 0; 280 data->cvt_endian = snd_pcm_format_big_endian(format) > 0;
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index a2e4eb324699..23c34a02894b 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -41,6 +41,7 @@
41#include <sound/info.h> 41#include <sound/info.h>
42#include <linux/soundcard.h> 42#include <linux/soundcard.h>
43#include <sound/initval.h> 43#include <sound/initval.h>
44#include <sound/mixer_oss.h>
44 45
45#define OSS_ALSAEMULVER _SIOR ('M', 249, int) 46#define OSS_ALSAEMULVER _SIOR ('M', 249, int)
46 47
@@ -60,7 +61,6 @@ MODULE_PARM_DESC(nonblock_open, "Don't block opening busy PCM devices.");
60MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM); 61MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM);
61MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM1); 62MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM1);
62 63
63extern int snd_mixer_oss_ioctl_card(struct snd_card *card, unsigned int cmd, unsigned long arg);
64static int snd_pcm_oss_get_rate(struct snd_pcm_oss_file *pcm_oss_file); 64static int snd_pcm_oss_get_rate(struct snd_pcm_oss_file *pcm_oss_file);
65static int snd_pcm_oss_get_channels(struct snd_pcm_oss_file *pcm_oss_file); 65static int snd_pcm_oss_get_channels(struct snd_pcm_oss_file *pcm_oss_file);
66static int snd_pcm_oss_get_format(struct snd_pcm_oss_file *pcm_oss_file); 66static 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)
656#define AFMT_AC3 0x00000400 656#define AFMT_AC3 0x00000400
657#define AFMT_VORBIS 0x00000800 657#define AFMT_VORBIS 0x00000800
658 658
659static int snd_pcm_oss_format_from(int format) 659static snd_pcm_format_t snd_pcm_oss_format_from(int format)
660{ 660{
661 switch (format) { 661 switch (format) {
662 case AFMT_MU_LAW: return SNDRV_PCM_FORMAT_MU_LAW; 662 case AFMT_MU_LAW: return SNDRV_PCM_FORMAT_MU_LAW;
@@ -680,7 +680,7 @@ static int snd_pcm_oss_format_from(int format)
680 } 680 }
681} 681}
682 682
683static int snd_pcm_oss_format_to(int format) 683static int snd_pcm_oss_format_to(snd_pcm_format_t format)
684{ 684{
685 switch (format) { 685 switch (format) {
686 case SNDRV_PCM_FORMAT_MU_LAW: return AFMT_MU_LAW; 686 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)
843 size_t oss_frame_size; 843 size_t oss_frame_size;
844 int err; 844 int err;
845 int direct; 845 int direct;
846 int format, sformat, n; 846 snd_pcm_format_t format, sformat;
847 int n;
847 struct snd_mask sformat_mask; 848 struct snd_mask sformat_mask;
848 struct snd_mask mask; 849 struct snd_mask mask;
849 850
@@ -868,11 +869,11 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
868 _snd_pcm_hw_param_min(sparams, SNDRV_PCM_HW_PARAM_PERIODS, 2, 0); 869 _snd_pcm_hw_param_min(sparams, SNDRV_PCM_HW_PARAM_PERIODS, 2, 0);
869 snd_mask_none(&mask); 870 snd_mask_none(&mask);
870 if (atomic_read(&substream->mmap_count)) 871 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);
872 else { 873 else {
873 snd_mask_set(&mask, SNDRV_PCM_ACCESS_RW_INTERLEAVED); 874 snd_mask_set(&mask, (__force int)SNDRV_PCM_ACCESS_RW_INTERLEAVED);
874 if (!direct) 875 if (!direct)
875 snd_mask_set(&mask, SNDRV_PCM_ACCESS_RW_NONINTERLEAVED); 876 snd_mask_set(&mask, (__force int)SNDRV_PCM_ACCESS_RW_NONINTERLEAVED);
876 } 877 }
877 err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); 878 err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask);
878 if (err < 0) { 879 if (err < 0) {
@@ -891,19 +892,22 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
891 else 892 else
892 sformat = snd_pcm_plug_slave_format(format, &sformat_mask); 893 sformat = snd_pcm_plug_slave_format(format, &sformat_mask);
893 894
894 if (sformat < 0 || !snd_mask_test(&sformat_mask, sformat)) { 895 if ((__force int)sformat < 0 ||
895 for (sformat = 0; sformat <= SNDRV_PCM_FORMAT_LAST; sformat++) { 896 !snd_mask_test(&sformat_mask, (__force int)sformat)) {
896 if (snd_mask_test(&sformat_mask, 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) &&
897 snd_pcm_oss_format_to(sformat) >= 0) 901 snd_pcm_oss_format_to(sformat) >= 0)
898 break; 902 break;
899 } 903 }
900 if (sformat > SNDRV_PCM_FORMAT_LAST) { 904 if ((__force int)sformat > (__force int)SNDRV_PCM_FORMAT_LAST) {
901 snd_printd("Cannot find a format!!!\n"); 905 snd_printd("Cannot find a format!!!\n");
902 err = -EINVAL; 906 err = -EINVAL;
903 goto failure; 907 goto failure;
904 } 908 }
905 } 909 }
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);
907 if (err < 0) 911 if (err < 0)
908 goto failure; 912 goto failure;
909 913
@@ -912,9 +916,9 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
912 } else { 916 } else {
913 _snd_pcm_hw_params_any(params); 917 _snd_pcm_hw_params_any(params);
914 _snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_ACCESS, 918 _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);
916 _snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_FORMAT, 920 _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);
918 _snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_CHANNELS, 922 _snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_CHANNELS,
919 runtime->oss.channels, 0); 923 runtime->oss.channels, 0);
920 _snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_RATE, 924 _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
1185 if (in_kernel) { 1189 if (in_kernel) {
1186 mm_segment_t fs; 1190 mm_segment_t fs;
1187 fs = snd_enter_user(); 1191 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);
1189 snd_leave_user(fs); 1193 snd_leave_user(fs);
1190 } else { 1194 } else {
1191 ret = snd_pcm_lib_write(substream, (void __user *)ptr, frames); 1195 ret = snd_pcm_lib_write(substream, (void __force __user *)ptr, frames);
1192 } 1196 }
1193 if (ret != -EPIPE && ret != -ESTRPIPE) 1197 if (ret != -EPIPE && ret != -ESTRPIPE)
1194 break; 1198 break;
@@ -1230,10 +1234,10 @@ snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *p
1230 if (in_kernel) { 1234 if (in_kernel) {
1231 mm_segment_t fs; 1235 mm_segment_t fs;
1232 fs = snd_enter_user(); 1236 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);
1234 snd_leave_user(fs); 1238 snd_leave_user(fs);
1235 } else { 1239 } else {
1236 ret = snd_pcm_lib_read(substream, (void __user *)ptr, frames); 1240 ret = snd_pcm_lib_read(substream, (void __force __user *)ptr, frames);
1237 } 1241 }
1238 if (ret == -EPIPE) { 1242 if (ret == -EPIPE) {
1239 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { 1243 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
1333 struct snd_pcm_plugin_channel *channels; 1337 struct snd_pcm_plugin_channel *channels;
1334 size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_format.channels) / 8; 1338 size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_format.channels) / 8;
1335 if (!in_kernel) { 1339 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))
1337 return -EFAULT; 1341 return -EFAULT;
1338 buf = runtime->oss.buffer; 1342 buf = runtime->oss.buffer;
1339 } 1343 }
@@ -1429,7 +1433,7 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf,
1429 struct snd_pcm_runtime *runtime = substream->runtime; 1433 struct snd_pcm_runtime *runtime = substream->runtime;
1430 snd_pcm_sframes_t frames, frames1; 1434 snd_pcm_sframes_t frames, frames1;
1431#ifdef CONFIG_SND_PCM_OSS_PLUGINS 1435#ifdef CONFIG_SND_PCM_OSS_PLUGINS
1432 char __user *final_dst = (char __user *)buf; 1436 char __user *final_dst = (char __force __user *)buf;
1433 if (runtime->oss.plugin_first) { 1437 if (runtime->oss.plugin_first) {
1434 struct snd_pcm_plugin_channel *channels; 1438 struct snd_pcm_plugin_channel *channels;
1435 size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_format.channels) / 8; 1439 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)
1549{ 1553{
1550 struct snd_pcm_runtime *runtime; 1554 struct snd_pcm_runtime *runtime;
1551 ssize_t result = 0; 1555 ssize_t result = 0;
1556 snd_pcm_state_t state;
1552 long res; 1557 long res;
1553 wait_queue_t wait; 1558 wait_queue_t wait;
1554 1559
@@ -1570,9 +1575,9 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
1570 result = 0; 1575 result = 0;
1571 set_current_state(TASK_INTERRUPTIBLE); 1576 set_current_state(TASK_INTERRUPTIBLE);
1572 snd_pcm_stream_lock_irq(substream); 1577 snd_pcm_stream_lock_irq(substream);
1573 res = runtime->status->state; 1578 state = runtime->status->state;
1574 snd_pcm_stream_unlock_irq(substream); 1579 snd_pcm_stream_unlock_irq(substream);
1575 if (res != SNDRV_PCM_STATE_RUNNING) { 1580 if (state != SNDRV_PCM_STATE_RUNNING) {
1576 set_current_state(TASK_RUNNING); 1581 set_current_state(TASK_RUNNING);
1577 break; 1582 break;
1578 } 1583 }
@@ -1658,7 +1663,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
1658 size1); 1663 size1);
1659 size1 /= runtime->channels; /* frames */ 1664 size1 /= runtime->channels; /* frames */
1660 fs = snd_enter_user(); 1665 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);
1662 snd_leave_user(fs); 1667 snd_leave_user(fs);
1663 } 1668 }
1664 } else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) { 1669 } else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) {
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index 6751daa3bb50..71cc3ddf5c15 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -264,7 +264,7 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc
264 return frames; 264 return frames;
265} 265}
266 266
267static int snd_pcm_plug_formats(struct snd_mask *mask, int format) 267static int snd_pcm_plug_formats(struct snd_mask *mask, snd_pcm_format_t format)
268{ 268{
269 struct snd_mask formats = *mask; 269 struct snd_mask formats = *mask;
270 u64 linfmts = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S8 | 270 u64 linfmts = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S8 |
@@ -276,16 +276,16 @@ static int snd_pcm_plug_formats(struct snd_mask *mask, int format)
276 SNDRV_PCM_FMTBIT_U24_3BE | SNDRV_PCM_FMTBIT_S24_3BE | 276 SNDRV_PCM_FMTBIT_U24_3BE | SNDRV_PCM_FMTBIT_S24_3BE |
277 SNDRV_PCM_FMTBIT_U32_LE | SNDRV_PCM_FMTBIT_S32_LE | 277 SNDRV_PCM_FMTBIT_U32_LE | SNDRV_PCM_FMTBIT_S32_LE |
278 SNDRV_PCM_FMTBIT_U32_BE | SNDRV_PCM_FMTBIT_S32_BE); 278 SNDRV_PCM_FMTBIT_U32_BE | SNDRV_PCM_FMTBIT_S32_BE);
279 snd_mask_set(&formats, SNDRV_PCM_FORMAT_MU_LAW); 279 snd_mask_set(&formats, (__force int)SNDRV_PCM_FORMAT_MU_LAW);
280 280
281 if (formats.bits[0] & (u32)linfmts) 281 if (formats.bits[0] & (u32)linfmts)
282 formats.bits[0] |= (u32)linfmts; 282 formats.bits[0] |= (u32)linfmts;
283 if (formats.bits[1] & (u32)(linfmts >> 32)) 283 if (formats.bits[1] & (u32)(linfmts >> 32))
284 formats.bits[1] |= (u32)(linfmts >> 32); 284 formats.bits[1] |= (u32)(linfmts >> 32);
285 return snd_mask_test(&formats, format); 285 return snd_mask_test(&formats, (__force int)format);
286} 286}
287 287
288static int preferred_formats[] = { 288static snd_pcm_format_t preferred_formats[] = {
289 SNDRV_PCM_FORMAT_S16_LE, 289 SNDRV_PCM_FORMAT_S16_LE,
290 SNDRV_PCM_FORMAT_S16_BE, 290 SNDRV_PCM_FORMAT_S16_BE,
291 SNDRV_PCM_FORMAT_U16_LE, 291 SNDRV_PCM_FORMAT_U16_LE,
@@ -306,24 +306,25 @@ static int preferred_formats[] = {
306 SNDRV_PCM_FORMAT_U8 306 SNDRV_PCM_FORMAT_U8
307}; 307};
308 308
309int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask) 309snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format,
310 struct snd_mask *format_mask)
310{ 311{
311 int i; 312 int i;
312 313
313 if (snd_mask_test(format_mask, format)) 314 if (snd_mask_test(format_mask, (__force int)format))
314 return format; 315 return format;
315 if (! snd_pcm_plug_formats(format_mask, format)) 316 if (!snd_pcm_plug_formats(format_mask, format))
316 return -EINVAL; 317 return (__force snd_pcm_format_t)-EINVAL;
317 if (snd_pcm_format_linear(format)) { 318 if (snd_pcm_format_linear(format)) {
318 unsigned int width = snd_pcm_format_width(format); 319 unsigned int width = snd_pcm_format_width(format);
319 int unsignd = snd_pcm_format_unsigned(format) > 0; 320 int unsignd = snd_pcm_format_unsigned(format) > 0;
320 int big = snd_pcm_format_big_endian(format) > 0; 321 int big = snd_pcm_format_big_endian(format) > 0;
321 unsigned int badness, best = -1; 322 unsigned int badness, best = -1;
322 int best_format = -1; 323 snd_pcm_format_t best_format = (__force snd_pcm_format_t)-1;
323 for (i = 0; i < ARRAY_SIZE(preferred_formats); i++) { 324 for (i = 0; i < ARRAY_SIZE(preferred_formats); i++) {
324 int f = preferred_formats[i]; 325 snd_pcm_format_t f = preferred_formats[i];
325 unsigned int w; 326 unsigned int w;
326 if (!snd_mask_test(format_mask, f)) 327 if (!snd_mask_test(format_mask, (__force int)f))
327 continue; 328 continue;
328 w = snd_pcm_format_width(f); 329 w = snd_pcm_format_width(f);
329 if (w >= width) 330 if (w >= width)
@@ -337,17 +338,20 @@ int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask)
337 best = badness; 338 best = badness;
338 } 339 }
339 } 340 }
340 return best_format >= 0 ? best_format : -EINVAL; 341 if ((__force int)best_format >= 0)
342 return best_format;
343 else
344 return (__force snd_pcm_format_t)-EINVAL;
341 } else { 345 } else {
342 switch (format) { 346 switch (format) {
343 case SNDRV_PCM_FORMAT_MU_LAW: 347 case SNDRV_PCM_FORMAT_MU_LAW:
344 for (i = 0; i < ARRAY_SIZE(preferred_formats); ++i) { 348 for (i = 0; i < ARRAY_SIZE(preferred_formats); ++i) {
345 int format1 = preferred_formats[i]; 349 snd_pcm_format_t format1 = preferred_formats[i];
346 if (snd_mask_test(format_mask, format1)) 350 if (snd_mask_test(format_mask, (__force int)format1))
347 return format1; 351 return format1;
348 } 352 }
349 default: 353 default:
350 return -EINVAL; 354 return (__force snd_pcm_format_t)-EINVAL;
351 } 355 }
352 } 356 }
353} 357}
@@ -359,7 +363,7 @@ int snd_pcm_plug_format_plugins(struct snd_pcm_substream *plug,
359 struct snd_pcm_plugin_format tmpformat; 363 struct snd_pcm_plugin_format tmpformat;
360 struct snd_pcm_plugin_format dstformat; 364 struct snd_pcm_plugin_format dstformat;
361 struct snd_pcm_plugin_format srcformat; 365 struct snd_pcm_plugin_format srcformat;
362 int src_access, dst_access; 366 snd_pcm_access_t src_access, dst_access;
363 struct snd_pcm_plugin *plugin = NULL; 367 struct snd_pcm_plugin *plugin = NULL;
364 int err; 368 int err;
365 int stream = snd_pcm_plug_stream(plug); 369 int stream = snd_pcm_plug_stream(plug);
@@ -641,7 +645,7 @@ snd_pcm_sframes_t snd_pcm_plug_read_transfer(struct snd_pcm_substream *plug, str
641} 645}
642 646
643int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_area, size_t dst_offset, 647int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_area, size_t dst_offset,
644 size_t samples, int format) 648 size_t samples, snd_pcm_format_t format)
645{ 649{
646 /* FIXME: sub byte resolution and odd dst_offset */ 650 /* FIXME: sub byte resolution and odd dst_offset */
647 unsigned char *dst; 651 unsigned char *dst;
@@ -688,7 +692,7 @@ int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_area, size_t dst
688 692
689int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_area, size_t src_offset, 693int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_area, size_t src_offset,
690 const struct snd_pcm_channel_area *dst_area, size_t dst_offset, 694 const struct snd_pcm_channel_area *dst_area, size_t dst_offset,
691 size_t samples, int format) 695 size_t samples, snd_pcm_format_t format)
692{ 696{
693 /* FIXME: sub byte resolution and odd dst_offset */ 697 /* FIXME: sub byte resolution and odd dst_offset */
694 char *src, *dst; 698 char *src, *dst;
diff --git a/sound/core/oss/pcm_plugin.h b/sound/core/oss/pcm_plugin.h
index b9afab603711..a5035c2369a6 100644
--- a/sound/core/oss/pcm_plugin.h
+++ b/sound/core/oss/pcm_plugin.h
@@ -46,7 +46,7 @@ struct snd_pcm_plugin_channel {
46}; 46};
47 47
48struct snd_pcm_plugin_format { 48struct snd_pcm_plugin_format {
49 int format; 49 snd_pcm_format_t format;
50 unsigned int rate; 50 unsigned int rate;
51 unsigned int channels; 51 unsigned int channels;
52}; 52};
@@ -58,7 +58,7 @@ struct snd_pcm_plugin {
58 struct snd_pcm_plugin_format dst_format; /* destination format */ 58 struct snd_pcm_plugin_format dst_format; /* destination format */
59 int src_width; /* sample width in bits */ 59 int src_width; /* sample width in bits */
60 int dst_width; /* sample width in bits */ 60 int dst_width; /* sample width in bits */
61 int access; 61 snd_pcm_access_t access;
62 snd_pcm_sframes_t (*src_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t dst_frames); 62 snd_pcm_sframes_t (*src_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t dst_frames);
63 snd_pcm_sframes_t (*dst_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t src_frames); 63 snd_pcm_sframes_t (*dst_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t src_frames);
64 snd_pcm_sframes_t (*client_channels)(struct snd_pcm_plugin *plugin, 64 snd_pcm_sframes_t (*client_channels)(struct snd_pcm_plugin *plugin,
@@ -125,7 +125,8 @@ int snd_pcm_plug_format_plugins(struct snd_pcm_substream *substream,
125 struct snd_pcm_hw_params *params, 125 struct snd_pcm_hw_params *params,
126 struct snd_pcm_hw_params *slave_params); 126 struct snd_pcm_hw_params *slave_params);
127 127
128int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask); 128snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format,
129 struct snd_mask *format_mask);
129 130
130int snd_pcm_plugin_append(struct snd_pcm_plugin *plugin); 131int snd_pcm_plugin_append(struct snd_pcm_plugin *plugin);
131 132
@@ -146,12 +147,12 @@ snd_pcm_sframes_t snd_pcm_plugin_client_channels(struct snd_pcm_plugin *plugin,
146 147
147int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_channel, 148int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_channel,
148 size_t dst_offset, 149 size_t dst_offset,
149 size_t samples, int format); 150 size_t samples, snd_pcm_format_t format);
150int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_channel, 151int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_channel,
151 size_t src_offset, 152 size_t src_offset,
152 const struct snd_pcm_channel_area *dst_channel, 153 const struct snd_pcm_channel_area *dst_channel,
153 size_t dst_offset, 154 size_t dst_offset,
154 size_t samples, int format); 155 size_t samples, snd_pcm_format_t format);
155 156
156void *snd_pcm_plug_buf_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t size); 157void *snd_pcm_plug_buf_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t size);
157void snd_pcm_plug_buf_unlock(struct snd_pcm_substream *plug, void *ptr); 158void snd_pcm_plug_buf_unlock(struct snd_pcm_substream *plug, void *ptr);
diff --git a/sound/core/oss/route.c b/sound/core/oss/route.c
index bbe25d8c450a..c8171f5783c8 100644
--- a/sound/core/oss/route.c
+++ b/sound/core/oss/route.c
@@ -25,7 +25,7 @@
25#include "pcm_plugin.h" 25#include "pcm_plugin.h"
26 26
27static void zero_areas(struct snd_pcm_plugin_channel *dvp, int ndsts, 27static void zero_areas(struct snd_pcm_plugin_channel *dvp, int ndsts,
28 snd_pcm_uframes_t frames, int format) 28 snd_pcm_uframes_t frames, snd_pcm_format_t format)
29{ 29{
30 int dst = 0; 30 int dst = 0;
31 for (; dst < ndsts; ++dst) { 31 for (; dst < ndsts; ++dst) {
@@ -38,7 +38,7 @@ static void zero_areas(struct snd_pcm_plugin_channel *dvp, int ndsts,
38 38
39static inline void copy_area(const struct snd_pcm_plugin_channel *src_channel, 39static inline void copy_area(const struct snd_pcm_plugin_channel *src_channel,
40 struct snd_pcm_plugin_channel *dst_channel, 40 struct snd_pcm_plugin_channel *dst_channel,
41 snd_pcm_uframes_t frames, int format) 41 snd_pcm_uframes_t frames, snd_pcm_format_t format)
42{ 42{
43 dst_channel->enabled = 1; 43 dst_channel->enabled = 1;
44 snd_pcm_area_copy(&src_channel->area, 0, &dst_channel->area, 0, frames, format); 44 snd_pcm_area_copy(&src_channel->area, 0, &dst_channel->area, 0, frames, format);
@@ -51,7 +51,7 @@ static snd_pcm_sframes_t route_transfer(struct snd_pcm_plugin *plugin,
51{ 51{
52 int nsrcs, ndsts, dst; 52 int nsrcs, ndsts, dst;
53 struct snd_pcm_plugin_channel *dvp; 53 struct snd_pcm_plugin_channel *dvp;
54 int format; 54 snd_pcm_format_t format;
55 55
56 if (snd_BUG_ON(!plugin || !src_channels || !dst_channels)) 56 if (snd_BUG_ON(!plugin || !src_channels || !dst_channels))
57 return -ENXIO; 57 return -ENXIO;
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 6b4b1287b314..ee9abb2d9001 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -211,9 +211,9 @@ static char *snd_pcm_format_names[] = {
211 211
212const char *snd_pcm_format_name(snd_pcm_format_t format) 212const char *snd_pcm_format_name(snd_pcm_format_t format)
213{ 213{
214 if (format >= ARRAY_SIZE(snd_pcm_format_names)) 214 if ((__force unsigned int)format >= ARRAY_SIZE(snd_pcm_format_names))
215 return "Unknown"; 215 return "Unknown";
216 return snd_pcm_format_names[format]; 216 return snd_pcm_format_names[(__force unsigned int)format];
217} 217}
218EXPORT_SYMBOL_GPL(snd_pcm_format_name); 218EXPORT_SYMBOL_GPL(snd_pcm_format_name);
219 219
@@ -269,12 +269,12 @@ static const char *snd_pcm_stream_name(int stream)
269 269
270static const char *snd_pcm_access_name(snd_pcm_access_t access) 270static const char *snd_pcm_access_name(snd_pcm_access_t access)
271{ 271{
272 return snd_pcm_access_names[access]; 272 return snd_pcm_access_names[(__force int)access];
273} 273}
274 274
275static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat) 275static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
276{ 276{
277 return snd_pcm_subformat_names[subformat]; 277 return snd_pcm_subformat_names[(__force int)subformat];
278} 278}
279 279
280static const char *snd_pcm_tstamp_mode_name(int mode) 280static const char *snd_pcm_tstamp_mode_name(int mode)
@@ -284,7 +284,7 @@ static const char *snd_pcm_tstamp_mode_name(int mode)
284 284
285static const char *snd_pcm_state_name(snd_pcm_state_t state) 285static const char *snd_pcm_state_name(snd_pcm_state_t state)
286{ 286{
287 return snd_pcm_state_names[state]; 287 return snd_pcm_state_names[(__force int)state];
288} 288}
289 289
290#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 290#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
index 434af3c56d52..88f02e3866e0 100644
--- a/sound/core/pcm_misc.c
+++ b/sound/core/pcm_misc.c
@@ -35,7 +35,10 @@ struct pcm_format_data {
35 unsigned char silence[8]; /* silence data to fill */ 35 unsigned char silence[8]; /* silence data to fill */
36}; 36};
37 37
38static struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = { 38/* we do lots of calculations on snd_pcm_format_t; shut up sparse */
39#define INT __force int
40
41static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
39 [SNDRV_PCM_FORMAT_S8] = { 42 [SNDRV_PCM_FORMAT_S8] = {
40 .width = 8, .phys = 8, .le = -1, .signd = 1, 43 .width = 8, .phys = 8, .le = -1, .signd = 1,
41 .silence = {}, 44 .silence = {},
@@ -215,9 +218,9 @@ static struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = {
215int snd_pcm_format_signed(snd_pcm_format_t format) 218int snd_pcm_format_signed(snd_pcm_format_t format)
216{ 219{
217 int val; 220 int val;
218 if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) 221 if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
219 return -EINVAL; 222 return -EINVAL;
220 if ((val = pcm_formats[format].signd) < 0) 223 if ((val = pcm_formats[(INT)format].signd) < 0)
221 return -EINVAL; 224 return -EINVAL;
222 return val; 225 return val;
223} 226}
@@ -266,9 +269,9 @@ EXPORT_SYMBOL(snd_pcm_format_linear);
266int snd_pcm_format_little_endian(snd_pcm_format_t format) 269int snd_pcm_format_little_endian(snd_pcm_format_t format)
267{ 270{
268 int val; 271 int val;
269 if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) 272 if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
270 return -EINVAL; 273 return -EINVAL;
271 if ((val = pcm_formats[format].le) < 0) 274 if ((val = pcm_formats[(INT)format].le) < 0)
272 return -EINVAL; 275 return -EINVAL;
273 return val; 276 return val;
274} 277}
@@ -304,9 +307,9 @@ EXPORT_SYMBOL(snd_pcm_format_big_endian);
304int snd_pcm_format_width(snd_pcm_format_t format) 307int snd_pcm_format_width(snd_pcm_format_t format)
305{ 308{
306 int val; 309 int val;
307 if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) 310 if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
308 return -EINVAL; 311 return -EINVAL;
309 if ((val = pcm_formats[format].width) == 0) 312 if ((val = pcm_formats[(INT)format].width) == 0)
310 return -EINVAL; 313 return -EINVAL;
311 return val; 314 return val;
312} 315}
@@ -323,9 +326,9 @@ EXPORT_SYMBOL(snd_pcm_format_width);
323int snd_pcm_format_physical_width(snd_pcm_format_t format) 326int snd_pcm_format_physical_width(snd_pcm_format_t format)
324{ 327{
325 int val; 328 int val;
326 if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) 329 if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
327 return -EINVAL; 330 return -EINVAL;
328 if ((val = pcm_formats[format].phys) == 0) 331 if ((val = pcm_formats[(INT)format].phys) == 0)
329 return -EINVAL; 332 return -EINVAL;
330 return val; 333 return val;
331} 334}
@@ -358,11 +361,11 @@ EXPORT_SYMBOL(snd_pcm_format_size);
358 */ 361 */
359const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format) 362const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format)
360{ 363{
361 if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) 364 if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
362 return NULL; 365 return NULL;
363 if (! pcm_formats[format].phys) 366 if (! pcm_formats[(INT)format].phys)
364 return NULL; 367 return NULL;
365 return pcm_formats[format].silence; 368 return pcm_formats[(INT)format].silence;
366} 369}
367 370
368EXPORT_SYMBOL(snd_pcm_format_silence_64); 371EXPORT_SYMBOL(snd_pcm_format_silence_64);
@@ -382,16 +385,16 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
382 int width; 385 int width;
383 unsigned char *dst, *pat; 386 unsigned char *dst, *pat;
384 387
385 if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) 388 if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
386 return -EINVAL; 389 return -EINVAL;
387 if (samples == 0) 390 if (samples == 0)
388 return 0; 391 return 0;
389 width = pcm_formats[format].phys; /* physical width */ 392 width = pcm_formats[(INT)format].phys; /* physical width */
390 pat = pcm_formats[format].silence; 393 pat = pcm_formats[(INT)format].silence;
391 if (! width) 394 if (! width)
392 return -EINVAL; 395 return -EINVAL;
393 /* signed or 1 byte data */ 396 /* signed or 1 byte data */
394 if (pcm_formats[format].signd == 1 || width <= 8) { 397 if (pcm_formats[(INT)format].signd == 1 || width <= 8) {
395 unsigned int bytes = samples * width / 8; 398 unsigned int bytes = samples * width / 8;
396 memset(data, *pat, bytes); 399 memset(data, *pat, bytes);
397 return 0; 400 return 0;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 4be45e7be8ad..ae42b6509ce4 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -941,7 +941,7 @@ static struct action_ops snd_pcm_action_stop = {
941 * 941 *
942 * The state of each stream is then changed to the given state unconditionally. 942 * The state of each stream is then changed to the given state unconditionally.
943 */ 943 */
944int snd_pcm_stop(struct snd_pcm_substream *substream, int state) 944int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t state)
945{ 945{
946 return snd_pcm_action(&snd_pcm_action_stop, substream, state); 946 return snd_pcm_action(&snd_pcm_action_stop, substream, state);
947} 947}
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 99a485f13648..f2436d33fbf7 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1052,7 +1052,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
1052 } else { 1052 } else {
1053#ifdef CONFIG_COMPAT 1053#ifdef CONFIG_COMPAT
1054 if (client->convert32 && snd_seq_ev_is_varusr(&event)) { 1054 if (client->convert32 && snd_seq_ev_is_varusr(&event)) {
1055 void *ptr = compat_ptr(event.data.raw32.d[1]); 1055 void *ptr = (void __force *)compat_ptr(event.data.raw32.d[1]);
1056 event.data.ext.ptr = ptr; 1056 event.data.ext.ptr = ptr;
1057 } 1057 }
1058#endif 1058#endif
@@ -2407,7 +2407,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
2407 if (client == NULL) 2407 if (client == NULL)
2408 return -ENXIO; 2408 return -ENXIO;
2409 fs = snd_enter_user(); 2409 fs = snd_enter_user();
2410 result = snd_seq_do_ioctl(client, cmd, (void __user *)arg); 2410 result = snd_seq_do_ioctl(client, cmd, (void __force __user *)arg);
2411 snd_leave_user(fs); 2411 snd_leave_user(fs);
2412 return result; 2412 return result;
2413} 2413}
@@ -2497,9 +2497,6 @@ static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer,
2497} 2497}
2498 2498
2499 2499
2500void snd_seq_info_pool(struct snd_info_buffer *buffer,
2501 struct snd_seq_pool *pool, char *space);
2502
2503/* exported to seq_info.c */ 2500/* exported to seq_info.c */
2504void snd_seq_info_clients_read(struct snd_info_entry *entry, 2501void snd_seq_info_clients_read(struct snd_info_entry *entry,
2505 struct snd_info_buffer *buffer) 2502 struct snd_info_buffer *buffer)
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 7fb55436287f..7f50c1437675 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -86,7 +86,7 @@ int snd_seq_dump_var_event(const struct snd_seq_event *event,
86 86
87 if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) { 87 if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
88 char buf[32]; 88 char buf[32];
89 char __user *curptr = (char __user *)event->data.ext.ptr; 89 char __user *curptr = (char __force __user *)event->data.ext.ptr;
90 while (len > 0) { 90 while (len > 0) {
91 int size = sizeof(buf); 91 int size = sizeof(buf);
92 if (len < size) 92 if (len < size)
@@ -157,7 +157,7 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char
157 if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) { 157 if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
158 if (! in_kernel) 158 if (! in_kernel)
159 return -EINVAL; 159 return -EINVAL;
160 if (copy_from_user(buf, (void __user *)event->data.ext.ptr, len)) 160 if (copy_from_user(buf, (void __force __user *)event->data.ext.ptr, len))
161 return -EFAULT; 161 return -EFAULT;
162 return newlen; 162 return newlen;
163 } 163 }
@@ -343,7 +343,7 @@ int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
343 tmp->event = src->event; 343 tmp->event = src->event;
344 src = src->next; 344 src = src->next;
345 } else if (is_usrptr) { 345 } else if (is_usrptr) {
346 if (copy_from_user(&tmp->event, (char __user *)buf, size)) { 346 if (copy_from_user(&tmp->event, (char __force __user *)buf, size)) {
347 err = -EFAULT; 347 err = -EFAULT;
348 goto __error; 348 goto __error;
349 } 349 }
diff --git a/sound/core/seq/seq_memory.h b/sound/core/seq/seq_memory.h
index 63e91431a29f..4a2ec779b8a7 100644
--- a/sound/core/seq/seq_memory.h
+++ b/sound/core/seq/seq_memory.h
@@ -24,6 +24,8 @@
24#include <sound/seq_kernel.h> 24#include <sound/seq_kernel.h>
25#include <linux/poll.h> 25#include <linux/poll.h>
26 26
27struct snd_info_buffer;
28
27/* container for sequencer event (internal use) */ 29/* container for sequencer event (internal use) */
28struct snd_seq_event_cell { 30struct snd_seq_event_cell {
29 struct snd_seq_event event; 31 struct snd_seq_event event;
@@ -99,5 +101,7 @@ void snd_sequencer_memory_done(void);
99/* polling */ 101/* polling */
100int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait); 102int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait);
101 103
104void snd_seq_info_pool(struct snd_info_buffer *buffer,
105 struct snd_seq_pool *pool, char *space);
102 106
103#endif 107#endif
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index 3bf7d73ac52e..e12bcd94b6db 100644
--- a/sound/core/seq/seq_ports.c
+++ b/sound/core/seq/seq_ports.c
@@ -412,7 +412,7 @@ int snd_seq_get_port_info(struct snd_seq_client_port * port,
412 * initialization or termination of devices (see seq_midi.c). 412 * initialization or termination of devices (see seq_midi.c).
413 * 413 *
414 * If callback_all option is set, the callback function is invoked 414 * If callback_all option is set, the callback function is invoked
415 * at each connnection/disconnection. 415 * at each connection/disconnection.
416 */ 416 */
417 417
418static int subscribe_port(struct snd_seq_client *client, 418static int subscribe_port(struct snd_seq_client *client,
diff --git a/sound/core/timer.c b/sound/core/timer.c
index ed016329e911..7c1cbf0a0dc4 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -186,9 +186,8 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave)
186 list_for_each_entry(master, &timer->open_list_head, open_list) { 186 list_for_each_entry(master, &timer->open_list_head, open_list) {
187 if (slave->slave_class == master->slave_class && 187 if (slave->slave_class == master->slave_class &&
188 slave->slave_id == master->slave_id) { 188 slave->slave_id == master->slave_id) {
189 list_del(&slave->open_list); 189 list_move_tail(&slave->open_list,
190 list_add_tail(&slave->open_list, 190 &master->slave_list_head);
191 &master->slave_list_head);
192 spin_lock_irq(&slave_active_lock); 191 spin_lock_irq(&slave_active_lock);
193 slave->master = master; 192 slave->master = master;
194 slave->timer = master->timer; 193 slave->timer = master->timer;
@@ -414,8 +413,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
414static int snd_timer_start1(struct snd_timer *timer, struct snd_timer_instance *timeri, 413static int snd_timer_start1(struct snd_timer *timer, struct snd_timer_instance *timeri,
415 unsigned long sticks) 414 unsigned long sticks)
416{ 415{
417 list_del(&timeri->active_list); 416 list_move_tail(&timeri->active_list, &timer->active_list_head);
418 list_add_tail(&timeri->active_list, &timer->active_list_head);
419 if (timer->running) { 417 if (timer->running) {
420 if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) 418 if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)
421 goto __start_now; 419 goto __start_now;
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c
index 3b9b550109cb..a89948ae9e8d 100644
--- a/sound/core/vmaster.c
+++ b/sound/core/vmaster.c
@@ -18,7 +18,7 @@
18 * a subset of information returned via ctl info callback 18 * a subset of information returned via ctl info callback
19 */ 19 */
20struct link_ctl_info { 20struct link_ctl_info {
21 int type; /* value type */ 21 snd_ctl_elem_type_t type; /* value type */
22 int count; /* item count */ 22 int count; /* item count */
23 int min_val, max_val; /* min, max values */ 23 int min_val, max_val; /* min, max values */
24}; 24};