We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/xilinx/xlnx_formatter_pcm.c | 12 ++++++------ sound/soc/xilinx/xlnx_spdif.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c index 158fc21a86c10..7076d0befb4be 100644 --- a/sound/soc/xilinx/xlnx_formatter_pcm.c +++ b/sound/soc/xilinx/xlnx_formatter_pcm.c @@ -271,7 +271,7 @@ static void xlnx_formatter_disable_irqs(void __iomem *mmio_base, int stream)
val = readl(mmio_base + XLNX_AUD_CTRL); val &= ~AUD_CTRL_IOC_IRQ_MASK; - if (stream == SNDRV_PCM_STREAM_CAPTURE) + if (snd_pcm_is_capture(stream)) val &= ~AUD_CTRL_TOUT_IRQ_MASK;
writel(val, mmio_base + XLNX_AUD_CTRL); @@ -334,10 +334,10 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component, struct snd_pcm_runtime *runtime = substream->runtime; struct xlnx_pcm_drv_data *adata = dev_get_drvdata(component->dev);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && + if (snd_pcm_is_playback(substream) && !adata->mm2s_presence) return -ENODEV; - else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && + else if (snd_pcm_is_capture(substream) && !adata->s2mm_presence) return -ENODEV;
@@ -345,7 +345,7 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component, if (!stream_data) return -ENOMEM;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(substream)) { ch_count_mask = CFG_MM2S_CH_MASK; ch_count_shift = CFG_MM2S_CH_SHIFT; data_xfer_mode = CFG_MM2S_XFER_MASK; @@ -466,7 +466,7 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, if (active_ch > stream_data->ch_limit) return -EINVAL;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && + if (snd_pcm_is_playback(substream) && adata->sysclk) { unsigned int mclk_fs = adata->sysclk / params_rate(params);
@@ -479,7 +479,7 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, writel(mclk_fs, stream_data->mmio + XLNX_AUD_FS_MULTIPLIER); }
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && + if (snd_pcm_is_capture(substream) && stream_data->xfer_mode == AES_TO_PCM) { val = readl(stream_data->mmio + XLNX_AUD_STS); if (val & AUD_STS_CH_STS_MASK) { diff --git a/sound/soc/xilinx/xlnx_spdif.c b/sound/soc/xilinx/xlnx_spdif.c index d52d5fc7b5b81..bf79639081ecc 100644 --- a/sound/soc/xilinx/xlnx_spdif.c +++ b/sound/soc/xilinx/xlnx_spdif.c @@ -84,7 +84,7 @@ static int xlnx_spdif_startup(struct snd_pcm_substream *substream, val |= XSPDIF_FIFO_FLUSH_MASK; writel(val, ctx->base + XSPDIF_CONTROL_REG);
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { + if (snd_pcm_is_capture(substream)) { writel(XSPDIF_CH_STS_MASK, ctx->base + XSPDIF_IRQ_ENABLE_REG); writel(XSPDIF_GLOBAL_IRQ_ENABLE, @@ -179,7 +179,7 @@ static int xlnx_spdif_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: val |= XSPDIF_CORE_ENABLE_MASK; writel(val, ctx->base + XSPDIF_CONTROL_REG); - if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + if (snd_pcm_is_capture(substream)) ret = rx_stream_detect(dai); break; case SNDRV_PCM_TRIGGER_STOP: