aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-12-19 02:22:57 -0500
committerTakashi Iwai <tiwai@suse.de>2008-12-19 02:22:57 -0500
commit0ff555192a8d20385d49d1c420e2e8d409b3c0da (patch)
treeb6e4b6cae1028a310a3488ebf745954c51694bfc /sound/core
parent3218c178b41b420cb7e0d120c7a137a3969242e5 (diff)
parent9e43f0de690211cf7153b5f3ec251bc315647ada (diff)
Merge branch 'fix/hda' into topic/hda
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/control.c8
-rw-r--r--sound/core/init.c11
-rw-r--r--sound/core/jack.c3
-rw-r--r--sound/core/memalloc.c48
-rw-r--r--sound/core/oss/pcm_oss.c2
-rw-r--r--sound/core/pcm_lib.c48
-rw-r--r--sound/core/pcm_misc.c1
-rw-r--r--sound/core/pcm_native.c25
-rw-r--r--sound/core/rawmidi.c8
-rw-r--r--sound/core/sound.c5
-rw-r--r--sound/core/timer.c1
11 files changed, 61 insertions, 99 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 6d71f9a7ccbb..636b3b52ef8b 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -113,7 +113,6 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
113 unsigned int idx; 113 unsigned int idx;
114 114
115 ctl = file->private_data; 115 ctl = file->private_data;
116 fasync_helper(-1, file, 0, &ctl->fasync);
117 file->private_data = NULL; 116 file->private_data = NULL;
118 card = ctl->card; 117 card = ctl->card;
119 write_lock_irqsave(&card->ctl_files_rwlock, flags); 118 write_lock_irqsave(&card->ctl_files_rwlock, flags);
@@ -225,8 +224,13 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
225 kctl.id.iface = ncontrol->iface; 224 kctl.id.iface = ncontrol->iface;
226 kctl.id.device = ncontrol->device; 225 kctl.id.device = ncontrol->device;
227 kctl.id.subdevice = ncontrol->subdevice; 226 kctl.id.subdevice = ncontrol->subdevice;
228 if (ncontrol->name) 227 if (ncontrol->name) {
229 strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name)); 228 strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name));
229 if (strcmp(ncontrol->name, kctl.id.name) != 0)
230 snd_printk(KERN_WARNING
231 "Control name '%s' truncated to '%s'\n",
232 ncontrol->name, kctl.id.name);
233 }
230 kctl.id.index = ncontrol->index; 234 kctl.id.index = ncontrol->index;
231 kctl.count = ncontrol->count ? ncontrol->count : 1; 235 kctl.count = ncontrol->count ? ncontrol->count : 1;
232 access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : 236 access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :
diff --git a/sound/core/init.c b/sound/core/init.c
index 8af467df9245..b47ff8b44be8 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -264,8 +264,11 @@ static int snd_disconnect_release(struct inode *inode, struct file *file)
264 } 264 }
265 spin_unlock(&shutdown_lock); 265 spin_unlock(&shutdown_lock);
266 266
267 if (likely(df)) 267 if (likely(df)) {
268 if ((file->f_flags & FASYNC) && df->disconnected_f_op->fasync)
269 df->disconnected_f_op->fasync(-1, file, 0);
268 return df->disconnected_f_op->release(inode, file); 270 return df->disconnected_f_op->release(inode, file);
271 }
269 272
270 panic("%s(%p, %p) failed!", __func__, inode, file); 273 panic("%s(%p, %p) failed!", __func__, inode, file);
271} 274}
@@ -549,9 +552,9 @@ int snd_card_register(struct snd_card *card)
549 return -EINVAL; 552 return -EINVAL;
550#ifndef CONFIG_SYSFS_DEPRECATED 553#ifndef CONFIG_SYSFS_DEPRECATED
551 if (!card->card_dev) { 554 if (!card->card_dev) {
552 card->card_dev = device_create_drvdata(sound_class, card->dev, 555 card->card_dev = device_create(sound_class, card->dev,
553 MKDEV(0, 0), NULL, 556 MKDEV(0, 0), NULL,
554 "card%i", card->number); 557 "card%i", card->number);
555 if (IS_ERR(card->card_dev)) 558 if (IS_ERR(card->card_dev))
556 card->card_dev = NULL; 559 card->card_dev = NULL;
557 } 560 }
diff --git a/sound/core/jack.c b/sound/core/jack.c
index 438445f77d6d..284432f427f4 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -151,6 +151,9 @@ EXPORT_SYMBOL(snd_jack_set_parent);
151 */ 151 */
152void snd_jack_report(struct snd_jack *jack, int status) 152void snd_jack_report(struct snd_jack *jack, int status)
153{ 153{
154 if (!jack)
155 return;
156
154 if (jack->type & SND_JACK_HEADPHONE) 157 if (jack->type & SND_JACK_HEADPHONE)
155 input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT, 158 input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT,
156 status & SND_JACK_HEADPHONE); 159 status & SND_JACK_HEADPHONE);
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index a7b46ec72f32..1b3534d67686 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -33,9 +33,6 @@
33#include <linux/moduleparam.h> 33#include <linux/moduleparam.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <sound/memalloc.h> 35#include <sound/memalloc.h>
36#ifdef CONFIG_SBUS
37#include <asm/sbus.h>
38#endif
39 36
40 37
41MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>"); 38MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>");
@@ -162,39 +159,6 @@ static void snd_free_dev_pages(struct device *dev, size_t size, void *ptr,
162} 159}
163#endif /* CONFIG_HAS_DMA */ 160#endif /* CONFIG_HAS_DMA */
164 161
165#ifdef CONFIG_SBUS
166
167static void *snd_malloc_sbus_pages(struct device *dev, size_t size,
168 dma_addr_t *dma_addr)
169{
170 struct sbus_dev *sdev = (struct sbus_dev *)dev;
171 int pg;
172 void *res;
173
174 if (WARN_ON(!dma_addr))
175 return NULL;
176 pg = get_order(size);
177 res = sbus_alloc_consistent(sdev, PAGE_SIZE * (1 << pg), dma_addr);
178 if (res != NULL)
179 inc_snd_pages(pg);
180 return res;
181}
182
183static void snd_free_sbus_pages(struct device *dev, size_t size,
184 void *ptr, dma_addr_t dma_addr)
185{
186 struct sbus_dev *sdev = (struct sbus_dev *)dev;
187 int pg;
188
189 if (ptr == NULL)
190 return;
191 pg = get_order(size);
192 dec_snd_pages(pg);
193 sbus_free_consistent(sdev, PAGE_SIZE * (1 << pg), ptr, dma_addr);
194}
195
196#endif /* CONFIG_SBUS */
197
198/* 162/*
199 * 163 *
200 * ALSA generic memory management 164 * ALSA generic memory management
@@ -231,11 +195,6 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
231 dmab->area = snd_malloc_pages(size, (unsigned long)device); 195 dmab->area = snd_malloc_pages(size, (unsigned long)device);
232 dmab->addr = 0; 196 dmab->addr = 0;
233 break; 197 break;
234#ifdef CONFIG_SBUS
235 case SNDRV_DMA_TYPE_SBUS:
236 dmab->area = snd_malloc_sbus_pages(device, size, &dmab->addr);
237 break;
238#endif
239#ifdef CONFIG_HAS_DMA 198#ifdef CONFIG_HAS_DMA
240 case SNDRV_DMA_TYPE_DEV: 199 case SNDRV_DMA_TYPE_DEV:
241 dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr); 200 dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr);
@@ -306,11 +265,6 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab)
306 case SNDRV_DMA_TYPE_CONTINUOUS: 265 case SNDRV_DMA_TYPE_CONTINUOUS:
307 snd_free_pages(dmab->area, dmab->bytes); 266 snd_free_pages(dmab->area, dmab->bytes);
308 break; 267 break;
309#ifdef CONFIG_SBUS
310 case SNDRV_DMA_TYPE_SBUS:
311 snd_free_sbus_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
312 break;
313#endif
314#ifdef CONFIG_HAS_DMA 268#ifdef CONFIG_HAS_DMA
315 case SNDRV_DMA_TYPE_DEV: 269 case SNDRV_DMA_TYPE_DEV:
316 snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr); 270 snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
@@ -419,7 +373,7 @@ static int snd_mem_proc_read(struct seq_file *seq, void *offset)
419 long pages = snd_allocated_pages >> (PAGE_SHIFT-12); 373 long pages = snd_allocated_pages >> (PAGE_SHIFT-12);
420 struct snd_mem_list *mem; 374 struct snd_mem_list *mem;
421 int devno; 375 int devno;
422 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; 376 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG" };
423 377
424 mutex_lock(&list_mutex); 378 mutex_lock(&list_mutex);
425 seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n", 379 seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n",
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 1af62b8b86c6..e17836680f49 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2283,7 +2283,7 @@ static int snd_pcm_oss_open_file(struct file *file,
2283 int idx, err; 2283 int idx, err;
2284 struct snd_pcm_oss_file *pcm_oss_file; 2284 struct snd_pcm_oss_file *pcm_oss_file;
2285 struct snd_pcm_substream *substream; 2285 struct snd_pcm_substream *substream;
2286 unsigned int f_mode = file->f_mode; 2286 fmode_t f_mode = file->f_mode;
2287 2287
2288 if (rpcm_oss_file) 2288 if (rpcm_oss_file)
2289 *rpcm_oss_file = NULL; 2289 *rpcm_oss_file = NULL;
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 6ea5cfb83998..921691080f35 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -908,12 +908,12 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond,
908EXPORT_SYMBOL(snd_pcm_hw_rule_add); 908EXPORT_SYMBOL(snd_pcm_hw_rule_add);
909 909
910/** 910/**
911 * snd_pcm_hw_constraint_mask 911 * snd_pcm_hw_constraint_mask - apply the given bitmap mask constraint
912 * @runtime: PCM runtime instance 912 * @runtime: PCM runtime instance
913 * @var: hw_params variable to apply the mask 913 * @var: hw_params variable to apply the mask
914 * @mask: the bitmap mask 914 * @mask: the bitmap mask
915 * 915 *
916 * Apply the constraint of the given bitmap mask to a mask parameter. 916 * Apply the constraint of the given bitmap mask to a 32-bit mask parameter.
917 */ 917 */
918int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, 918int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
919 u_int32_t mask) 919 u_int32_t mask)
@@ -928,12 +928,12 @@ int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param
928} 928}
929 929
930/** 930/**
931 * snd_pcm_hw_constraint_mask64 931 * snd_pcm_hw_constraint_mask64 - apply the given bitmap mask constraint
932 * @runtime: PCM runtime instance 932 * @runtime: PCM runtime instance
933 * @var: hw_params variable to apply the mask 933 * @var: hw_params variable to apply the mask
934 * @mask: the 64bit bitmap mask 934 * @mask: the 64bit bitmap mask
935 * 935 *
936 * Apply the constraint of the given bitmap mask to a mask parameter. 936 * Apply the constraint of the given bitmap mask to a 64-bit mask parameter.
937 */ 937 */
938int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, 938int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
939 u_int64_t mask) 939 u_int64_t mask)
@@ -949,7 +949,7 @@ int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_par
949} 949}
950 950
951/** 951/**
952 * snd_pcm_hw_constraint_integer 952 * snd_pcm_hw_constraint_integer - apply an integer constraint to an interval
953 * @runtime: PCM runtime instance 953 * @runtime: PCM runtime instance
954 * @var: hw_params variable to apply the integer constraint 954 * @var: hw_params variable to apply the integer constraint
955 * 955 *
@@ -964,7 +964,7 @@ int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_pa
964EXPORT_SYMBOL(snd_pcm_hw_constraint_integer); 964EXPORT_SYMBOL(snd_pcm_hw_constraint_integer);
965 965
966/** 966/**
967 * snd_pcm_hw_constraint_minmax 967 * snd_pcm_hw_constraint_minmax - apply a min/max range constraint to an interval
968 * @runtime: PCM runtime instance 968 * @runtime: PCM runtime instance
969 * @var: hw_params variable to apply the range 969 * @var: hw_params variable to apply the range
970 * @min: the minimal value 970 * @min: the minimal value
@@ -995,7 +995,7 @@ static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params,
995 995
996 996
997/** 997/**
998 * snd_pcm_hw_constraint_list 998 * snd_pcm_hw_constraint_list - apply a list of constraints to a parameter
999 * @runtime: PCM runtime instance 999 * @runtime: PCM runtime instance
1000 * @cond: condition bits 1000 * @cond: condition bits
1001 * @var: hw_params variable to apply the list constraint 1001 * @var: hw_params variable to apply the list constraint
@@ -1031,7 +1031,7 @@ static int snd_pcm_hw_rule_ratnums(struct snd_pcm_hw_params *params,
1031} 1031}
1032 1032
1033/** 1033/**
1034 * snd_pcm_hw_constraint_ratnums 1034 * snd_pcm_hw_constraint_ratnums - apply ratnums constraint to a parameter
1035 * @runtime: PCM runtime instance 1035 * @runtime: PCM runtime instance
1036 * @cond: condition bits 1036 * @cond: condition bits
1037 * @var: hw_params variable to apply the ratnums constraint 1037 * @var: hw_params variable to apply the ratnums constraint
@@ -1064,7 +1064,7 @@ static int snd_pcm_hw_rule_ratdens(struct snd_pcm_hw_params *params,
1064} 1064}
1065 1065
1066/** 1066/**
1067 * snd_pcm_hw_constraint_ratdens 1067 * snd_pcm_hw_constraint_ratdens - apply ratdens constraint to a parameter
1068 * @runtime: PCM runtime instance 1068 * @runtime: PCM runtime instance
1069 * @cond: condition bits 1069 * @cond: condition bits
1070 * @var: hw_params variable to apply the ratdens constraint 1070 * @var: hw_params variable to apply the ratdens constraint
@@ -1095,7 +1095,7 @@ static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params,
1095} 1095}
1096 1096
1097/** 1097/**
1098 * snd_pcm_hw_constraint_msbits 1098 * snd_pcm_hw_constraint_msbits - add a hw constraint msbits rule
1099 * @runtime: PCM runtime instance 1099 * @runtime: PCM runtime instance
1100 * @cond: condition bits 1100 * @cond: condition bits
1101 * @width: sample bits width 1101 * @width: sample bits width
@@ -1123,7 +1123,7 @@ static int snd_pcm_hw_rule_step(struct snd_pcm_hw_params *params,
1123} 1123}
1124 1124
1125/** 1125/**
1126 * snd_pcm_hw_constraint_step 1126 * snd_pcm_hw_constraint_step - add a hw constraint step rule
1127 * @runtime: PCM runtime instance 1127 * @runtime: PCM runtime instance
1128 * @cond: condition bits 1128 * @cond: condition bits
1129 * @var: hw_params variable to apply the step constraint 1129 * @var: hw_params variable to apply the step constraint
@@ -1154,7 +1154,7 @@ static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm
1154} 1154}
1155 1155
1156/** 1156/**
1157 * snd_pcm_hw_constraint_pow2 1157 * snd_pcm_hw_constraint_pow2 - add a hw constraint power-of-2 rule
1158 * @runtime: PCM runtime instance 1158 * @runtime: PCM runtime instance
1159 * @cond: condition bits 1159 * @cond: condition bits
1160 * @var: hw_params variable to apply the power-of-2 constraint 1160 * @var: hw_params variable to apply the power-of-2 constraint
@@ -1202,13 +1202,13 @@ void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params)
1202EXPORT_SYMBOL(_snd_pcm_hw_params_any); 1202EXPORT_SYMBOL(_snd_pcm_hw_params_any);
1203 1203
1204/** 1204/**
1205 * snd_pcm_hw_param_value 1205 * snd_pcm_hw_param_value - return @params field @var value
1206 * @params: the hw_params instance 1206 * @params: the hw_params instance
1207 * @var: parameter to retrieve 1207 * @var: parameter to retrieve
1208 * @dir: pointer to the direction (-1,0,1) or NULL 1208 * @dir: pointer to the direction (-1,0,1) or %NULL
1209 * 1209 *
1210 * Return the value for field PAR if it's fixed in configuration space 1210 * Return the value for field @var if it's fixed in configuration space
1211 * defined by PARAMS. Return -EINVAL otherwise 1211 * defined by @params. Return -%EINVAL otherwise.
1212 */ 1212 */
1213int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params, 1213int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params,
1214 snd_pcm_hw_param_t var, int *dir) 1214 snd_pcm_hw_param_t var, int *dir)
@@ -1271,13 +1271,13 @@ static int _snd_pcm_hw_param_first(struct snd_pcm_hw_params *params,
1271 1271
1272 1272
1273/** 1273/**
1274 * snd_pcm_hw_param_first 1274 * snd_pcm_hw_param_first - refine config space and return minimum value
1275 * @pcm: PCM instance 1275 * @pcm: PCM instance
1276 * @params: the hw_params instance 1276 * @params: the hw_params instance
1277 * @var: parameter to retrieve 1277 * @var: parameter to retrieve
1278 * @dir: pointer to the direction (-1,0,1) or NULL 1278 * @dir: pointer to the direction (-1,0,1) or %NULL
1279 * 1279 *
1280 * Inside configuration space defined by PARAMS remove from PAR all 1280 * Inside configuration space defined by @params remove from @var all
1281 * values > minimum. Reduce configuration space accordingly. 1281 * values > minimum. Reduce configuration space accordingly.
1282 * Return the minimum. 1282 * Return the minimum.
1283 */ 1283 */
@@ -1317,13 +1317,13 @@ static int _snd_pcm_hw_param_last(struct snd_pcm_hw_params *params,
1317 1317
1318 1318
1319/** 1319/**
1320 * snd_pcm_hw_param_last 1320 * snd_pcm_hw_param_last - refine config space and return maximum value
1321 * @pcm: PCM instance 1321 * @pcm: PCM instance
1322 * @params: the hw_params instance 1322 * @params: the hw_params instance
1323 * @var: parameter to retrieve 1323 * @var: parameter to retrieve
1324 * @dir: pointer to the direction (-1,0,1) or NULL 1324 * @dir: pointer to the direction (-1,0,1) or %NULL
1325 * 1325 *
1326 * Inside configuration space defined by PARAMS remove from PAR all 1326 * Inside configuration space defined by @params remove from @var all
1327 * values < maximum. Reduce configuration space accordingly. 1327 * values < maximum. Reduce configuration space accordingly.
1328 * Return the maximum. 1328 * Return the maximum.
1329 */ 1329 */
@@ -1345,11 +1345,11 @@ int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm,
1345EXPORT_SYMBOL(snd_pcm_hw_param_last); 1345EXPORT_SYMBOL(snd_pcm_hw_param_last);
1346 1346
1347/** 1347/**
1348 * snd_pcm_hw_param_choose 1348 * snd_pcm_hw_param_choose - choose a configuration defined by @params
1349 * @pcm: PCM instance 1349 * @pcm: PCM instance
1350 * @params: the hw_params instance 1350 * @params: the hw_params instance
1351 * 1351 *
1352 * Choose one configuration from configuration space defined by PARAMS 1352 * Choose one configuration from configuration space defined by @params.
1353 * The configuration chosen is that obtained fixing in this order: 1353 * The configuration chosen is that obtained fixing in this order:
1354 * first access, first format, first subformat, min channels, 1354 * first access, first format, first subformat, min channels,
1355 * min rate, min period time, max buffer size, min tick time 1355 * min rate, min period time, max buffer size, min tick time
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
index 89b7f549bebd..ea2bf82c9373 100644
--- a/sound/core/pcm_misc.c
+++ b/sound/core/pcm_misc.c
@@ -319,6 +319,7 @@ EXPORT_SYMBOL(snd_pcm_format_physical_width);
319/** 319/**
320 * snd_pcm_format_size - return the byte size of samples on the given format 320 * snd_pcm_format_size - return the byte size of samples on the given format
321 * @format: the format to check 321 * @format: the format to check
322 * @samples: sampling rate
322 * 323 *
323 * Returns the byte size of the given samples for the format, or a 324 * Returns the byte size of the given samples for the format, or a
324 * negative error code if unknown format. 325 * negative error code if unknown format.
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index e61e12506ded..a789efc9df39 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -875,10 +875,8 @@ static struct action_ops snd_pcm_action_start = {
875}; 875};
876 876
877/** 877/**
878 * snd_pcm_start 878 * snd_pcm_start - start all linked streams
879 * @substream: the PCM substream instance 879 * @substream: the PCM substream instance
880 *
881 * Start all linked streams.
882 */ 880 */
883int snd_pcm_start(struct snd_pcm_substream *substream) 881int snd_pcm_start(struct snd_pcm_substream *substream)
884{ 882{
@@ -926,12 +924,11 @@ static struct action_ops snd_pcm_action_stop = {
926}; 924};
927 925
928/** 926/**
929 * snd_pcm_stop 927 * snd_pcm_stop - try to stop all running streams in the substream group
930 * @substream: the PCM substream instance 928 * @substream: the PCM substream instance
931 * @state: PCM state after stopping the stream 929 * @state: PCM state after stopping the stream
932 * 930 *
933 * Try to stop all running streams in the substream group. 931 * The state of each stream is then changed to the given state unconditionally.
934 * The state of each stream is changed to the given value after that unconditionally.
935 */ 932 */
936int snd_pcm_stop(struct snd_pcm_substream *substream, int state) 933int snd_pcm_stop(struct snd_pcm_substream *substream, int state)
937{ 934{
@@ -941,11 +938,10 @@ int snd_pcm_stop(struct snd_pcm_substream *substream, int state)
941EXPORT_SYMBOL(snd_pcm_stop); 938EXPORT_SYMBOL(snd_pcm_stop);
942 939
943/** 940/**
944 * snd_pcm_drain_done 941 * snd_pcm_drain_done - stop the DMA only when the given stream is playback
945 * @substream: the PCM substream 942 * @substream: the PCM substream
946 * 943 *
947 * Stop the DMA only when the given stream is playback. 944 * After stopping, the state is changed to SETUP.
948 * The state is changed to SETUP.
949 * Unlike snd_pcm_stop(), this affects only the given stream. 945 * Unlike snd_pcm_stop(), this affects only the given stream.
950 */ 946 */
951int snd_pcm_drain_done(struct snd_pcm_substream *substream) 947int snd_pcm_drain_done(struct snd_pcm_substream *substream)
@@ -1065,10 +1061,9 @@ static struct action_ops snd_pcm_action_suspend = {
1065}; 1061};
1066 1062
1067/** 1063/**
1068 * snd_pcm_suspend 1064 * snd_pcm_suspend - trigger SUSPEND to all linked streams
1069 * @substream: the PCM substream 1065 * @substream: the PCM substream
1070 * 1066 *
1071 * Trigger SUSPEND to all linked streams.
1072 * After this call, all streams are changed to SUSPENDED state. 1067 * After this call, all streams are changed to SUSPENDED state.
1073 */ 1068 */
1074int snd_pcm_suspend(struct snd_pcm_substream *substream) 1069int snd_pcm_suspend(struct snd_pcm_substream *substream)
@@ -1088,10 +1083,9 @@ int snd_pcm_suspend(struct snd_pcm_substream *substream)
1088EXPORT_SYMBOL(snd_pcm_suspend); 1083EXPORT_SYMBOL(snd_pcm_suspend);
1089 1084
1090/** 1085/**
1091 * snd_pcm_suspend_all 1086 * snd_pcm_suspend_all - trigger SUSPEND to all substreams in the given pcm
1092 * @pcm: the PCM instance 1087 * @pcm: the PCM instance
1093 * 1088 *
1094 * Trigger SUSPEND to all substreams in the given pcm.
1095 * After this call, all streams are changed to SUSPENDED state. 1089 * After this call, all streams are changed to SUSPENDED state.
1096 */ 1090 */
1097int snd_pcm_suspend_all(struct snd_pcm *pcm) 1091int snd_pcm_suspend_all(struct snd_pcm *pcm)
@@ -1313,11 +1307,9 @@ static struct action_ops snd_pcm_action_prepare = {
1313}; 1307};
1314 1308
1315/** 1309/**
1316 * snd_pcm_prepare 1310 * snd_pcm_prepare - prepare the PCM substream to be triggerable
1317 * @substream: the PCM substream instance 1311 * @substream: the PCM substream instance
1318 * @file: file to refer f_flags 1312 * @file: file to refer f_flags
1319 *
1320 * Prepare the PCM substream to be triggerable.
1321 */ 1313 */
1322static int snd_pcm_prepare(struct snd_pcm_substream *substream, 1314static int snd_pcm_prepare(struct snd_pcm_substream *substream,
1323 struct file *file) 1315 struct file *file)
@@ -2177,7 +2169,6 @@ static int snd_pcm_release(struct inode *inode, struct file *file)
2177 if (snd_BUG_ON(!substream)) 2169 if (snd_BUG_ON(!substream))
2178 return -ENXIO; 2170 return -ENXIO;
2179 pcm = substream->pcm; 2171 pcm = substream->pcm;
2180 fasync_helper(-1, file, 0, &substream->runtime->fasync);
2181 mutex_lock(&pcm->open_mutex); 2172 mutex_lock(&pcm->open_mutex);
2182 snd_pcm_release_substream(substream); 2173 snd_pcm_release_substream(substream);
2183 kfree(pcm_file); 2174 kfree(pcm_file);
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index c4995c9f5730..39672f68ce5d 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -148,6 +148,8 @@ static int snd_rawmidi_runtime_free(struct snd_rawmidi_substream *substream)
148 148
149static inline void snd_rawmidi_output_trigger(struct snd_rawmidi_substream *substream,int up) 149static inline void snd_rawmidi_output_trigger(struct snd_rawmidi_substream *substream,int up)
150{ 150{
151 if (!substream->opened)
152 return;
151 if (up) { 153 if (up) {
152 tasklet_hi_schedule(&substream->runtime->tasklet); 154 tasklet_hi_schedule(&substream->runtime->tasklet);
153 } else { 155 } else {
@@ -158,6 +160,8 @@ static inline void snd_rawmidi_output_trigger(struct snd_rawmidi_substream *subs
158 160
159static void snd_rawmidi_input_trigger(struct snd_rawmidi_substream *substream, int up) 161static void snd_rawmidi_input_trigger(struct snd_rawmidi_substream *substream, int up)
160{ 162{
163 if (!substream->opened)
164 return;
161 substream->ops->trigger(substream, up); 165 substream->ops->trigger(substream, up);
162 if (!up && substream->runtime->event) 166 if (!up && substream->runtime->event)
163 tasklet_kill(&substream->runtime->tasklet); 167 tasklet_kill(&substream->runtime->tasklet);
@@ -857,6 +861,8 @@ int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
857 int result = 0, count1; 861 int result = 0, count1;
858 struct snd_rawmidi_runtime *runtime = substream->runtime; 862 struct snd_rawmidi_runtime *runtime = substream->runtime;
859 863
864 if (!substream->opened)
865 return -EBADFD;
860 if (runtime->buffer == NULL) { 866 if (runtime->buffer == NULL) {
861 snd_printd("snd_rawmidi_receive: input is not active!!!\n"); 867 snd_printd("snd_rawmidi_receive: input is not active!!!\n");
862 return -EINVAL; 868 return -EINVAL;
@@ -1126,6 +1132,8 @@ int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count)
1126int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream, 1132int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
1127 unsigned char *buffer, int count) 1133 unsigned char *buffer, int count)
1128{ 1134{
1135 if (!substream->opened)
1136 return -EBADFD;
1129 count = snd_rawmidi_transmit_peek(substream, buffer, count); 1137 count = snd_rawmidi_transmit_peek(substream, buffer, count);
1130 if (count < 0) 1138 if (count < 0)
1131 return count; 1139 return count;
diff --git a/sound/core/sound.c b/sound/core/sound.c
index c0685e2f0afa..44a69bb8d4f0 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -274,9 +274,8 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev,
274 return minor; 274 return minor;
275 } 275 }
276 snd_minors[minor] = preg; 276 snd_minors[minor] = preg;
277 preg->dev = device_create_drvdata(sound_class, device, 277 preg->dev = device_create(sound_class, device, MKDEV(major, minor),
278 MKDEV(major, minor), 278 private_data, "%s", name);
279 private_data, "%s", name);
280 if (IS_ERR(preg->dev)) { 279 if (IS_ERR(preg->dev)) {
281 snd_minors[minor] = NULL; 280 snd_minors[minor] = NULL;
282 mutex_unlock(&sound_mutex); 281 mutex_unlock(&sound_mutex);
diff --git a/sound/core/timer.c b/sound/core/timer.c
index e582face89d2..c584408c9f17 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -1263,7 +1263,6 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)
1263 if (file->private_data) { 1263 if (file->private_data) {
1264 tu = file->private_data; 1264 tu = file->private_data;
1265 file->private_data = NULL; 1265 file->private_data = NULL;
1266 fasync_helper(-1, file, 0, &tu->fasync);
1267 if (tu->timeri) 1266 if (tu->timeri)
1268 snd_timer_close(tu->timeri); 1267 snd_timer_close(tu->timeri);
1269 kfree(tu->queue); 1268 kfree(tu->queue);