@@ -285,7 +285,7 @@ static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
sun4i_codec_start_playback(scodec);
else
sun4i_codec_start_capture(scodec);
@@ -294,7 +294,7 @@ static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
sun4i_codec_stop_playback(scodec);
else
sun4i_codec_stop_capture(scodec);
@@ -385,7 +385,7 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream,
static int sun4i_codec_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return sun4i_codec_prepare_playback(substream, dai);
return sun4i_codec_prepare_capture(substream, dai);
@@ -569,7 +569,7 @@ static int sun4i_codec_hw_params(struct snd_pcm_substream *substream,
if (hwrate < 0)
return hwrate;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
return sun4i_codec_hw_params_playback(scodec, params,
hwrate);
@@ -1033,7 +1033,7 @@ static int sun4i_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
sun4i_i2s_start_playback(i2s);
else
sun4i_i2s_start_capture(i2s);
@@ -1042,7 +1042,7 @@ static int sun4i_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(substream))
sun4i_i2s_stop_playback(i2s);
else
sun4i_i2s_stop_capture(i2s);
@@ -248,7 +248,7 @@ static int sun4i_spdif_startup(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -EINVAL;
sun4i_spdif_configure(host);
@@ -364,7 +364,7 @@ static int sun4i_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
int ret = 0;
struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(dai);
- if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+ if (!snd_pcm_is_playback(substream))
return -EINVAL;
switch (cmd) {
@@ -90,7 +90,7 @@ static int sun50i_dmic_startup(struct snd_pcm_substream *substream,
struct sun50i_dmic_dev *host = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
/* only support capture */
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream))
return -EINVAL;
regmap_update_bits(host->regmap, SUN50I_DMIC_RXFIFO_CTL,
@@ -205,7 +205,7 @@ static int sun50i_dmic_trigger(struct snd_pcm_substream *substream, int cmd,
int ret = 0;
struct sun50i_dmic_dev *host = snd_soc_dai_get_drvdata(dai);
- if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
+ if (!snd_pcm_is_capture(substream))
return -EINVAL;
switch (cmd) {
We can use snd_pcm_is_playback/capture(). Let's use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> --- sound/soc/sunxi/sun4i-codec.c | 8 ++++---- sound/soc/sunxi/sun4i-i2s.c | 4 ++-- sound/soc/sunxi/sun4i-spdif.c | 4 ++-- sound/soc/sunxi/sun50i-dmic.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-)