[alsa-devel] [PATCH] ASoC: Intel: fix machine driver warnings
From: "Fang, Yang A" yang.a.fang@intel.com
this patch will fix below sparse warnings
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] val got restricted snd_pcm_format_t [usertype] <noident>
sound/soc/intel/haswell.c:61:37 sound/soc/intel/broadwell.c:115:37: sound/soc/intel/bytcr_dpcm_rt5640.c:118:37: sound/soc/intel/cht_bsw_rt5672.c:183:37: sound/soc/intel/cht_bsw_rt5645.c:208:37:
Signed-off-by: Fang, Yang A yang.a.fang@intel.com --- sound/soc/intel/broadwell.c | 2 +- sound/soc/intel/bytcr_dpcm_rt5640.c | 2 +- sound/soc/intel/cht_bsw_rt5645.c | 2 +- sound/soc/intel/cht_bsw_rt5672.c | 2 +- sound/soc/intel/haswell.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/intel/broadwell.c b/sound/soc/intel/broadwell.c index 9cf7d01..0ca4015 100644 --- a/sound/soc/intel/broadwell.c +++ b/sound/soc/intel/broadwell.c @@ -112,7 +112,7 @@ static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, /* set SSP0 to 16 bit */ snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S16_LE); + (__force int)SNDRV_PCM_FORMAT_S16_LE); return 0; }
diff --git a/sound/soc/intel/bytcr_dpcm_rt5640.c b/sound/soc/intel/bytcr_dpcm_rt5640.c index 5930862..b171443 100644 --- a/sound/soc/intel/bytcr_dpcm_rt5640.c +++ b/sound/soc/intel/bytcr_dpcm_rt5640.c @@ -115,7 +115,7 @@ static int byt_codec_fixup(struct snd_soc_pcm_runtime *rtd, /* set SSP2 to 24-bit */ snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S24_LE); + (__force int)SNDRV_PCM_FORMAT_S24_LE); return 0; }
diff --git a/sound/soc/intel/cht_bsw_rt5645.c b/sound/soc/intel/cht_bsw_rt5645.c index b6f8377..7781fbe 100644 --- a/sound/soc/intel/cht_bsw_rt5645.c +++ b/sound/soc/intel/cht_bsw_rt5645.c @@ -205,7 +205,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, /* set SSP2 to 24-bit */ snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S24_LE); + (__force int)SNDRV_PCM_FORMAT_S24_LE); return 0; }
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c index ff01662..b1842fa 100644 --- a/sound/soc/intel/cht_bsw_rt5672.c +++ b/sound/soc/intel/cht_bsw_rt5672.c @@ -180,7 +180,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, /* set SSP2 to 24-bit */ snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S24_LE); + (__force int)SNDRV_PCM_FORMAT_S24_LE); return 0; }
diff --git a/sound/soc/intel/haswell.c b/sound/soc/intel/haswell.c index 35edf51..b19f1ce 100644 --- a/sound/soc/intel/haswell.c +++ b/sound/soc/intel/haswell.c @@ -58,7 +58,7 @@ static int haswell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, /* set SSP0 to 16 bit */ snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S16_LE); + (__force int)SNDRV_PCM_FORMAT_S16_LE); return 0; }
At Thu, 5 Feb 2015 16:19:16 -0800, yang.a.fang@intel.com wrote:
From: "Fang, Yang A" yang.a.fang@intel.com
this patch will fix below sparse warnings
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] val got restricted snd_pcm_format_t [usertype] <noident>
sound/soc/intel/haswell.c:61:37 sound/soc/intel/broadwell.c:115:37: sound/soc/intel/bytcr_dpcm_rt5640.c:118:37: sound/soc/intel/cht_bsw_rt5672.c:183:37: sound/soc/intel/cht_bsw_rt5645.c:208:37:
Signed-off-by: Fang, Yang A yang.a.fang@intel.com
sound/soc/intel/broadwell.c | 2 +- sound/soc/intel/bytcr_dpcm_rt5640.c | 2 +- sound/soc/intel/cht_bsw_rt5645.c | 2 +- sound/soc/intel/cht_bsw_rt5672.c | 2 +- sound/soc/intel/haswell.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/intel/broadwell.c b/sound/soc/intel/broadwell.c index 9cf7d01..0ca4015 100644 --- a/sound/soc/intel/broadwell.c +++ b/sound/soc/intel/broadwell.c @@ -112,7 +112,7 @@ static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, /* set SSP0 to 16 bit */ snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S16_LE);
return 0;(__force int)SNDRV_PCM_FORMAT_S16_LE);
}
Oh, it's ugly, but unavoidable as long as we use this form.
Maybe it's better to provide a helper, e.g. params_set_format() to do the forced cast.
Also, it would be possible to provide the whole hw constraints stuff to make it working independently. But I guess it's overkill for DPCM hwparam fixups.
Takashi
-----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Thursday, February 05, 2015 11:23 PM To: Fang, Yang A Cc: broonie@kernel.org; lgirdwood@gmail.com; alsa-devel@alsa-project.org; Iriawan, Denny; N, Harshapriya; Jain, Praveen K; Strasser, Kevin; Koul, Vinod; Lin, Mengdong Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: fix machine driver warnings
At Thu, 5 Feb 2015 16:19:16 -0800, yang.a.fang@intel.com wrote:
From: "Fang, Yang A" yang.a.fang@intel.com
this patch will fix below sparse warnings
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] val got restricted snd_pcm_format_t [usertype]
<noident>
sound/soc/intel/haswell.c:61:37 sound/soc/intel/broadwell.c:115:37: sound/soc/intel/bytcr_dpcm_rt5640.c:118:37: sound/soc/intel/cht_bsw_rt5672.c:183:37: sound/soc/intel/cht_bsw_rt5645.c:208:37:
Signed-off-by: Fang, Yang A yang.a.fang@intel.com
sound/soc/intel/broadwell.c | 2 +- sound/soc/intel/bytcr_dpcm_rt5640.c | 2 +- sound/soc/intel/cht_bsw_rt5645.c | 2 +- sound/soc/intel/cht_bsw_rt5672.c | 2 +- sound/soc/intel/haswell.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/intel/broadwell.c b/sound/soc/intel/broadwell.c index 9cf7d01..0ca4015 100644 --- a/sound/soc/intel/broadwell.c +++ b/sound/soc/intel/broadwell.c @@ -112,7 +112,7 @@ static int broadwell_ssp0_fixup(struct
snd_soc_pcm_runtime *rtd,
/* set SSP0 to 16 bit */ snd_mask_set(¶ms- masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S16_LE);
(__force
int)SNDRV_PCM_FORMAT_S16_LE);
return 0; }
Oh, it's ugly, but unavoidable as long as we use this form.
Maybe it's better to provide a helper, e.g. params_set_format() to do the forced cast.
Also, it would be possible to provide the whole hw constraints stuff to make it working independently. But I guess it's overkill for DPCM hwparam fixups.
Takashi
Hi Takashi,
Thanks for the feedback. Are you looking for something like this?
masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S16_LE);
params_set_format( SNDRV_PCM_FORMAT_S16_LE));
At Fri, 6 Feb 2015 07:42:03 +0000, Fang, Yang A wrote:
-----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Thursday, February 05, 2015 11:23 PM To: Fang, Yang A Cc: broonie@kernel.org; lgirdwood@gmail.com; alsa-devel@alsa-project.org; Iriawan, Denny; N, Harshapriya; Jain, Praveen K; Strasser, Kevin; Koul, Vinod; Lin, Mengdong Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: fix machine driver warnings
At Thu, 5 Feb 2015 16:19:16 -0800, yang.a.fang@intel.com wrote:
From: "Fang, Yang A" yang.a.fang@intel.com
this patch will fix below sparse warnings
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] val got restricted snd_pcm_format_t [usertype]
<noident>
sound/soc/intel/haswell.c:61:37 sound/soc/intel/broadwell.c:115:37: sound/soc/intel/bytcr_dpcm_rt5640.c:118:37: sound/soc/intel/cht_bsw_rt5672.c:183:37: sound/soc/intel/cht_bsw_rt5645.c:208:37:
Signed-off-by: Fang, Yang A yang.a.fang@intel.com
sound/soc/intel/broadwell.c | 2 +- sound/soc/intel/bytcr_dpcm_rt5640.c | 2 +- sound/soc/intel/cht_bsw_rt5645.c | 2 +- sound/soc/intel/cht_bsw_rt5672.c | 2 +- sound/soc/intel/haswell.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/intel/broadwell.c b/sound/soc/intel/broadwell.c index 9cf7d01..0ca4015 100644 --- a/sound/soc/intel/broadwell.c +++ b/sound/soc/intel/broadwell.c @@ -112,7 +112,7 @@ static int broadwell_ssp0_fixup(struct
snd_soc_pcm_runtime *rtd,
/* set SSP0 to 16 bit */ snd_mask_set(¶ms- masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S16_LE);
(__force
int)SNDRV_PCM_FORMAT_S16_LE);
return 0; }
Oh, it's ugly, but unavoidable as long as we use this form.
Maybe it's better to provide a helper, e.g. params_set_format() to do the forced cast.
Also, it would be possible to provide the whole hw constraints stuff to make it working independently. But I guess it's overkill for DPCM hwparam fixups.
Takashi
Hi Takashi,
Thanks for the feedback. Are you looking for something like this?
masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S16_LE);
params_set_format( SNDRV_PCM_FORMAT_S16_LE));
No, something like below in pcm_params.h:
static inline void params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t format) { snd_mask_set(p, (__force int)format); }
Takashi
-----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Thursday, February 05, 2015 11:47 PM To: Fang, Yang A Cc: broonie@kernel.org; lgirdwood@gmail.com; alsa-devel@alsa-project.org; Iriawan, Denny; N, Harshapriya; Jain, Praveen K; Strasser, Kevin; Koul, Vinod; Lin, Mengdong Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: fix machine driver warnings
At Fri, 6 Feb 2015 07:42:03 +0000, Fang, Yang A wrote:
-----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Thursday, February 05, 2015 11:23 PM To: Fang, Yang A Cc: broonie@kernel.org; lgirdwood@gmail.com; alsa-devel@alsa-project.org; Iriawan, Denny; N, Harshapriya; Jain, Praveen K; Strasser, Kevin; Koul, Vinod; Lin, Mengdong Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: fix machine driver warnings
At Thu, 5 Feb 2015 16:19:16 -0800, yang.a.fang@intel.com wrote:
From: "Fang, Yang A" yang.a.fang@intel.com
this patch will fix below sparse warnings
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] val got restricted snd_pcm_format_t [usertype] <noident>
sound/soc/intel/haswell.c:61:37 sound/soc/intel/broadwell.c:115:37: sound/soc/intel/bytcr_dpcm_rt5640.c:118:37: sound/soc/intel/cht_bsw_rt5672.c:183:37: sound/soc/intel/cht_bsw_rt5645.c:208:37:
Signed-off-by: Fang, Yang A yang.a.fang@intel.com
sound/soc/intel/broadwell.c | 2 +- sound/soc/intel/bytcr_dpcm_rt5640.c | 2 +- sound/soc/intel/cht_bsw_rt5645.c | 2 +- sound/soc/intel/cht_bsw_rt5672.c | 2 +- sound/soc/intel/haswell.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/intel/broadwell.c b/sound/soc/intel/broadwell.c index 9cf7d01..0ca4015 100644 --- a/sound/soc/intel/broadwell.c +++ b/sound/soc/intel/broadwell.c @@ -112,7 +112,7 @@ static int broadwell_ssp0_fixup(struct
snd_soc_pcm_runtime *rtd,
/* set SSP0 to 16 bit */ snd_mask_set(¶ms- masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S16_LE);
(__force
int)SNDRV_PCM_FORMAT_S16_LE);
return 0; }
Oh, it's ugly, but unavoidable as long as we use this form.
Maybe it's better to provide a helper, e.g. params_set_format() to do the forced cast.
Also, it would be possible to provide the whole hw constraints stuff to make it working independently. But I guess it's overkill for DPCM
hwparam fixups.
Takashi
Hi Takashi,
Thanks for the feedback. Are you looking for something like this?
masks[SNDRV_PCM_HW_PARAM_FORMAT - SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S16_LE);
params_set_format( SNDRV_PCM_FORMAT_S16_LE));
No, something like below in pcm_params.h:
static inline void params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t format) { snd_mask_set(p, (__force int)format); }
Takashi
I see.
Thanks Yang
From: "Fang, Yang A" yang.a.fang@intel.com
Add a helper to set pcm format directly from params
Signed-off-by: Fang, Yang A yang.a.fang@intel.com --- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 6b1c78f..e6fe584 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -366,4 +366,11 @@ params_physical_width(const struct snd_pcm_hw_params *p) return snd_pcm_format_physical_width(params_format(p)); }
+static inline void +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) +{ + snd_mask_set(&p->masks[SNDRV_PCM_HW_PARAM_FORMAT - + SNDRV_PCM_HW_PARAM_FIRST_MASK], (__force int)fmt); +} + #endif /* __SOUND_PCM_PARAMS_H */
From: "Fang, Yang A" yang.a.fang@intel.com
this patch will fix below sparse warnings
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] val got restricted snd_pcm_format_t [usertype] <noident>
sound/soc/intel/haswell.c:61:37 sound/soc/intel/broadwell.c:115:37: sound/soc/intel/bytcr_dpcm_rt5640.c:118:37: sound/soc/intel/cht_bsw_rt5672.c:183:37: sound/soc/intel/cht_bsw_rt5645.c:208:37:
Signed-off-by: Fang, Yang A yang.a.fang@intel.com --- sound/soc/intel/broadwell.c | 4 +--- sound/soc/intel/bytcr_dpcm_rt5640.c | 4 +--- sound/soc/intel/cht_bsw_rt5645.c | 4 +--- sound/soc/intel/cht_bsw_rt5672.c | 4 +--- sound/soc/intel/haswell.c | 4 +--- 5 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/sound/soc/intel/broadwell.c b/sound/soc/intel/broadwell.c index 9cf7d01..fba2ef5 100644 --- a/sound/soc/intel/broadwell.c +++ b/sound/soc/intel/broadwell.c @@ -110,9 +110,7 @@ static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP0 to 16 bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S16_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S16_LE); return 0; }
diff --git a/sound/soc/intel/bytcr_dpcm_rt5640.c b/sound/soc/intel/bytcr_dpcm_rt5640.c index 5930862..3b262d0 100644 --- a/sound/soc/intel/bytcr_dpcm_rt5640.c +++ b/sound/soc/intel/bytcr_dpcm_rt5640.c @@ -113,9 +113,7 @@ static int byt_codec_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP2 to 24-bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S24_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); return 0; }
diff --git a/sound/soc/intel/cht_bsw_rt5645.c b/sound/soc/intel/cht_bsw_rt5645.c index b6f8377..0fc5db7 100644 --- a/sound/soc/intel/cht_bsw_rt5645.c +++ b/sound/soc/intel/cht_bsw_rt5645.c @@ -203,9 +203,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP2 to 24-bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S24_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); return 0; }
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c index ff01662..c56f9df 100644 --- a/sound/soc/intel/cht_bsw_rt5672.c +++ b/sound/soc/intel/cht_bsw_rt5672.c @@ -178,9 +178,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP2 to 24-bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S24_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); return 0; }
diff --git a/sound/soc/intel/haswell.c b/sound/soc/intel/haswell.c index 35edf51..00fddd3 100644 --- a/sound/soc/intel/haswell.c +++ b/sound/soc/intel/haswell.c @@ -56,9 +56,7 @@ static int haswell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP0 to 16 bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S16_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S16_LE); return 0; }
At Sun, 8 Feb 2015 16:01:36 -0800, yang.a.fang@intel.com wrote:
From: "Fang, Yang A" yang.a.fang@intel.com
Add a helper to set pcm format directly from params
Signed-off-by: Fang, Yang A yang.a.fang@intel.com
include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 6b1c78f..e6fe584 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -366,4 +366,11 @@ params_physical_width(const struct snd_pcm_hw_params *p) return snd_pcm_format_physical_width(params_format(p)); }
+static inline void +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) +{
- snd_mask_set(&p->masks[SNDRV_PCM_HW_PARAM_FORMAT -
SNDRV_PCM_HW_PARAM_FIRST_MASK], (__force int)fmt);
Use hw_params_mask().
Takashi
-----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Sunday, February 08, 2015 10:41 PM To: Fang, Yang A Cc: broonie@kernel.org; lgirdwood@gmail.com; alsa-devel@alsa-project.org; N, Harshapriya; Koul, Vinod; Jain, Praveen K; Iriawan, Denny; Strasser, Kevin; Lin, Mengdong Subject: Re: [PATCH v2 1/2] ALSA: Add params_set_format helper
At Sun, 8 Feb 2015 16:01:36 -0800, yang.a.fang@intel.com wrote:
From: "Fang, Yang A" yang.a.fang@intel.com
Add a helper to set pcm format directly from params
Signed-off-by: Fang, Yang A yang.a.fang@intel.com
include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 6b1c78f..e6fe584 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -366,4 +366,11 @@ params_physical_width(const struct
snd_pcm_hw_params *p)
return snd_pcm_format_physical_width(params_format(p)); }
+static inline void +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t
fmt)
+{
- snd_mask_set(&p->masks[SNDRV_PCM_HW_PARAM_FORMAT -
SNDRV_PCM_HW_PARAM_FIRST_MASK], (__force int)fmt);
Use hw_params_mask().
Takashi
Did not find hw_params_mask . Do you mean change params_set_format (struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) To hw_params_mask(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) ?
Thanks, Yang
At Mon, 9 Feb 2015 06:58:39 +0000, Fang, Yang A wrote:
-----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Sunday, February 08, 2015 10:41 PM To: Fang, Yang A Cc: broonie@kernel.org; lgirdwood@gmail.com; alsa-devel@alsa-project.org; N, Harshapriya; Koul, Vinod; Jain, Praveen K; Iriawan, Denny; Strasser, Kevin; Lin, Mengdong Subject: Re: [PATCH v2 1/2] ALSA: Add params_set_format helper
At Sun, 8 Feb 2015 16:01:36 -0800, yang.a.fang@intel.com wrote:
From: "Fang, Yang A" yang.a.fang@intel.com
Add a helper to set pcm format directly from params
Signed-off-by: Fang, Yang A yang.a.fang@intel.com
include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 6b1c78f..e6fe584 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -366,4 +366,11 @@ params_physical_width(const struct
snd_pcm_hw_params *p)
return snd_pcm_format_physical_width(params_format(p)); }
+static inline void +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t
fmt)
+{
- snd_mask_set(&p->masks[SNDRV_PCM_HW_PARAM_FORMAT -
SNDRV_PCM_HW_PARAM_FIRST_MASK], (__force int)fmt);
Use hw_params_mask().
Takashi
Did not find hw_params_mask . Do you mean change params_set_format (struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) To hw_params_mask(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) ?
No, just like
static inline void params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) { snd_mask_set(hw_param_mask(p, SNDRV_PCM_HW_PARAM_FORMAT), (__force int)fmt); }
Takashi
From: "Fang, Yang A" yang.a.fang@intel.com
Add a helper to set pcm format directly from params
Signed-off-by: Fang, Yang A yang.a.fang@intel.com --- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 6b1c78f..f41a2d7 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -366,4 +366,11 @@ params_physical_width(const struct snd_pcm_hw_params *p) return snd_pcm_format_physical_width(params_format(p)); }
+static inline void +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) +{ + snd_mask_set(hw_param_mask(p, SNDRV_PCM_HW_PARAM_FORMAT), + (__force int)fmt); +} + #endif /* __SOUND_PCM_PARAMS_H */
From: "Fang, Yang A" yang.a.fang@intel.com
this patch will fix below sparse warnings
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] val got restricted snd_pcm_format_t [usertype] <noident>
sound/soc/intel/haswell.c:61:37 sound/soc/intel/broadwell.c:115:37: sound/soc/intel/bytcr_dpcm_rt5640.c:118:37: sound/soc/intel/cht_bsw_rt5672.c:183:37: sound/soc/intel/cht_bsw_rt5645.c:208:37:
Signed-off-by: Fang, Yang A yang.a.fang@intel.com --- sound/soc/intel/broadwell.c | 4 +--- sound/soc/intel/bytcr_dpcm_rt5640.c | 4 +--- sound/soc/intel/cht_bsw_rt5645.c | 4 +--- sound/soc/intel/cht_bsw_rt5672.c | 4 +--- sound/soc/intel/haswell.c | 4 +--- 5 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/sound/soc/intel/broadwell.c b/sound/soc/intel/broadwell.c index 9cf7d01..fba2ef5 100644 --- a/sound/soc/intel/broadwell.c +++ b/sound/soc/intel/broadwell.c @@ -110,9 +110,7 @@ static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP0 to 16 bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S16_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S16_LE); return 0; }
diff --git a/sound/soc/intel/bytcr_dpcm_rt5640.c b/sound/soc/intel/bytcr_dpcm_rt5640.c index 5930862..3b262d0 100644 --- a/sound/soc/intel/bytcr_dpcm_rt5640.c +++ b/sound/soc/intel/bytcr_dpcm_rt5640.c @@ -113,9 +113,7 @@ static int byt_codec_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP2 to 24-bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S24_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); return 0; }
diff --git a/sound/soc/intel/cht_bsw_rt5645.c b/sound/soc/intel/cht_bsw_rt5645.c index b6f8377..0fc5db7 100644 --- a/sound/soc/intel/cht_bsw_rt5645.c +++ b/sound/soc/intel/cht_bsw_rt5645.c @@ -203,9 +203,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP2 to 24-bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S24_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); return 0; }
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c index ff01662..c56f9df 100644 --- a/sound/soc/intel/cht_bsw_rt5672.c +++ b/sound/soc/intel/cht_bsw_rt5672.c @@ -178,9 +178,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP2 to 24-bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S24_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S24_LE); return 0; }
diff --git a/sound/soc/intel/haswell.c b/sound/soc/intel/haswell.c index 35edf51..00fddd3 100644 --- a/sound/soc/intel/haswell.c +++ b/sound/soc/intel/haswell.c @@ -56,9 +56,7 @@ static int haswell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, channels->min = channels->max = 2;
/* set SSP0 to 16 bit */ - snd_mask_set(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - - SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S16_LE); + params_set_format(params, SNDRV_PCM_FORMAT_S16_LE); return 0; }
At Mon, 9 Feb 2015 00:18:11 -0800, yang.a.fang@intel.com wrote:
From: "Fang, Yang A" yang.a.fang@intel.com
Add a helper to set pcm format directly from params
Signed-off-by: Fang, Yang A yang.a.fang@intel.com
Mark, feel free to take my ack when you apply these patches. Reviewed-by: Takashi Iwai tiwai@suse.de
thanks,
Takashi
include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 6b1c78f..f41a2d7 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -366,4 +366,11 @@ params_physical_width(const struct snd_pcm_hw_params *p) return snd_pcm_format_physical_width(params_format(p)); }
+static inline void +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) +{
- snd_mask_set(hw_param_mask(p, SNDRV_PCM_HW_PARAM_FORMAT),
(__force int)fmt);
+}
#endif /* __SOUND_PCM_PARAMS_H */
1.7.9.5
On Mon, Feb 09, 2015 at 11:50:27AM +0100, Takashi Iwai wrote:
Mark, feel free to take my ack when you apply these patches. Reviewed-by: Takashi Iwai tiwai@suse.de
OK, it'll be after the merge window now.
On Mon, Feb 09, 2015 at 12:18:11AM -0800, yang.a.fang@intel.com wrote:
From: "Fang, Yang A" yang.a.fang@intel.com
Add a helper to set pcm format directly from params
Applied both, thanks.
participants (4)
-
Fang, Yang A
-
Mark Brown
-
Takashi Iwai
-
yang.a.fang@intel.com