[PATCH 033/113] ALSA: include: 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>
---
 include/sound/dmaengine_pcm.h | 2 +-
 include/sound/pcm.h           | 4 ++--
 include/sound/sdw.h           | 2 +-
 include/sound/soc-dai.h       | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index f6baa9a018681..3b2e31922f0f1 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -21,7 +21,7 @@
 static inline enum dma_transfer_direction
 snd_pcm_substream_to_dma_direction(const struct snd_pcm_substream *substream)
 {
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		return DMA_MEM_TO_DEV;
 	else
 		return DMA_DEV_TO_MEM;
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 69e535aeb8e82..00603c0e568e1 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -734,7 +734,7 @@ static inline int snd_pcm_running(struct snd_pcm_substream *substream)
 {
 	return (substream->runtime->state == SNDRV_PCM_STATE_RUNNING ||
 		(substream->runtime->state == SNDRV_PCM_STATE_DRAINING &&
-		 substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
+		 snd_pcm_is_playback(substream)));
 }
 
 /**
@@ -1521,7 +1521,7 @@ const char *snd_pcm_format_name(snd_pcm_format_t format);
  */
 static inline const char *snd_pcm_direction_name(int direction)
 {
-	if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(direction))
 		return "Playback";
 	else
 		return "Capture";
diff --git a/include/sound/sdw.h b/include/sound/sdw.h
index 6dcdb3228dba6..ab752dadea3bc 100644
--- a/include/sound/sdw.h
+++ b/include/sound/sdw.h
@@ -38,7 +38,7 @@ static inline void snd_sdw_params_to_config(struct snd_pcm_substream *substream,
 	stream_config->ch_count = params_channels(params);
 	stream_config->bps = snd_pcm_format_width(params_format(params));
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		stream_config->direction = SDW_DATA_DIR_RX;
 	else
 		stream_config->direction = SDW_DATA_DIR_TX;
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index bbb72ad4c9518..577bbaede90af 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -476,7 +476,7 @@ struct snd_soc_dai {
 static inline const struct snd_soc_pcm_stream *
 snd_soc_dai_get_pcm_stream(const struct snd_soc_dai *dai, int stream)
 {
-	return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+	return (snd_pcm_is_playback(stream)) ?
 		&dai->driver->playback : &dai->driver->capture;
 }
 
-- 
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