Skip to contentSkip to conversation

ASoC: pcm_native: Use 'snd_pcm_format_t' type

PATCH In review Fabio Estevam 5 participants 10 messages May 6, 2018 – May 9, 2018

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

PATCH 1/3 ASoC: pcm_native: Use 'snd_pcm_format_t' type

From: Fabio Estevam <[email protected]>

'snd_pcm_format_t' type is better suited for iterating through the SNDRV_PCM_FORMAT members.

Also, use SNDRV_PCM_FORMAT_FIRST for the first element.

---
 sound/core/pcm_native.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
sound/core/pcm_native.c +4 -4
index 7585444..5d62b7c 100644
@@ -2051,13 +2051,13 @@ static int snd_pcm_hw_rule_mulkdiv(struct snd_pcm_hw_params *params,
 static int snd_pcm_hw_rule_format(struct snd_pcm_hw_params *params,
 				  struct snd_pcm_hw_rule *rule)
 {
-	unsigned int k;
+	snd_pcm_format_t k;
 	const struct snd_interval *i =
 				hw_param_interval_c(params, rule->deps[0]);
 	struct snd_mask m;
 	struct snd_mask *mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
 	snd_mask_any(&m);
-	for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) {
+	for (k = SNDRV_PCM_FORMAT_FIRST; k <= SNDRV_PCM_FORMAT_LAST; ++k) {
 		int bits;
 		if (! snd_mask_test(mask, k))
 			continue;
@@ -2074,12 +2074,12 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params,
 				       struct snd_pcm_hw_rule *rule)
 {
 	struct snd_interval t;
-	unsigned int k;
+	snd_pcm_format_t k;
 	t.min = UINT_MAX;
 	t.max = 0;
 	t.openmin = 0;
 	t.openmax = 0;
-	for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) {
+	for (k = SNDRV_PCM_FORMAT_FIRST; k <= SNDRV_PCM_FORMAT_LAST; ++k) {
 		int bits;
 		if (! snd_mask_test(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), k))
 			continue;
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/3 ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type

From: Fabio Estevam <[email protected]>

'snd_pcm_format_t' type is better suited for iterating through the SNDRV_PCM_FORMAT members.

Also, use SNDRV_PCM_FORMAT_FIRST for the first element.

---
 sound/soc/davinci/davinci-mcasp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/davinci/davinci-mcasp.c +3 -2
index 03ba218..bde2252 100644
@@ -1214,11 +1214,12 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params,
 	struct snd_mask nfmt;
 	int rate = params_rate(params);
 	int slots = rd->mcasp->tdm_slots;
-	int i, count = 0;
+	snd_pcm_format_t i;
+	int count = 0;
 
 	snd_mask_none(&nfmt);
 
-	for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
+	for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) {
 		if (snd_mask_test(fmt, i)) {
 			uint sbits = snd_pcm_format_width(i);
 			int ppm;
Signature · 1 line
2.7.4
#6 lore raw

PATCH 3/3 ASoC: omap-pcm: Use 'snd_pcm_format_t' type

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

'snd_pcm_format_t' type is better suited for iterating through the SNDRV_PCM_FORMAT members.

Also, use SNDRV_PCM_FORMAT_FIRST for the first element.

---
 sound/soc/omap/omap-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/omap/omap-pcm.c +2 -2
index 778cc8f..d1b07e4 100644
@@ -56,9 +56,9 @@ static struct snd_pcm_hardware omap_pcm_hardware = {
 /* sDMA supports only 1, 2, and 4 byte transfer elements. */
 static void omap_pcm_limit_supported_formats(void)
 {
-	int i;
+	snd_pcm_format_t i;
 
-	for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
+	for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) {
 		switch (snd_pcm_format_physical_width(i)) {
 		case 8:
 		case 16:
Signature · 1 line
2.7.4
#8 lore raw
In reply to Fabio Estevam
I love your patch! Perhaps something to improve:

Hi Fabio,

I love your patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on v4.17-rc3 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Fabio-Estevam/ASoC-pcm_native-Use-snd_pcm_format_t-type/20180506-235347
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

sound/core/pcm_native.c:561:51: sparse: incorrect type in assignment (different base types) @@ expected restricted snd_pcm_state_t [usertype] state @@ got t [usertype] state @@
sound/core/pcm_native.c:561:51: expected restricted snd_pcm_state_t [usertype] state
sound/core/pcm_native.c:561:51: got int [signed] state
sound/core/pcm_native.c:726:38: sparse: incorrect type in argument 2 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:726:38: expected int [signed] state
sound/core/pcm_native.c:726:38: got restricted snd_pcm_state_t [usertype] <noident>
sound/core/pcm_native.c:738:38: sparse: incorrect type in argument 2 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:738:38: expected int [signed] state
sound/core/pcm_native.c:738:38: got restricted snd_pcm_state_t [usertype] <noident>
sound/core/pcm_native.c:787:38: sparse: incorrect type in argument 2 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:787:38: expected int [signed] state
sound/core/pcm_native.c:787:38: got restricted snd_pcm_state_t [usertype] <noident>
sound/core/pcm_native.c:1197:32: sparse: incorrect type in assignment (different base types) @@ expected restricted snd_pcm_state_t [usertype] state @@ got t [usertype] state @@
sound/core/pcm_native.c:1197:32: expected restricted snd_pcm_state_t [usertype] state
sound/core/pcm_native.c:1197:32: got int [signed] state
sound/core/pcm_native.c:1221:31: sparse: incorrect type in argument 3 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:1221:31: expected int [signed] state
sound/core/pcm_native.c:1221:31: got restricted snd_pcm_state_t [usertype] <noident>
sound/core/pcm_native.c:1228:40: sparse: incorrect type in argument 3 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:1228:40: expected int [signed] state
sound/core/pcm_native.c:1228:40: got restricted snd_pcm_state_t [usertype] <noident>
sound/core/pcm_native.c:1254:28: sparse: restricted snd_pcm_state_t degrades to integer
sound/core/pcm_native.c:1256:40: sparse: incorrect type in assignment (different base types) @@ expected restricted snd_pcm_state_t [usertype] state @@ got t [usertype] state @@
sound/core/pcm_native.c:1256:40: expected restricted snd_pcm_state_t [usertype] state
sound/core/pcm_native.c:1256:40: got int [signed] state
sound/core/pcm_native.c:1280:64: sparse: incorrect type in argument 3 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:1280:64: expected int [signed] state
sound/core/pcm_native.c:1280:64: got restricted snd_pcm_state_t [usertype] state
sound/core/pcm_native.c:1296:38: sparse: incorrect type in argument 3 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:1296:38: expected int [signed] state
sound/core/pcm_native.c:1296:38: got restricted snd_pcm_state_t [usertype] <noident>
sound/core/pcm_native.c:1655:38: sparse: incorrect type in argument 2 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:1655:38: expected int [signed] state
sound/core/pcm_native.c:1655:38: got restricted snd_pcm_state_t [usertype] <noident>
sound/core/pcm_native.c:1721:61: sparse: incorrect type in argument 2 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:1721:61: expected int [signed] state
sound/core/pcm_native.c:1721:61: got restricted snd_pcm_state_t [usertype] <noident>
sound/core/pcm_native.c:1722:63: sparse: incorrect type in argument 2 (different base types) @@ expected int [signed] state @@ got restricted snd_pcm_state_int [signed] state @@
sound/core/pcm_native.c:1722:63: expected int [signed] state
sound/core/pcm_native.c:1722:63: got restricted snd_pcm_state_t [usertype] <noident>
sound/core/pcm_native.c:1739:76: sparse: incorrect type in initializer (different base types) @@ expected int [signed] new_state @@ got restricted snint [signed] new_state @@
sound/core/pcm_native.c:1739:76: expected int [signed] new_state
sound/core/pcm_native.c:1739:76: got restricted snd_pcm_state_t
sound/core/pcm_native.c:1842:40: sparse: expression using sizeof(void) sound/core/pcm_native.c:1842:40: sparse: expression using sizeof(void) sound/core/pcm_native.c:2060:42: sparse: restricted snd_pcm_format_t degrades to integer sound/core/pcm_native.c:2060:47: sparse: restricted snd_pcm_format_t degrades to integer

>> sound/core/pcm_native.c:2062:43: sparse: incorrect type in argument 2 (different base types) @@    expected unsigned int [unsigned] val @@    got restricted snd_pcm_format_unsigned int [unsigned] val @@

sound/core/pcm_native.c:2062:43: expected unsigned int [unsigned] val
sound/core/pcm_native.c:2062:43: got restricted snd_pcm_format_t [assigned] [usertype] k
sound/core/pcm_native.c:2068:44: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [unsigned] val @@ got restricted snd_pcm_format_unsigned int [unsigned] val @@
sound/core/pcm_native.c:2068:44: expected unsigned int [unsigned] val
sound/core/pcm_native.c:2068:44: got restricted snd_pcm_format_t [assigned] [usertype] k
sound/core/pcm_native.c:2060:70: sparse: restricted snd_pcm_format_t degrades to integer sound/core/pcm_native.c:2082:42: sparse: restricted snd_pcm_format_t degrades to integer sound/core/pcm_native.c:2082:47: sparse: restricted snd_pcm_format_t degrades to integer
sound/core/pcm_native.c:2084:87: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [unsigned] val @@ got restricted snd_pcm_format_unsigned int [unsigned] val @@
sound/core/pcm_native.c:2084:87: expected unsigned int [unsigned] val
sound/core/pcm_native.c:2084:87: got restricted snd_pcm_format_t [assigned] [usertype] k
sound/core/pcm_native.c:2082:70: sparse: restricted snd_pcm_format_t degrades to integer sound/core/pcm_native.c:2266:30: sparse: restricted snd_pcm_access_t degrades to integer sound/core/pcm_native.c:2268:30: sparse: restricted snd_pcm_access_t degrades to integer sound/core/pcm_native.c:2271:38: sparse: restricted snd_pcm_access_t degrades to integer sound/core/pcm_native.c:2273:38: sparse: restricted snd_pcm_access_t degrades to integer sound/core/pcm_native.c:2275:38: sparse: restricted snd_pcm_access_t degrades to integer sound/core/pcm_native.c:2285:86: sparse: restricted snd_pcm_subformat_t degrades to integer include/sound/pcm.h:1092:47: sparse: cast removes address space of expression include/sound/pcm.h:1099:47: sparse: cast removes address space of expression include/sound/pcm.h:1099:47: sparse: cast removes address space of expression include/sound/pcm.h:1092:47: sparse: cast removes address space of expression
sound/core/pcm_compat.c:232:13: sparse: incorrect type in assignment (different base types) @@ expected signed int [signed] [explicitly-signed] __pu_val @@ got restricted snd_pcm_statsigned int [signed] [explicitly-signed] __pu_val @@
sound/core/pcm_compat.c:232:13: expected signed int [signed] [explicitly-signed] __pu_val
sound/core/pcm_compat.c:232:13: got restricted snd_pcm_state_t [addressable] [assigned] [usertype] state
sound/core/pcm_compat.c:241:13: sparse: incorrect type in assignment (different base types) @@ expected signed int [signed] [explicitly-signed] __pu_val @@ got restricted snd_pcm_statsigned int [signed] [explicitly-signed] __pu_val @@
sound/core/pcm_compat.c:241:13: expected signed int [signed] [explicitly-signed] __pu_val
sound/core/pcm_compat.c:241:13: got restricted snd_pcm_state_t [addressable] [assigned] [usertype] suspended_state
sound/core/pcm_compat.c:296:13: sparse: incorrect type in assignment (different base types) @@ expected signed int [signed] [explicitly-signed] __pu_val @@ got restricted snd_pcm_statsigned int [signed] [explicitly-signed] __pu_val @@
sound/core/pcm_compat.c:296:13: expected signed int [signed] [explicitly-signed] __pu_val
sound/core/pcm_compat.c:296:13: got restricted snd_pcm_state_t [addressable] [assigned] [usertype] state
sound/core/pcm_compat.c:305:13: sparse: incorrect type in assignment (different base types) @@ expected signed int [signed] [explicitly-signed] __pu_val @@ got restricted snd_pcm_statsigned int [signed] [explicitly-signed] __pu_val @@
sound/core/pcm_compat.c:305:13: expected signed int [signed] [explicitly-signed] __pu_val
sound/core/pcm_compat.c:305:13: got restricted snd_pcm_state_t [addressable] [assigned] [usertype] suspended_state
include/sound/pcm.h:1092:47: sparse: cast removes address space of expression include/sound/pcm.h:1099:47: sparse: cast removes address space of expression
sound/core/pcm_compat.c:529:13: sparse: incorrect type in assignment (different base types) @@ expected signed int [signed] [explicitly-signed] __pu_val @@ got restrictesigned int [signed] [explicitly-signed] __pu_val @@
sound/core/pcm_compat.c:529:13: expected signed int [signed] [explicitly-signed] __pu_val
sound/core/pcm_compat.c:529:13: got restricted snd_pcm_state_t [assigned] [usertype] state
sound/core/pcm_compat.c:532:13: sparse: incorrect type in assignment (different base types) @@ expected signed int [signed] [explicitly-signed] __pu_val @@ got restrictesigned int [signed] [explicitly-signed] __pu_val @@
sound/core/pcm_compat.c:532:13: expected signed int [signed] [explicitly-signed] __pu_val
sound/core/pcm_compat.c:532:13: got restricted snd_pcm_state_t [assigned] [usertype] suspended_state
sound/core/pcm_compat.c:618:13: sparse: incorrect type in assignment (different base types) @@ expected signed int [signed] [explicitly-signed] __pu_val @@ got restrictesigned int [signed] [explicitly-signed] __pu_val @@
sound/core/pcm_compat.c:618:13: expected signed int [signed] [explicitly-signed] __pu_val
sound/core/pcm_compat.c:618:13: got restricted snd_pcm_state_t [assigned] [usertype] state
sound/core/pcm_compat.c:621:13: sparse: incorrect type in assignment (different base types) @@ expected signed int [signed] [explicitly-signed] __pu_val @@ got restrictesigned int [signed] [explicitly-signed] __pu_val @@
sound/core/pcm_compat.c:621:13: expected signed int [signed] [explicitly-signed] __pu_val
sound/core/pcm_compat.c:621:13: got restricted snd_pcm_state_t [assigned] [usertype] suspended_state
sound/core/pcm_native.c:112:9: sparse: context imbalance in 'snd_pcm_stream_lock' - different lock contexts for basic block sound/core/pcm_native.c:134:28: sparse: context imbalance in 'snd_pcm_stream_unlock' - unexpected unlock sound/core/pcm_native.c:1068:52: sparse: context imbalance in 'snd_pcm_action_group' - unexpected unlock

vim +2062 sound/core/pcm_native.c

^1da177e Linus Torvalds   2005-04-16  2050  
877211f5 Takashi Iwai     2005-11-17  2051  static int snd_pcm_hw_rule_format(struct snd_pcm_hw_params *params,
877211f5 Takashi Iwai     2005-11-17  2052  				  struct snd_pcm_hw_rule *rule)
^1da177e Linus Torvalds   2005-04-16  2053  {
9f3c49af Fabio Estevam    2018-05-06  2054  	snd_pcm_format_t k;
b55f9fdc Takashi Sakamoto 2017-05-17  2055  	const struct snd_interval *i =
b55f9fdc Takashi Sakamoto 2017-05-17  2056  				hw_param_interval_c(params, rule->deps[0]);
877211f5 Takashi Iwai     2005-11-17  2057  	struct snd_mask m;
877211f5 Takashi Iwai     2005-11-17  2058  	struct snd_mask *mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
^1da177e Linus Torvalds   2005-04-16  2059  	snd_mask_any(&m);
9f3c49af Fabio Estevam    2018-05-06  2060  	for (k = SNDRV_PCM_FORMAT_FIRST; k <= SNDRV_PCM_FORMAT_LAST; ++k) {
^1da177e Linus Torvalds   2005-04-16  2061  		int bits;
^1da177e Linus Torvalds   2005-04-16 @2062  		if (! snd_mask_test(mask, k))
^1da177e Linus Torvalds   2005-04-16  2063  			continue;
^1da177e Linus Torvalds   2005-04-16  2064  		bits = snd_pcm_format_physical_width(k);
^1da177e Linus Torvalds   2005-04-16  2065  		if (bits <= 0)
^1da177e Linus Torvalds   2005-04-16  2066  			continue; /* ignore invalid formats */
^1da177e Linus Torvalds   2005-04-16  2067  		if ((unsigned)bits < i->min || (unsigned)bits > i->max)
^1da177e Linus Torvalds   2005-04-16  2068  			snd_mask_reset(&m, k);
^1da177e Linus Torvalds   2005-04-16  2069  	}
^1da177e Linus Torvalds   2005-04-16  2070  	return snd_mask_refine(mask, &m);
^1da177e Linus Torvalds   2005-04-16  2071  }
^1da177e Linus Torvalds   2005-04-16  2072  

:::::: The code at line 2062 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <[email protected]> :::::: CC: Linus Torvalds <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#2 lore raw

Re: [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type

In reply to Fabio Estevam
I love your patch! Perhaps something to improve:

Hi Fabio,

I love your patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on v4.17-rc3 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Fabio-Estevam/ASoC-pcm_native-Use-snd_pcm_format_t-type/20180506-235347
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

sound/soc/davinci/davinci-mcasp.c:1222:42: sparse: restricted snd_pcm_format_t degrades to integer sound/soc/davinci/davinci-mcasp.c:1222:47: sparse: restricted snd_pcm_format_t degrades to integer

>> sound/soc/davinci/davinci-mcasp.c:1223:40: sparse: incorrect type in argument 2 (different base types) @@    expected unsigned int [unsigned] val @@    got restricted snd_pcm_format_unsigned int [unsigned] val @@

sound/soc/davinci/davinci-mcasp.c:1223:40: expected unsigned int [unsigned] val
sound/soc/davinci/davinci-mcasp.c:1223:40: got restricted snd_pcm_format_t [assigned] [usertype] i
sound/soc/davinci/davinci-mcasp.c:1234:53: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [unsigned] val @@ got restricted snd_pcm_format_unsigned int [unsigned] val @@
sound/soc/davinci/davinci-mcasp.c:1234:53: expected unsigned int [unsigned] val
sound/soc/davinci/davinci-mcasp.c:1234:53: got restricted snd_pcm_format_t [assigned] [usertype] i
sound/soc/davinci/davinci-mcasp.c:1222:71: sparse: restricted snd_pcm_format_t degrades to integer
sound/soc/davinci/davinci-mcasp.c:1662:73: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 const [usertype] *p @@ got icted __be32 const [usertype] *p @@
sound/soc/davinci/davinci-mcasp.c:1662:73: expected restricted __be32 const [usertype] *p
sound/soc/davinci/davinci-mcasp.c:1662:73: got unsigned int const [usertype] *

vim +1223 sound/soc/davinci/davinci-mcasp.c

a75a053f Jyri Sarha     2015-03-20  1208  
a75a053f Jyri Sarha     2015-03-20  1209  static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params,
a75a053f Jyri Sarha     2015-03-20  1210  					struct snd_pcm_hw_rule *rule)
a75a053f Jyri Sarha     2015-03-20  1211  {
a75a053f Jyri Sarha     2015-03-20  1212  	struct davinci_mcasp_ruledata *rd = rule->private;
a75a053f Jyri Sarha     2015-03-20  1213  	struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
a75a053f Jyri Sarha     2015-03-20  1214  	struct snd_mask nfmt;
a75a053f Jyri Sarha     2015-03-20  1215  	int rate = params_rate(params);
1f114f77 Jyri Sarha     2015-04-23  1216  	int slots = rd->mcasp->tdm_slots;
40601663 Fabio Estevam  2018-05-06  1217  	snd_pcm_format_t i;
40601663 Fabio Estevam  2018-05-06  1218  	int count = 0;
a75a053f Jyri Sarha     2015-03-20  1219  
a75a053f Jyri Sarha     2015-03-20  1220  	snd_mask_none(&nfmt);
a75a053f Jyri Sarha     2015-03-20  1221  
40601663 Fabio Estevam  2018-05-06 @1222  	for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) {
a75a053f Jyri Sarha     2015-03-20 @1223  		if (snd_mask_test(fmt, i)) {
dd55ff83 Jyri Sarha     2015-09-09  1224  			uint sbits = snd_pcm_format_width(i);
a75a053f Jyri Sarha     2015-03-20  1225  			int ppm;
a75a053f Jyri Sarha     2015-03-20  1226  
dd55ff83 Jyri Sarha     2015-09-09  1227  			if (rd->mcasp->slot_width)
dd55ff83 Jyri Sarha     2015-09-09  1228  				sbits = rd->mcasp->slot_width;
dd55ff83 Jyri Sarha     2015-09-09  1229  
3e9bee11 Peter Ujfalusi 2016-05-09  1230  			ppm = davinci_mcasp_calc_clk_div(rd->mcasp,
3e9bee11 Peter Ujfalusi 2016-05-09  1231  							 sbits * slots * rate,
3e9bee11 Peter Ujfalusi 2016-05-09  1232  							 false);
a75a053f Jyri Sarha     2015-03-20  1233  			if (abs(ppm) < DAVINCI_MAX_RATE_ERROR_PPM) {
a75a053f Jyri Sarha     2015-03-20  1234  				snd_mask_set(&nfmt, i);
a75a053f Jyri Sarha     2015-03-20  1235  				count++;
a75a053f Jyri Sarha     2015-03-20  1236  			}
a75a053f Jyri Sarha     2015-03-20  1237  		}
a75a053f Jyri Sarha     2015-03-20  1238  	}
a75a053f Jyri Sarha     2015-03-20  1239  	dev_dbg(rd->mcasp->dev,
1f114f77 Jyri Sarha     2015-04-23  1240  		"%d possible sample format for %d Hz and %d tdm slots\n",
1f114f77 Jyri Sarha     2015-04-23  1241  		count, rate, slots);
a75a053f Jyri Sarha     2015-03-20  1242  
a75a053f Jyri Sarha     2015-03-20  1243  	return snd_mask_refine(fmt, &nfmt);
a75a053f Jyri Sarha     2015-03-20  1244  }
a75a053f Jyri Sarha     2015-03-20  1245  

:::::: The code at line 1223 was first introduced by commit
:::::: a75a053f1eefbbbbae0f7d6bf1ed12ce012112b7 ASoC: davinci-mcasp: Set rule constraints if implicit BCLK divider is used

:::::: TO: Jyri Sarha <[email protected]>
:::::: CC: Mark Brown <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

maintainer
#3 lore raw

Re: [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type

In reply to Fabio Estevam
Quoted 6 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

'snd_pcm_format_t' type is better suited for iterating through the SNDRV_PCM_FORMAT members.

Also, use SNDRV_PCM_FORMAT_FIRST for the first element.

Adding Peter.

Quoted 28 lines
---
 sound/soc/davinci/davinci-mcasp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/davinci/davinci-mcasp.c +3 -2
index 03ba218..bde2252 100644
@@ -1214,11 +1214,12 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params,
 	struct snd_mask nfmt;
 	int rate = params_rate(params);
 	int slots = rd->mcasp->tdm_slots;
-	int i, count = 0;
+	snd_pcm_format_t i;
+	int count = 0;
 
 	snd_mask_none(&nfmt);
 
-	for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
+	for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) {
 		if (snd_mask_test(fmt, i)) {
 			uint sbits = snd_pcm_format_width(i);
 			int ppm;
Signature · 1 line
2.7.4
maintainer
#7 lore raw

Re: [PATCH 3/3] ASoC: omap-pcm: Use 'snd_pcm_format_t' type

In reply to Fabio Estevam
Quoted 4 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

'snd_pcm_format_t' type is better suited for iterating through the SNDRV_PCM_FORMAT members.

Peter (who you didn't CC on this or the DaVinci patch) is just in the process of removing the omap-pcm driver so it'll just cause hassle to apply this.

#4 lore raw

Re: [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type

In reply to Mark Brown

Hi Mark,

Quoted 9 lines · Mark Brown
Quoted 6 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

'snd_pcm_format_t' type is better suited for iterating through the SNDRV_PCM_FORMAT members.

Also, use SNDRV_PCM_FORMAT_FIRST for the first element.

Adding Peter.

Please ignore this series for now.

kbuild reported issues with it and I will investigate.

Thanks

#9 lore raw
In reply to Fabio Estevam

Hi,

Quoted 11 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

'snd_pcm_format_t' type is better suited for iterating through the SNDRV_PCM_FORMAT members.

Also, use SNDRV_PCM_FORMAT_FIRST for the first element.

---
  sound/core/pcm_native.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

You use 'ASoC' prefix in titile of this patch, but...

$ git log --oneline sound/core/pcm_native.c
...
41412fe92118 ALSA: pcm: Change return type to vm_fault_t
f853dcaae2f5 ALSA: core: Report audio_tstamp in snd_pcm_sync_ptr
912e4c332037 ALSA: pcm: Return negative delays from SNDRV_PCM_IOCTL_DELAY.
c99c5a3bb575 ALSA: pcm: Unify delay calculation in snd_pcm_status() and snd_pcm_delay()
6448fcba2a7f ALSA: pcm: Unify playback and capture poll callbacks
763e5067aac9 ALSA: pcm: Clean up with snd_pcm_avail() and snd_pcm_hw_avail() helpers
...

It's better to use 'ALSA' prefix with 'pcm' or 'core' tag because your change is outside of ALSA SoC part and can affects whole PCM related stuffs. Furthermore, you need to post it to a maintainer of this subsystem as long as you'd like to request the maintainer to apply it.

Thanks

Takashi Sakamoto

#5 lore raw

Re: [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type

In reply to Fabio Estevam

Hi,

Quoted 19 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

'snd_pcm_format_t' type is better suited for iterating through the SNDRV_PCM_FORMAT members.

Also, use SNDRV_PCM_FORMAT_FIRST for the first element.

---
 sound/soc/davinci/davinci-mcasp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/davinci/davinci-mcasp.c +0 -0
index 03ba218..bde2252 100644
@@ -1214,11 +1214,12 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params,
 	struct snd_mask nfmt;
 	int rate = params_rate(params);

sound/soc/davinci/davinci-mcasp.c static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params, · line 1223

Quoted 10 lines
sound/soc/davinci/davinci-mcasp.c +3 -2
 	int slots = rd->mcasp->tdm_slots;
-	int i, count = 0;
+	snd_pcm_format_t i;
+	int count = 0;
 
 	snd_mask_none(&nfmt);
 
-	for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
+	for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) {
 		if (snd_mask_test(fmt, i)) {

snd_mask_test(fmt, (__force unsigned int)i)

and the same for the snd_mask_set()

sound/soc/davinci/davinci-mcasp.c static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params, · line 1225

Quoted 3 lines
sound/soc/davinci/davinci-mcasp.c +0 -0
 			uint sbits = snd_pcm_format_width(i);
 			int ppm;

Please CC me for davinci patches, I would have missed this patch if Mark did not CCd me.

Signature · 8 lines
Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel