[PATCH 014/113] ALSA: pci: hda: use snd_pcm_is_playback/capture()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We can use snd_pcm_is_playback/capture(). Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 sound/pci/hda/hda_controller.c | 6 +++---
 sound/pci/hda/hda_intel.c      | 6 +++---
 sound/pci/hda/patch_si3054.c   | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 5d86e5a9c814a..9efa43afd0c16 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -75,7 +75,7 @@ static u64 azx_adjust_codec_delay(struct snd_pcm_substream *substream,
 	codec_nsecs = div_u64(codec_frames * 1000000000LL,
 			      substream->runtime->rate);
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream))
 		return nsec + codec_nsecs;
 
 	return (nsec > codec_nsecs) ? nsec - codec_nsecs : 0;
@@ -385,7 +385,7 @@ static int azx_get_sync_time(ktime_t *device,
 
 	runtime = substream->runtime;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		direction = 1;
 	else
 		direction = 0;
@@ -659,7 +659,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
 
 	/* disable LINK_ATIME timestamps for capture streams
 	   until we figure out how to handle digital inputs */
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_WALL_CLOCK; /* legacy */
 		runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_LINK_ATIME;
 	}
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b79020adce63b..c9552b71c0e9d 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -583,7 +583,7 @@ static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev,
 	unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev);
 	int delay;
 
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(stream))
 		delay = pos - lpib_pos;
 	else
 		delay = lpib_pos - pos;
@@ -800,7 +800,7 @@ static unsigned int azx_via_get_position(struct azx *chip,
 	unsigned int fifo_size;
 
 	link_pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev));
-	if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(azx_dev->core.substream)) {
 		/* Playback, no problem using link position */
 		return link_pos;
 	}
@@ -869,7 +869,7 @@ static unsigned int azx_get_pos_fifo(struct azx *chip, struct azx_dev *azx_dev)
 	}
 
 	/* correct the DMA position for capture stream */
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		if (pos < delay)
 			pos += azx_dev->core.bufsize;
 		pos -= delay;
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index 763eae80a148e..9f13732a89064 100644
--- a/sound/pci/hda/patch_si3054.c
+++ b/sound/pci/hda/patch_si3054.c
@@ -142,8 +142,8 @@ static int si3054_pcm_prepare(struct hda_pcm_stream *hinfo,
 
 	SET_REG(codec, SI3054_LINE_RATE, substream->runtime->rate);
 	val = GET_REG(codec, SI3054_LINE_LEVEL);
-	val &= 0xff << (8 * (substream->stream != SNDRV_PCM_STREAM_PLAYBACK));
-	val |= ((stream_tag & 0xf) << 4) << (8 * (substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
+	val &= 0xff << (8 * (!snd_pcm_is_playback(substream)));
+	val |= ((stream_tag & 0xf) << 4) << (8 * (snd_pcm_is_playback(substream)));
 	SET_REG(codec, SI3054_LINE_LEVEL, val);
 
 	snd_hda_codec_setup_stream(codec, hinfo->nid,
-- 
2.43.0




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux