summaryrefslogtreecommitdiffstats
path: root/sound/pci/rme9652/hdspm.c
diff options
context:
space:
mode:
authorAdrian Knoth <aknoth@google.com>2015-02-17 00:05:05 +0100
committerTakashi Iwai <tiwai@suse.de>2015-02-17 07:40:30 +0100
commit8b73b867294364ae3007affdf8cfd28f022b158c (patch)
tree3f220c1f491f445f435ed45a2a5518b8600ca6b5 /sound/pci/rme9652/hdspm.c
parent5ecc5dc720307d3fb0167e2b14f50e97dd9a2233 (diff)
downloadop-kernel-dev-8b73b867294364ae3007affdf8cfd28f022b158c.zip
op-kernel-dev-8b73b867294364ae3007affdf8cfd28f022b158c.tar.gz
ALSA: hdspm - DRY cleanup in .release callback
This commit removes code duplication between snd_hdspm_{capture,playback}_release. No semantic changes intended, this is purely cosmetic. Signed-off-by: Adrian Knoth <aknoth@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/rme9652/hdspm.c')
-rw-r--r--sound/pci/rme9652/hdspm.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 51e9841..4e1cfb9 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6120,33 +6120,26 @@ static int snd_hdspm_open(struct snd_pcm_substream *substream)
return 0;
}
-static int snd_hdspm_playback_release(struct snd_pcm_substream *substream)
+static int snd_hdspm_release(struct snd_pcm_substream *substream)
{
struct hdspm *hdspm = snd_pcm_substream_chip(substream);
+ bool playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
spin_lock_irq(&hdspm->lock);
- hdspm->playback_pid = -1;
- hdspm->playback_substream = NULL;
+ if (playback) {
+ hdspm->playback_pid = -1;
+ hdspm->playback_substream = NULL;
+ } else {
+ hdspm->capture_pid = -1;
+ hdspm->capture_substream = NULL;
+ }
spin_unlock_irq(&hdspm->lock);
return 0;
}
-static int snd_hdspm_capture_release(struct snd_pcm_substream *substream)
-{
- struct hdspm *hdspm = snd_pcm_substream_chip(substream);
-
- spin_lock_irq(&hdspm->lock);
-
- hdspm->capture_pid = -1;
- hdspm->capture_substream = NULL;
-
- spin_unlock_irq(&hdspm->lock);
- return 0;
-}
-
static int snd_hdspm_hwdep_dummy_op(struct snd_hwdep *hw, struct file *file)
{
/* 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,
static struct snd_pcm_ops snd_hdspm_playback_ops = {
.open = snd_hdspm_open,
- .close = snd_hdspm_playback_release,
+ .close = snd_hdspm_release,
.ioctl = snd_hdspm_ioctl,
.hw_params = snd_hdspm_hw_params,
.hw_free = snd_hdspm_hw_free,
@@ -6375,7 +6368,7 @@ static struct snd_pcm_ops snd_hdspm_playback_ops = {
static struct snd_pcm_ops snd_hdspm_capture_ops = {
.open = snd_hdspm_open,
- .close = snd_hdspm_capture_release,
+ .close = snd_hdspm_release,
.ioctl = snd_hdspm_ioctl,
.hw_params = snd_hdspm_hw_params,
.hw_free = snd_hdspm_hw_free,
OpenPOWER on IntegriCloud