Skip to contentSkip to conversation

ASoC: Intel: fix machine driver warnings

PATCH In review [email protected] 3 participants 15 messages Feb 6, 2015 – Feb 23, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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: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:

---
 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
index 9cf7d01..0ca4015 100644
@@ -112,7 +112,7 @@ static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
 	/* set SSP0 to 16 bit */
 	snd_mask_set(&params->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
index 5930862..b171443 100644
@@ -115,7 +115,7 @@ static int byt_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 	/* set SSP2 to 24-bit */
 	snd_mask_set(&params->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
index b6f8377..7781fbe 100644
@@ -205,7 +205,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 	/* set SSP2 to 24-bit */
 	snd_mask_set(&params->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
index ff01662..b1842fa 100644
@@ -180,7 +180,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 	/* set SSP2 to 24-bit */
 	snd_mask_set(&params->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
index 35edf51..b19f1ce 100644
@@ -58,7 +58,7 @@ static int haswell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
 	/* set SSP0 to 16 bit */
 	snd_mask_set(&params->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
#1 lore raw

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 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:

---
 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
index 9cf7d01..0ca4015 100644

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(&params->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

#2 lore raw
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 warnings

At 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: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:

---
 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
index 9cf7d01..0ca4015 100644
@@ -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(&params-

masks[SNDRV_PCM_HW_PARAM_FORMAT -

sound/soc/intel/broadwell.c +1 -1
 				    SNDRV_PCM_HW_PARAM_FIRST_MASK],
-				    SNDRV_PCM_FORMAT_S16_LE);
+				    (__force

int)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 -1
 				    SNDRV_PCM_HW_PARAM_FIRST_MASK],
-				    SNDRV_PCM_FORMAT_S16_LE);
+				   params_set_format( SNDRV_PCM_FORMAT_S16_LE));
#3 lore raw

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 warnings

At 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: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:

---
 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
index 9cf7d01..0ca4015 100644
@@ -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(&params-

masks[SNDRV_PCM_HW_PARAM_FORMAT -

sound/soc/intel/broadwell.c +1 -1
 				    SNDRV_PCM_HW_PARAM_FIRST_MASK],
-				    SNDRV_PCM_FORMAT_S16_LE);
+				    (__force

int)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 -1
 				    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

#4 lore raw
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 warnings

At 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 warnings

At 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: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:

---
 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.c index 9cf7d01..0ca4015 100644

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(&params-

masks[SNDRV_PCM_HW_PARAM_FORMAT -

sound/soc/intel/broadwell.c +1 -1
 				    SNDRV_PCM_HW_PARAM_FIRST_MASK],
-				    SNDRV_PCM_FORMAT_S16_LE);
+				    (__force

int)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 -1
 				    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:

Quoted 8 lines

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

#5 lore raw

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
index 6b1c78f..e6fe584 100644
@@ -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
#6 lore raw

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: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:

---
 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
index 9cf7d01..fba2ef5 100644
@@ -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(&params->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
index 5930862..3b262d0 100644
@@ -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(&params->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
index b6f8377..0fc5db7 100644
@@ -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(&params->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
index ff01662..c56f9df 100644
@@ -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(&params->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
index 35edf51..00fddd3 100644
@@ -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(&params->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
#7 lore raw

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

---
 include/sound/pcm_params.h |    7 +++++++
 1 file changed, 7 insertions(+)
include/sound/pcm_params.h +0 -0
index 6b1c78f..e6fe584 100644

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

#8 lore raw

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: Add params_set_format helper

At 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

---
 include/sound/pcm_params.h |    7 +++++++
 1 file changed, 7 insertions(+)
include/sound/pcm_params.h +0 -0
index 6b1c78f..e6fe584 100644
@@ -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 -0
 	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)

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) To
hw_params_mask(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) ?

Thanks,
Yang

#9 lore raw

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: Add params_set_format helper

At 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

---
 include/sound/pcm_params.h |    7 +++++++
 1 file changed, 7 insertions(+)
include/sound/pcm_params.h +0 -0
index 6b1c78f..e6fe584 100644
@@ -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 -0
 	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)

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 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

#10 lore raw

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
index 6b1c78f..f41a2d7 100644
@@ -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
#11 lore raw

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: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:

---
 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
index 9cf7d01..fba2ef5 100644
@@ -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(&params->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
index 5930862..3b262d0 100644
@@ -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(&params->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
index b6f8377..0fc5db7 100644
@@ -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(&params->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
index ff01662..c56f9df 100644
@@ -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(&params->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
index 35edf51..00fddd3 100644
@@ -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(&params->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
Reviewed-by on v3 1/2
#12 lore raw

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

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
index 6b1c78f..f41a2d7 100644
@@ -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
maintainer
#13 lore raw

Re: [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.

OK, it'll be after the merge window now.