@@ -6120,33 +6120,26 @@ static int snd_hdspm_open(struct snd_pcm_substream *substream)
6120
6120
return 0 ;
6121
6121
}
6122
6122
6123
- static int snd_hdspm_playback_release (struct snd_pcm_substream * substream )
6123
+ static int snd_hdspm_release (struct snd_pcm_substream * substream )
6124
6124
{
6125
6125
struct hdspm * hdspm = snd_pcm_substream_chip (substream );
6126
+ bool playback = (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK );
6126
6127
6127
6128
spin_lock_irq (& hdspm -> lock );
6128
6129
6129
- hdspm -> playback_pid = -1 ;
6130
- hdspm -> playback_substream = NULL ;
6130
+ if (playback ) {
6131
+ hdspm -> playback_pid = -1 ;
6132
+ hdspm -> playback_substream = NULL ;
6133
+ } else {
6134
+ hdspm -> capture_pid = -1 ;
6135
+ hdspm -> capture_substream = NULL ;
6136
+ }
6131
6137
6132
6138
spin_unlock_irq (& hdspm -> lock );
6133
6139
6134
6140
return 0 ;
6135
6141
}
6136
6142
6137
- static int snd_hdspm_capture_release (struct snd_pcm_substream * substream )
6138
- {
6139
- struct hdspm * hdspm = snd_pcm_substream_chip (substream );
6140
-
6141
- spin_lock_irq (& hdspm -> lock );
6142
-
6143
- hdspm -> capture_pid = -1 ;
6144
- hdspm -> capture_substream = NULL ;
6145
-
6146
- spin_unlock_irq (& hdspm -> lock );
6147
- return 0 ;
6148
- }
6149
-
6150
6143
static int snd_hdspm_hwdep_dummy_op (struct snd_hwdep * hw , struct file * file )
6151
6144
{
6152
6145
/* we have nothing to initialize but the call is required */
@@ -6363,7 +6356,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
6363
6356
6364
6357
static struct snd_pcm_ops snd_hdspm_playback_ops = {
6365
6358
.open = snd_hdspm_open ,
6366
- .close = snd_hdspm_playback_release ,
6359
+ .close = snd_hdspm_release ,
6367
6360
.ioctl = snd_hdspm_ioctl ,
6368
6361
.hw_params = snd_hdspm_hw_params ,
6369
6362
.hw_free = snd_hdspm_hw_free ,
@@ -6375,7 +6368,7 @@ static struct snd_pcm_ops snd_hdspm_playback_ops = {
6375
6368
6376
6369
static struct snd_pcm_ops snd_hdspm_capture_ops = {
6377
6370
.open = snd_hdspm_open ,
6378
- .close = snd_hdspm_capture_release ,
6371
+ .close = snd_hdspm_release ,
6379
6372
.ioctl = snd_hdspm_ioctl ,
6380
6373
.hw_params = snd_hdspm_hw_params ,
6381
6374
.hw_free = snd_hdspm_hw_free ,
0 commit comments