diff mbox series

[110/113] ASoC: starfive: use snd_pcm_is_playback/capture()

Message ID 87plqnvlw9.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: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/starfive/jh7110_tdm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/starfive/jh7110_tdm.c b/sound/soc/starfive/jh7110_tdm.c
index 1e0ff67207471..c2b307558bfb5 100644
--- a/sound/soc/starfive/jh7110_tdm.c
+++ b/sound/soc/starfive/jh7110_tdm.c
@@ -146,7 +146,7 @@  static inline void jh7110_tdm_writel(struct jh7110_tdm_dev *tdm, u16 reg, u32 va
 static void jh7110_tdm_save_context(struct jh7110_tdm_dev *tdm,
 				    struct snd_pcm_substream *substream)
 {
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		tdm->saved_pcmtxcr = jh7110_tdm_readl(tdm, TDM_PCMTXCR);
 	else
 		tdm->saved_pcmrxcr = jh7110_tdm_readl(tdm, TDM_PCMRXCR);
@@ -161,7 +161,7 @@  static void jh7110_tdm_start(struct jh7110_tdm_dev *tdm,
 	jh7110_tdm_writel(tdm, TDM_PCMGBCR, data | PCMGBCR_ENABLE);
 
 	/* restore context */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		jh7110_tdm_writel(tdm, TDM_PCMTXCR, tdm->saved_pcmtxcr | PCMTXCR_TXEN);
 	else
 		jh7110_tdm_writel(tdm, TDM_PCMRXCR, tdm->saved_pcmrxcr | PCMRXCR_RXEN);
@@ -172,7 +172,7 @@  static void jh7110_tdm_stop(struct jh7110_tdm_dev *tdm,
 {
 	unsigned int val;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		val = jh7110_tdm_readl(tdm, TDM_PCMTXCR);
 		val &= ~PCMTXCR_TXEN;
 		jh7110_tdm_writel(tdm, TDM_PCMTXCR, val);
@@ -237,7 +237,7 @@  static int jh7110_tdm_config(struct jh7110_tdm_dev *tdm,
 		  (tdm->tx.sl << SL_BIT) |
 		  (tdm->tx.lrj << LRJ_BIT);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		jh7110_tdm_writel(tdm, TDM_PCMTXCR, datatx);
 	else
 		jh7110_tdm_writel(tdm, TDM_PCMRXCR, datarx);
@@ -380,7 +380,7 @@  static int jh7110_tdm_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		tdm->tx.wl = chan_wl;
 		tdm->tx.sl = chan_sl;
 		tdm->tx.sscale = chan_nr;