diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-03-27 09:40:49 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-31 10:58:59 -0500 |
commit | 3bf75f9b90c981f18f27a0d35a44f488ab68c8ea (patch) | |
tree | 9284c90f09ce38fc3bb2ebc46624ddf3db09b526 /include/sound | |
parent | bf1bbb5a49eec51c30d341606885507b501b37e8 (diff) |
[ALSA] Clean up PCM codes (take 2)
- Clean up initialization and destruction of substream instance
Now snd_pcm_open_substream() alone does most initialization jobs.
Add pcm_release callback for cleaning up at snd_pcm_release_substream()
- Tidy up PCM oss code
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/pcm.h | 12 | ||||
-rw-r--r-- | include/sound/pcm_oss.h | 1 |
2 files changed, 7 insertions, 6 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 7cf6a30c1526..66b1f08b42b9 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -369,6 +369,7 @@ struct snd_pcm_substream { | |||
369 | /* -- assigned files -- */ | 369 | /* -- assigned files -- */ |
370 | struct snd_pcm_file *file; | 370 | struct snd_pcm_file *file; |
371 | struct file *ffile; | 371 | struct file *ffile; |
372 | void (*pcm_release)(struct snd_pcm_substream *); | ||
372 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 373 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) |
373 | /* -- OSS things -- */ | 374 | /* -- OSS things -- */ |
374 | struct snd_pcm_oss_substream oss; | 375 | struct snd_pcm_oss_substream oss; |
@@ -381,13 +382,10 @@ struct snd_pcm_substream { | |||
381 | struct snd_info_entry *proc_prealloc_entry; | 382 | struct snd_info_entry *proc_prealloc_entry; |
382 | /* misc flags */ | 383 | /* misc flags */ |
383 | unsigned int no_mmap_ctrl: 1; | 384 | unsigned int no_mmap_ctrl: 1; |
385 | unsigned int hw_opened: 1; | ||
384 | }; | 386 | }; |
385 | 387 | ||
386 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | ||
387 | #define SUBSTREAM_BUSY(substream) ((substream)->file != NULL || ((substream)->oss.file != NULL)) | ||
388 | #else | ||
389 | #define SUBSTREAM_BUSY(substream) ((substream)->file != NULL) | 388 | #define SUBSTREAM_BUSY(substream) ((substream)->file != NULL) |
390 | #endif | ||
391 | 389 | ||
392 | 390 | ||
393 | struct snd_pcm_str { | 391 | struct snd_pcm_str { |
@@ -468,8 +466,12 @@ int snd_pcm_suspend(struct snd_pcm_substream *substream); | |||
468 | int snd_pcm_suspend_all(struct snd_pcm *pcm); | 466 | int snd_pcm_suspend_all(struct snd_pcm *pcm); |
469 | #endif | 467 | #endif |
470 | int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); | 468 | int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); |
471 | int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct snd_pcm_substream **rsubstream); | 469 | int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct file *file, |
470 | struct snd_pcm_substream **rsubstream); | ||
472 | void snd_pcm_release_substream(struct snd_pcm_substream *substream); | 471 | void snd_pcm_release_substream(struct snd_pcm_substream *substream); |
472 | int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, struct file *file, | ||
473 | struct snd_pcm_substream **rsubstream); | ||
474 | void snd_pcm_detach_substream(struct snd_pcm_substream *substream); | ||
473 | void snd_pcm_vma_notify_data(void *client, void *data); | 475 | void snd_pcm_vma_notify_data(void *client, void *data); |
474 | int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); | 476 | int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); |
475 | 477 | ||
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h index bff0778e1969..1d522aaa66df 100644 --- a/include/sound/pcm_oss.h +++ b/include/sound/pcm_oss.h | |||
@@ -70,7 +70,6 @@ struct snd_pcm_oss_file { | |||
70 | struct snd_pcm_oss_substream { | 70 | struct snd_pcm_oss_substream { |
71 | unsigned oss: 1; /* oss mode */ | 71 | unsigned oss: 1; /* oss mode */ |
72 | struct snd_pcm_oss_setup *setup; /* active setup */ | 72 | struct snd_pcm_oss_setup *setup; /* active setup */ |
73 | struct snd_pcm_oss_file *file; | ||
74 | }; | 73 | }; |
75 | 74 | ||
76 | struct snd_pcm_oss_stream { | 75 | struct snd_pcm_oss_stream { |