ASoC: Intel: fix machine driver warnings
Subsystems (3)
PATCH 1/1 ASoC: Intel: fix machine driver warnings
From: "Fang, Yang A" <[email protected]>
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:37sound/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:
--- 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(-)
sound/soc/intel/broadwell.c +1 -1
@@ -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 ; }
sound/soc/intel/bytcr_dpcm_rt5640.c +1 -1
@@ -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 ; }
sound/soc/intel/cht_bsw_rt5645.c +1 -1
@@ -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 ; }
sound/soc/intel/cht_bsw_rt5672.c +1 -1
@@ -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 ; }
sound/soc/intel/haswell.c +1 -1
@@ -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 ; }
Signature · 1 line
1.7.9.5
At Thu, 5 Feb 2015 16:19:16 -0800,
Quoted 29 lines · [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
this patch will fix below sparse warnings
warning: incorrect type in argument 2 (different base types) expected unsigned int [unsigned] val
got restrictedsnd_pcm_format_t[usertype] <noident>
sound/soc/intel/haswell.c:61:37sound/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 <[email protected]>--- 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(-)sound/soc/intel/broadwell.c +0
-0
sound/soc/intel/broadwell.c static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, · line 117
Quoted 7 lines
sound/soc/intel/broadwell.c +1
-1@@ -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
Quoted 55 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, February 05, 2015 11:23 PM
To: Fang, Yang A
Cc: [email protected]; [email protected]; [email protected]; Iriawan, Denny; N, Harshapriya; Jain, Praveen K; Strasser, Kevin; Koul, Vinod; Lin, Mengdong
Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: fix machine driver warningsAt Thu, 5 Feb 2015 16:19:16 -0800,
sound/soc/intel/broadwell.c static int broadwell_ssp0_fixup(struct
Quoted 29 lines · [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
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:37sound/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 <[email protected]>--- 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(-)sound/soc/intel/broadwell.c +0
-0@@ -112,7 +112,7 @@ static int broadwell_ssp0_fixup(struct
snd_soc_pcm_runtime*rtd,sound/soc/intel/broadwell.c static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
Quoted 6 lines
sound/soc/intel/broadwell.c +0
-0/* set SSP0 to 16 bit */ snd_mask_set(¶ms-masks[SNDRV_PCM_HW_PARAM_FORMAT -
sound/soc/intel/broadwell.c +1
-1SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S16_LE); + (__forceint)SNDRV_PCM_FORMAT_S16_LE);
Quoted 2 lines
return 0;
}Oh, it's ugly, but unavoidable as long as we use this form.
Quoted 8 lines
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?
Quoted 4 lines
Quoted 4 lines
masks[SNDRV_PCM_HW_PARAM_FORMAT -
sound/soc/intel/broadwell.c +1
-1SNDRV_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,
Quoted 63 lines · Yang A
Quoted 54 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, February 05, 2015 11:23 PM
To: Fang, Yang A
Cc: [email protected]; [email protected]; [email protected]; Iriawan, Denny; N, Harshapriya; Jain, Praveen K; Strasser, Kevin; Koul, Vinod; Lin, Mengdong
Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: fix machine driver warningsAt Thu, 5 Feb 2015 16:19:16 -0800,
sound/soc/intel/broadwell.c static int broadwell_ssp0_fixup(struct
Quoted 29 lines · [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
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:37sound/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 <[email protected]>--- 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(-)sound/soc/intel/broadwell.c +0
-0@@ -112,7 +112,7 @@ static int broadwell_ssp0_fixup(struct
snd_soc_pcm_runtime*rtd,sound/soc/intel/broadwell.c static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
Quoted 6 lines
sound/soc/intel/broadwell.c +0
-0/* set SSP0 to 16 bit */ snd_mask_set(¶ms-masks[SNDRV_PCM_HW_PARAM_FORMAT -
sound/soc/intel/broadwell.c +1
-1SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S16_LE); + (__forceint)SNDRV_PCM_FORMAT_S16_LE);
Quoted 2 lines
return 0;
}Oh, it's ugly, but unavoidable as long as we use this form.
Quoted 8 lines
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
Quoted 7 lines
Hi Takashi,
Thanks for the feedback. Are you looking for something like this?
Quoted 4 lines
sound/soc/intel/broadwell.c static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
Quoted 4 lines
masks[SNDRV_PCM_HW_PARAM_FORMAT -
sound/soc/intel/broadwell.c +1
-1SNDRV_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
Quoted 89 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, February 05, 2015 11:47 PM
To: Fang, Yang A
Cc: [email protected]; [email protected]; [email protected]; Iriawan, Denny; N, Harshapriya; Jain, Praveen K; Strasser, Kevin; Koul, Vinod; Lin, Mengdong
Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: fix machine driver warningsAt Fri, 6 Feb 2015 07:42:03 +0000,
Quoted 53 lines · Yang A
Quoted 53 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, February 05, 2015 11:23 PM
To: Fang, Yang A
Cc: [email protected]; [email protected]; [email protected]; Iriawan, Denny; N, Harshapriya; Jain, Praveen K; Strasser, Kevin; Koul, Vinod; Lin, Mengdong
Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: fix machine driver warningsAt Thu, 5 Feb 2015 16:19:16 -0800,
sound/soc/intel/broadwell.c static int broadwell_ssp0_fixup(struct
Quoted 29 lines · [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
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:37sound/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 <[email protected]>--- 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(-)(quoted diff) +0
-0
b/sound/soc/intel/broadwell.cindex 9cf7d01..0ca4015 100644sound/soc/intel/broadwell.c +0
-0@@ -112,7 +112,7 @@ static int broadwell_ssp0_fixup(struct
snd_soc_pcm_runtime*rtd,sound/soc/intel/broadwell.c static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
Quoted 6 lines
sound/soc/intel/broadwell.c +0
-0/* set SSP0 to 16 bit */ snd_mask_set(¶ms-masks[SNDRV_PCM_HW_PARAM_FORMAT -
sound/soc/intel/broadwell.c +1
-1SNDRV_PCM_HW_PARAM_FIRST_MASK], - SNDRV_PCM_FORMAT_S16_LE); + (__forceint)SNDRV_PCM_FORMAT_S16_LE);
Quoted 2 lines
return 0;
}Quoted 7 lines
Quoted 7 lines
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.
Quoted 11 lines
Quoted 3 lines
Takashi
Hi Takashi,
Thanks for the feedback. Are you looking for something like this?
Quoted 4 lines
sound/soc/intel/broadwell.c static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
Quoted 4 lines
masks[SNDRV_PCM_HW_PARAM_FORMAT -
sound/soc/intel/broadwell.c +1
-1SNDRV_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:
Quoted 8 lines
static inline void params_set_format(struct
snd_pcm_hw_params*p,
snd_pcm_format_tformat){ snd_mask_set(p, (__force int)format); }Takashi
I see.
Thanks
Yang
PATCH v2 1/2 ALSA: Add params_set_format helper
In reply to [email protected]From: "Fang, Yang A" <[email protected]>
Add a helper to set pcm format directly from params
--- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/sound/pcm_params.h +7 -0
@@ -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 */
Signature · 1 line
1.7.9.5
PATCH v2 2/2 ASoC: Intel: fix machine driver warnings
From: "Fang, Yang A" <[email protected]>
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:37sound/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:
--- 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(-)
sound/soc/intel/broadwell.c +1 -3
@@ -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 ; }
sound/soc/intel/bytcr_dpcm_rt5640.c +1 -3
@@ -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 ; }
sound/soc/intel/cht_bsw_rt5645.c +1 -3
@@ -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 ; }
sound/soc/intel/cht_bsw_rt5672.c +1 -3
@@ -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 ; }
sound/soc/intel/haswell.c +1 -3
@@ -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 ; }
Signature · 1 line
1.7.9.5
Re: [PATCH v2 1/2] ALSA: Add params_set_format helper
In reply to [email protected]At Sun, 8 Feb 2015 16:01:36 -0800,
Quoted 15 lines · [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
Add a helper to set pcm format directly from params
Signed-off-by Fang, Yang A <[email protected]>--- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)include/sound/pcm_params.h +0
-0
include/sound/pcm_params.h params_physical_width(const struct snd_pcm_hw_params *p) · line 373
Quoted 8 lines
include/sound/pcm_params.h +5
-0@@ -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
Re: [PATCH v2 1/2] ALSA: Add params_set_format helper
Quoted 35 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Sunday, February 08, 2015 10:41 PM
To: Fang, Yang A
Cc: [email protected]; [email protected]; [email protected]; N, Harshapriya; Koul, Vinod; Jain, Praveen K; Iriawan, Denny; Strasser, Kevin; Lin, Mengdong
Subject: Re: [PATCH v2 1/2] ALSA: Addparams_set_formathelperAt Sun, 8 Feb 2015 16:01:36 -0800,
include/sound/pcm_params.h params_physical_width(const struct
Quoted 15 lines · [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
Add a helper to set pcm format directly from params
Signed-off-by Fang, Yang A <[email protected]>--- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)include/sound/pcm_params.h +0
-0@@ -366,4 +366,11 @@ params_physical_width(const struct
snd_pcm_hw_params*p)include/sound/pcm_params.h params_physical_width(const struct snd_pcm_hw_params *p)
Quoted 5 lines
include/sound/pcm_params.h +2
-0return snd_pcm_format_physical_width (params_format (p)); } +static inline void +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_tfmt)
Quoted 8 lines
include/sound/pcm_params.h params_physical_width(const struct snd_pcm_hw_params *p) · line 373
Quoted 3 lines
include/sound/pcm_params.h +3
-0+{ +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) Tohw_params_mask(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) ?
Thanks,
Yang
Re: [PATCH v2 1/2] ALSA: Add params_set_format helper
At Mon, 9 Feb 2015 06:58:39 +0000,
Quoted 43 lines · Yang A
Quoted 43 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Sunday, February 08, 2015 10:41 PM
To: Fang, Yang A
Cc: [email protected]; [email protected]; [email protected]; N, Harshapriya; Koul, Vinod; Jain, Praveen K; Iriawan, Denny; Strasser, Kevin; Lin, Mengdong
Subject: Re: [PATCH v2 1/2] ALSA: Addparams_set_formathelperAt Sun, 8 Feb 2015 16:01:36 -0800,
include/sound/pcm_params.h params_physical_width(const struct
Quoted 15 lines · [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
Add a helper to set pcm format directly from params
Signed-off-by Fang, Yang A <[email protected]>--- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)include/sound/pcm_params.h +0
-0@@ -366,4 +366,11 @@ params_physical_width(const struct
snd_pcm_hw_params*p)include/sound/pcm_params.h params_physical_width(const struct snd_pcm_hw_params *p)
Quoted 5 lines
include/sound/pcm_params.h +2
-0return snd_pcm_format_physical_width (params_format (p)); } +static inline void +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_tfmt)
include/sound/pcm_params.h params_physical_width(const struct snd_pcm_hw_params *p) · line 373
Quoted 3 lines
include/sound/pcm_params.h +3
-0+{ +snd_mask_set (&p->masks[SNDRV_PCM_HW_PARAM_FORMAT - +SNDRV_PCM_HW_PARAM_FIRST_MASK ], (__force int )fmt);Use
hw_params_mask().
Quoted 6 lines
Quoted 1 line
Takashi
Did not find
hw_params_mask.
Do you mean changeparams_set_format(structsnd_pcm_hw_params*p,snd_pcm_format_tfmt) Tohw_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
PATCH v3 1/2 ALSA: Add params_set_format helper
In reply to [email protected]From: "Fang, Yang A" <[email protected]>
Add a helper to set pcm format directly from params
--- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/sound/pcm_params.h +7 -0
@@ -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 */
Signature · 1 line
1.7.9.5
PATCH v3 2/2 ASoC: Intel: fix machine driver warnings
From: "Fang, Yang A" <[email protected]>
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:37sound/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:
--- 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(-)
sound/soc/intel/broadwell.c +1 -3
@@ -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 ; }
sound/soc/intel/bytcr_dpcm_rt5640.c +1 -3
@@ -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 ; }
sound/soc/intel/cht_bsw_rt5645.c +1 -3
@@ -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 ; }
sound/soc/intel/cht_bsw_rt5672.c +1 -3
@@ -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 ; }
sound/soc/intel/haswell.c +1 -3
@@ -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 ; }
Signature · 1 line
1.7.9.5
Re: [PATCH v3 1/2] ALSA: Add params_set_format helper
In reply to [email protected]At Mon, 9 Feb 2015 00:18:11 -0800,
Quoted 6 lines · [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
Add a helper to set pcm format directly from params
Signed-off-by Fang, Yang A <[email protected]>
Mark, feel free to take my ack when you apply these patches.
thanks,
Takashi
Quoted 23 lines
--- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+)include/sound/pcm_params.h +7
-0@@ -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 */ Signature · 1 line
1.7.9.5
Mark Brown
maintainerRe: [PATCH v3 1/2] ALSA: Add params_set_format helper
Quoted 2 lines · Takashi Iwai
Mark, feel free to take my ack when you apply these patches.
Reviewed-by Takashi Iwai <[email protected]>
OK, it'll be after the merge window now.
Re: [PATCH v3 1/2] ALSA: Add params_set_format helper
In reply to [email protected]Quoted 3 lines · On Mon, Feb 09, 2015 at 12:18:11AM -0800, [email protected] wrote:
From: "Fang, Yang A" <[email protected]>
Add a helper to set pcm format directly from params
Applied both, thanks.