@@ -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;
@@ -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);
@@ -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);
@@ -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;
@@ -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;
@@ -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;
}
@@ -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;
}
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(-)