[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>
This commit is contained in:
committed by
Jaroslav Kysela
parent
bf1bbb5a49
commit
3bf75f9b90
@@ -369,6 +369,7 @@ struct snd_pcm_substream {
|
||||
/* -- assigned files -- */
|
||||
struct snd_pcm_file *file;
|
||||
struct file *ffile;
|
||||
void (*pcm_release)(struct snd_pcm_substream *);
|
||||
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
|
||||
/* -- OSS things -- */
|
||||
struct snd_pcm_oss_substream oss;
|
||||
@@ -381,13 +382,10 @@ struct snd_pcm_substream {
|
||||
struct snd_info_entry *proc_prealloc_entry;
|
||||
/* misc flags */
|
||||
unsigned int no_mmap_ctrl: 1;
|
||||
unsigned int hw_opened: 1;
|
||||
};
|
||||
|
||||
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
|
||||
#define SUBSTREAM_BUSY(substream) ((substream)->file != NULL || ((substream)->oss.file != NULL))
|
||||
#else
|
||||
#define SUBSTREAM_BUSY(substream) ((substream)->file != NULL)
|
||||
#endif
|
||||
|
||||
|
||||
struct snd_pcm_str {
|
||||
@@ -468,8 +466,12 @@ int snd_pcm_suspend(struct snd_pcm_substream *substream);
|
||||
int snd_pcm_suspend_all(struct snd_pcm *pcm);
|
||||
#endif
|
||||
int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
|
||||
int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct snd_pcm_substream **rsubstream);
|
||||
int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct file *file,
|
||||
struct snd_pcm_substream **rsubstream);
|
||||
void snd_pcm_release_substream(struct snd_pcm_substream *substream);
|
||||
int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, struct file *file,
|
||||
struct snd_pcm_substream **rsubstream);
|
||||
void snd_pcm_detach_substream(struct snd_pcm_substream *substream);
|
||||
void snd_pcm_vma_notify_data(void *client, void *data);
|
||||
int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
|
||||
|
||||
|
Reference in New Issue
Block a user