diff mbox series

[060/113] ASoC: atmel: use snd_pcm_is_playback/capture()

Message ID 87plqnyf8c.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/atmel/atmel-i2s.c     |  6 +++---
 sound/soc/atmel/atmel-pcm-dma.c |  2 +-
 sound/soc/atmel/atmel-pcm-pdc.c |  2 +-
 sound/soc/atmel/atmel_ssc_dai.c | 10 +++++-----
 sound/soc/atmel/mchp-i2s-mcc.c  |  6 +++---
 sound/soc/atmel/mchp-spdifrx.c  |  2 +-
 sound/soc/atmel/mchp-spdiftx.c  |  2 +-
 7 files changed, 15 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c
index 6c20c643f3218..97bf80ba45531 100644
--- a/sound/soc/atmel/atmel-i2s.c
+++ b/sound/soc/atmel/atmel-i2s.c
@@ -272,7 +272,7 @@  static int atmel_i2s_prepare(struct snd_pcm_substream *substream,
 			     struct snd_soc_dai *dai)
 {
 	struct atmel_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
-	bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+	bool is_playback = snd_pcm_is_playback(substream);
 	unsigned int rhr, sr = 0;
 
 	if (is_playback) {
@@ -324,7 +324,7 @@  static int atmel_i2s_hw_params(struct snd_pcm_substream *substream,
 			       struct snd_soc_dai *dai)
 {
 	struct atmel_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
-	bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+	bool is_playback = snd_pcm_is_playback(substream);
 	unsigned int mr = 0, mr_mask;
 	int ret;
 
@@ -477,7 +477,7 @@  static int atmel_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 			     struct snd_soc_dai *dai)
 {
 	struct atmel_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
-	bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+	bool is_playback = snd_pcm_is_playback(substream);
 	bool is_master, mck_enabled;
 	unsigned int cr, mr;
 	int err;
diff --git a/sound/soc/atmel/atmel-pcm-dma.c b/sound/soc/atmel/atmel-pcm-dma.c
index 7306e04da513b..f65c30a5dd4f7 100644
--- a/sound/soc/atmel/atmel-pcm-dma.c
+++ b/sound/soc/atmel/atmel-pcm-dma.c
@@ -60,7 +60,7 @@  static void atmel_pcm_dma_irq(u32 ssc_sr,
 	if (ssc_sr & prtd->mask->ssc_error) {
 		if (snd_pcm_running(substream))
 			pr_warn("atmel-pcm: buffer %s on %s (SSC_SR=%#x)\n",
-				substream->stream == SNDRV_PCM_STREAM_PLAYBACK
+				snd_pcm_is_playback(substream)
 				? "underrun" : "overrun", prtd->name,
 				ssc_sr);
 
diff --git a/sound/soc/atmel/atmel-pcm-pdc.c b/sound/soc/atmel/atmel-pcm-pdc.c
index 7db8df85c54f3..81ad08d436a34 100644
--- a/sound/soc/atmel/atmel-pcm-pdc.c
+++ b/sound/soc/atmel/atmel-pcm-pdc.c
@@ -96,7 +96,7 @@  static void atmel_pcm_dma_irq(u32 ssc_sr,
 
 	if (ssc_sr & params->mask->ssc_endbuf) {
 		pr_warn("atmel-pcm: buffer %s on %s (SSC_SR=%#x, count=%d)\n",
-				substream->stream == SNDRV_PCM_STREAM_PLAYBACK
+				snd_pcm_is_playback(substream)
 				? "underrun" : "overrun",
 				params->name, ssc_sr, count);
 
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 3763454436c15..3a8dd39537db8 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -290,7 +290,7 @@  static int atmel_ssc_startup(struct snd_pcm_substream *substream,
 	if (!ssc_p->initialized)
 		ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_SWRST));
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		dir = 0;
 		dir_mask = SSC_DIR_MASK_PLAYBACK;
 	} else {
@@ -337,7 +337,7 @@  static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
 	struct atmel_pcm_dma_params *dma_params;
 	int dir, dir_mask;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		dir = 0;
 	else
 		dir = 1;
@@ -476,7 +476,7 @@  static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
 	 * each direction.  If more are added, this code will
 	 * have to be changed to select the proper set.
 	 */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		dir = 0;
 	else
 		dir = 1;
@@ -717,7 +717,7 @@  static int atmel_ssc_prepare(struct snd_pcm_substream *substream,
 	struct atmel_pcm_dma_params *dma_params;
 	int dir;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		dir = 0;
 	else
 		dir = 1;
@@ -741,7 +741,7 @@  static int atmel_ssc_trigger(struct snd_pcm_substream *substream,
 	struct atmel_pcm_dma_params *dma_params;
 	int dir;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		dir = 0;
 	else
 		dir = 1;
diff --git a/sound/soc/atmel/mchp-i2s-mcc.c b/sound/soc/atmel/mchp-i2s-mcc.c
index 193dd7acceb08..017f363ed389d 100644
--- a/sound/soc/atmel/mchp-i2s-mcc.c
+++ b/sound/soc/atmel/mchp-i2s-mcc.c
@@ -517,7 +517,7 @@  static int mchp_i2s_mcc_hw_params(struct snd_pcm_substream *substream,
 	unsigned int bclk_rate;
 	int set_divs = 0;
 	int ret;
-	bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+	bool is_playback = snd_pcm_is_playback(substream);
 
 	dev_dbg(dev->dev, "%s() rate=%u format=%#x width=%u channels=%u\n",
 		__func__, params_rate(params), params_format(params),
@@ -733,7 +733,7 @@  static int mchp_i2s_mcc_hw_free(struct snd_pcm_substream *substream,
 				struct snd_soc_dai *dai)
 {
 	struct mchp_i2s_mcc_dev *dev = snd_soc_dai_get_drvdata(dai);
-	bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+	bool is_playback = snd_pcm_is_playback(substream);
 	long err;
 
 	if (is_playback) {
@@ -789,7 +789,7 @@  static int mchp_i2s_mcc_trigger(struct snd_pcm_substream *substream, int cmd,
 				struct snd_soc_dai *dai)
 {
 	struct mchp_i2s_mcc_dev *dev = snd_soc_dai_get_drvdata(dai);
-	bool is_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
+	bool is_playback = snd_pcm_is_playback(substream);
 	u32 cr = 0;
 	u32 iera = 0, ierb = 0;
 	u32 sr;
diff --git a/sound/soc/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c
index 33ce5e54482be..653c575e9a1f6 100644
--- a/sound/soc/atmel/mchp-spdifrx.c
+++ b/sound/soc/atmel/mchp-spdifrx.c
@@ -436,7 +436,7 @@  static int mchp_spdifrx_hw_params(struct snd_pcm_substream *substream,
 		__func__, params_rate(params), params_format(params),
 		params_width(params), params_channels(params));
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		dev_err(dev->dev, "Playback is not supported\n");
 		return -EINVAL;
 	}
diff --git a/sound/soc/atmel/mchp-spdiftx.c b/sound/soc/atmel/mchp-spdiftx.c
index a201a96fa6906..1e73a720ff6bb 100644
--- a/sound/soc/atmel/mchp-spdiftx.c
+++ b/sound/soc/atmel/mchp-spdiftx.c
@@ -358,7 +358,7 @@  static int mchp_spdiftx_hw_params(struct snd_pcm_substream *substream,
 		__func__, params_rate(params), params_format(params),
 		params_width(params), params_channels(params));
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		dev_err(dev->dev, "Capture is not supported\n");
 		return -EINVAL;
 	}