[PATCH 018/113] ALSA: pci: asihpi: 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/asihpi/asihpi.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 001786e2aba13..69eb696012933 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -447,7 +447,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
 			params_channels(params),
 			format, params_rate(params), 0, 0));
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		if (hpi_instream_reset(dpcm->h_stream) != 0)
 			return -EINVAL;
 
@@ -582,7 +582,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
 				continue;
 
 			ds->drained_count = 0;
-			if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+			if (snd_pcm_is_playback(s)) {
 				/* How do I know how much valid data is present
 				* in buffer? Must be at least one period!
 				* Guessing 2 periods, but if
@@ -615,7 +615,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
 		}
 		/* start the master stream */
 		card->pcm_start(substream);
-		if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) ||
+		if (snd_pcm_is_capture(substream) ||
 			!card->can_dma)
 			hpi_handle_error(hpi_stream_start(dpcm->h_stream));
 		break;
@@ -643,7 +643,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
 
 		/* _prepare and _hwparams reset the stream */
 		hpi_handle_error(hpi_stream_stop(dpcm->h_stream));
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			hpi_handle_error(
 				hpi_outstream_reset(dpcm->h_stream));
 
@@ -755,7 +755,7 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)
 		if (!card->can_dma)
 			on_card_bytes = bytes_avail;
 
-		if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(s)) {
 			pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail;
 			if (state == HPI_STATE_STOPPED) {
 				if (bytes_avail == 0) {
@@ -837,7 +837,7 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)
 		if (xfercount &&
 			/* Limit use of on card fifo for playback */
 			((on_card_bytes <= ds->period_bytes) ||
-			(s->stream == SNDRV_PCM_STREAM_CAPTURE)))
+			 (snd_pcm_is_capture(s))))
 
 		{
 
@@ -853,7 +853,7 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)
 				xfer2 = xfercount - xfer1;
 			}
 
-			if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+			if (snd_pcm_is_playback(s)) {
 				snd_printddd("write1, P=%d, xfer=%d, buf_ofs=%d\n",
 					s->number, xfer1, buf_ofs);
 				hpi_handle_error(
-- 
2.43.0





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux