diff mbox series

[067/113] ASoC: ux500: use snd_pcm_is_playback/capture()

Message ID 87frrjyf7h.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/ux500/mop500_ab8500.c | 4 ++--
 sound/soc/ux500/ux500_msp_dai.c | 6 +++---
 sound/soc/ux500/ux500_msp_i2s.c | 4 ++--
 sound/soc/ux500/ux500_pcm.c     | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/ux500/mop500_ab8500.c b/sound/soc/ux500/mop500_ab8500.c
index 710b6744e0136..102d4922d6e62 100644
--- a/sound/soc/ux500/mop500_ab8500.c
+++ b/sound/soc/ux500/mop500_ab8500.c
@@ -203,7 +203,7 @@  static void mop500_ab8500_shutdown(struct snd_pcm_substream *substream)
 	dev_dbg(dev, "%s: Enter\n", __func__);
 
 	/* Reset slots configuration to default(s) */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		tx_slots = DEF_TX_SLOTS;
 	else
 		rx_slots = DEF_RX_SLOTS;
@@ -291,7 +291,7 @@  static int mop500_ab8500_hw_params(struct snd_pcm_substream *substream,
 
 	/* Setup TDM-slots */
 
-	is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+	is_playback = snd_pcm_is_playback(substream);
 	switch (channels) {
 	case 1:
 		slots = 16;
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 3fd13e8dd1107..1a02d66d45cd1 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -312,7 +312,7 @@  static int setup_msp_config(struct snd_pcm_substream *substream,
 	msp_config->tx_fifo_config = TX_FIFO_ENABLE;
 	msp_config->rx_fifo_config = RX_FIFO_ENABLE;
 	msp_config->def_elem_len = 1;
-	msp_config->direction = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+	msp_config->direction = snd_pcm_is_playback(substream) ?
 				MSP_DIR_TX : MSP_DIR_RX;
 	msp_config->data_size = MSP_DATA_BITS_32;
 	msp_config->frame_freq = runtime->rate;
@@ -423,7 +423,7 @@  static void ux500_msp_dai_shutdown(struct snd_pcm_substream *substream,
 {
 	int ret;
 	struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev);
-	bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+	bool is_playback = snd_pcm_is_playback(substream);
 
 	dev_dbg(dai->dev, "%s: MSP %d (%s): Enter.\n", __func__, dai->id,
 		snd_pcm_stream_str(substream));
@@ -511,7 +511,7 @@  static int ux500_msp_dai_hw_params(struct snd_pcm_substream *substream,
 
 	case SND_SOC_DAIFMT_DSP_B:
 	case SND_SOC_DAIFMT_DSP_A:
-		mask = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+		mask = snd_pcm_is_playback(substream) ?
 			drvdata->tx_mask :
 			drvdata->rx_mask;
 
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
index fbfeefa418ca7..36819fbd66781 100644
--- a/sound/soc/ux500/ux500_msp_i2s.c
+++ b/sound/soc/ux500/ux500_msp_i2s.c
@@ -565,7 +565,7 @@  int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction)
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-		if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(direction))
 			enable_bit = TX_ENABLE;
 		else
 			enable_bit = RX_ENABLE;
@@ -576,7 +576,7 @@  int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction)
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-		if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(direction))
 			disable_msp_tx(msp);
 		else
 			disable_msp_rx(msp);
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c
index b7f38873d2d8a..65a2125e36594 100644
--- a/sound/soc/ux500/ux500_pcm.c
+++ b/sound/soc/ux500/ux500_pcm.c
@@ -50,7 +50,7 @@  static int ux500_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
 	slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 	slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		slave_config->dst_addr = dma_addr;
 	else
 		slave_config->src_addr = dma_addr;