diff mbox series

[063/113] ASoC: soc-*: use snd_pcm_is_playback/capture()

Message ID 87le1byf7z.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series ALSA: add snd_pcm_is_playback/capture() macro | expand

Commit Message

Kuninori Morimoto Aug. 5, 2024, 12:40 a.m. UTC
We can use snd_pcm_is_playback/capture(). Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-core.c                  | 2 +-
 sound/soc/soc-dai.c                   | 2 +-
 sound/soc/soc-dapm.c                  | 4 ++--
 sound/soc/soc-generic-dmaengine-pcm.c | 2 +-
 sound/soc/soc-pcm.c                   | 6 +++---
 5 files changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 20248a29d1674..286e872ae4547 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3456,7 +3456,7 @@  int snd_soc_get_stream_cpu(const struct snd_soc_dai_link *dai_link, int stream)
 	 *	CPU  : SNDRV_PCM_STREAM_PLAYBACK
 	 *	Codec: SNDRV_PCM_STREAM_CAPTURE
 	 */
-	if (stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(stream))
 		return SNDRV_PCM_STREAM_PLAYBACK;
 
 	return SNDRV_PCM_STREAM_CAPTURE;
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index 9e47053419c16..28a0a7a0993af 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -379,7 +379,7 @@  int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
 	 */
 	if (dai->driver->ops &&
 	    dai->driver->ops->mute_stream &&
-	    (direction == SNDRV_PCM_STREAM_PLAYBACK ||
+	    (snd_pcm_is_playback(direction) ||
 	     !dai->driver->ops->no_capture_mute))
 		ret = dai->driver->ops->mute_stream(dai, mute, direction);
 
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index d7d6dbb9d9eae..0d60942f64113 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1312,7 +1312,7 @@  int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
 
 	snd_soc_dapm_mutex_lock(card);
 
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(stream)) {
 		invalidate_paths_ep(w, SND_SOC_DAPM_DIR_OUT);
 		paths = is_connected_output_ep(w, &widgets,
 				custom_stop_condition);
@@ -4539,7 +4539,7 @@  void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
 
 void snd_soc_dapm_stream_stop(struct snd_soc_pcm_runtime *rtd, int stream)
 {
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(stream)) {
 		if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
 			/* powered down playback stream now */
 			snd_soc_dapm_stream_event(rtd,
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index a63e942fdc0b7..4265e8052d6bf 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -297,7 +297,7 @@  static int dmaengine_copy(struct snd_soc_component *component,
 	int (*process)(struct snd_pcm_substream *substream,
 		       int channel, unsigned long hwoff,
 		       unsigned long bytes) = pcm->config->process;
-	bool is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool is_playback = snd_pcm_is_playback(substream);
 	void *dma_ptr = runtime->dma_area + hwoff +
 			channel * (runtime->dma_bytes / runtime->channels);
 
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 5520944ac9ddc..8f501178195e9 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -905,7 +905,7 @@  static int __soc_pcm_prepare(struct snd_soc_pcm_runtime *rtd,
 		goto out;
 
 	/* cancel any delayed stream shutdown that is pending */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+	if (snd_pcm_is_playback(substream) &&
 	    rtd->pop_wait) {
 		rtd->pop_wait = 0;
 		cancel_delayed_work(&rtd->delayed_work);
@@ -1517,11 +1517,11 @@  static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
 
 		switch (widget->id) {
 		case snd_soc_dapm_dai_in:
-			if (stream != SNDRV_PCM_STREAM_PLAYBACK)
+			if (!snd_pcm_is_playback(stream))
 				continue;
 			break;
 		case snd_soc_dapm_dai_out:
-			if (stream != SNDRV_PCM_STREAM_CAPTURE)
+			if (!snd_pcm_is_capture(stream))
 				continue;
 			break;
 		default: