diff mbox series

[106/113] ASoC: kirkwood: use snd_pcm_is_playback/capture()

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

Commit Message

Kuninori Morimoto Aug. 5, 2024, 12:44 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/kirkwood/kirkwood-dma.c | 10 +++++-----
 sound/soc/kirkwood/kirkwood-i2s.c |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c
index 036b42058272f..1a3749b50d0be 100644
--- a/sound/soc/kirkwood/kirkwood-dma.c
+++ b/sound/soc/kirkwood/kirkwood-dma.c
@@ -140,7 +140,7 @@  static int kirkwood_dma_open(struct snd_soc_component *component,
 		writel((unsigned int)-1, priv->io + KIRKWOOD_ERR_MASK);
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		if (priv->substream_play)
 			return -EBUSY;
 		priv->substream_play = substream;
@@ -161,7 +161,7 @@  static int kirkwood_dma_close(struct snd_soc_component *component,
 	if (!priv)
 		return 0;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		priv->substream_play = NULL;
 	else
 		priv->substream_rec = NULL;
@@ -185,7 +185,7 @@  static int kirkwood_dma_hw_params(struct snd_soc_component *component,
 	if (!dram)
 		return 0;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		kirkwood_dma_conf_mbus_windows(priv->io,
 			KIRKWOOD_PLAYBACK_WIN, addr, dram);
 	else
@@ -206,7 +206,7 @@  static int kirkwood_dma_prepare(struct snd_soc_component *component,
 	size = (size>>2)-1;
 	count = snd_pcm_lib_period_bytes(substream);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		writel(count, priv->io + KIRKWOOD_PLAY_BYTE_INT_COUNT);
 		writel(runtime->dma_addr, priv->io + KIRKWOOD_PLAY_BUF_ADDR);
 		writel(size, priv->io + KIRKWOOD_PLAY_BUF_SIZE);
@@ -227,7 +227,7 @@  static snd_pcm_uframes_t kirkwood_dma_pointer(
 	struct kirkwood_dma_data *priv = kirkwood_priv(substream);
 	snd_pcm_uframes_t count;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		count = bytes_to_frames(substream->runtime,
 			readl(priv->io + KIRKWOOD_PLAY_BYTE_COUNT));
 	else
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index d1eb90310afa2..5d43924bc1caf 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -258,7 +258,7 @@  static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
 	unsigned int i2s_reg;
 	unsigned long i2s_value;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		i2s_reg = KIRKWOOD_I2S_PLAYCTL;
 	} else {
 		i2s_reg = KIRKWOOD_I2S_RECCTL;
@@ -314,7 +314,7 @@  static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		if (params_channels(params) == 1)
 			ctl_play |= KIRKWOOD_PLAYCTL_MONO_BOTH;
 		else
@@ -501,7 +501,7 @@  static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream,
 static int kirkwood_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 			       struct snd_soc_dai *dai)
 {
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		return kirkwood_i2s_play_trigger(substream, cmd, dai);
 	else
 		return kirkwood_i2s_rec_trigger(substream, cmd, dai);