All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: pcm_native: Use 'snd_pcm_format_t' type
@ 2018-05-06 15:47 Fabio Estevam
  2018-05-06 15:47 ` [PATCH 2/3] ASoC: davinci-mcasp: " Fabio Estevam
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Fabio Estevam @ 2018-05-06 15:47 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel

From: Fabio Estevam <fabio.estevam@nxp.com>

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

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 sound/core/pcm_native.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 7585444..5d62b7c 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type
  2018-05-06 15:47 [PATCH 1/3] ASoC: pcm_native: Use 'snd_pcm_format_t' type Fabio Estevam
@ 2018-05-06 15:47 ` Fabio Estevam
  2018-05-06 20:30   ` kbuild test robot
                     ` (2 more replies)
  2018-05-06 15:47 ` [PATCH 3/3] ASoC: omap-pcm: " Fabio Estevam
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 10+ messages in thread
From: Fabio Estevam @ 2018-05-06 15:47 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel

From: Fabio Estevam <fabio.estevam@nxp.com>

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

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 sound/soc/davinci/davinci-mcasp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 03ba218..bde2252 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] ASoC: omap-pcm: Use 'snd_pcm_format_t' type
  2018-05-06 15:47 [PATCH 1/3] ASoC: pcm_native: Use 'snd_pcm_format_t' type Fabio Estevam
  2018-05-06 15:47 ` [PATCH 2/3] ASoC: davinci-mcasp: " Fabio Estevam
@ 2018-05-06 15:47 ` Fabio Estevam
  2018-05-09  8:33   ` Mark Brown
  2018-05-06 20:05 ` [PATCH 1/3] ASoC: pcm_native: " kbuild test robot
  2018-05-09 17:42 ` Takashi Sakamoto
  3 siblings, 1 reply; 10+ messages in thread
From: Fabio Estevam @ 2018-05-06 15:47 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel

From: Fabio Estevam <fabio.estevam@nxp.com>

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

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 sound/soc/omap/omap-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 778cc8f..d1b07e4 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -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:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: pcm_native: Use 'snd_pcm_format_t' type
  2018-05-06 15:47 [PATCH 1/3] ASoC: pcm_native: Use 'snd_pcm_format_t' type Fabio Estevam
  2018-05-06 15:47 ` [PATCH 2/3] ASoC: davinci-mcasp: " Fabio Estevam
  2018-05-06 15:47 ` [PATCH 3/3] ASoC: omap-pcm: " Fabio Estevam
@ 2018-05-06 20:05 ` kbuild test robot
  2018-05-09 17:42 ` Takashi Sakamoto
  3 siblings, 0 replies; 10+ messages in thread
From: kbuild test robot @ 2018-05-06 20:05 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel, broonie, kbuild-all

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 <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type
  2018-05-06 15:47 ` [PATCH 2/3] ASoC: davinci-mcasp: " Fabio Estevam
@ 2018-05-06 20:30   ` kbuild test robot
  2018-05-09  8:34   ` Mark Brown
  2018-05-09 20:49   ` Peter Ujfalusi
  2 siblings, 0 replies; 10+ messages in thread
From: kbuild test robot @ 2018-05-06 20:30 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel, broonie, kbuild-all

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 <jsarha@ti.com>
:::::: CC: Mark Brown <broonie@kernel.org>

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] ASoC: omap-pcm: Use 'snd_pcm_format_t' type
  2018-05-06 15:47 ` [PATCH 3/3] ASoC: omap-pcm: " Fabio Estevam
@ 2018-05-09  8:33   ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2018-05-09  8:33 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, Peter Ujfalusi, alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 371 bytes --]

On Sun, May 06, 2018 at 12:47:45PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> '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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type
  2018-05-06 15:47 ` [PATCH 2/3] ASoC: davinci-mcasp: " Fabio Estevam
  2018-05-06 20:30   ` kbuild test robot
@ 2018-05-09  8:34   ` Mark Brown
  2018-05-09 14:14     ` Fabio Estevam
  2018-05-09 20:49   ` Peter Ujfalusi
  2 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2018-05-09  8:34 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, Peter Ujfalusi, alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 1222 bytes --]

On Sun, May 06, 2018 at 12:47:44PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> '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.

> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
>  sound/soc/davinci/davinci-mcasp.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
> index 03ba218..bde2252 100644
> --- a/sound/soc/davinci/davinci-mcasp.c
> +++ b/sound/soc/davinci/davinci-mcasp.c
> @@ -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;
> -- 
> 2.7.4
> 

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type
  2018-05-09  8:34   ` Mark Brown
@ 2018-05-09 14:14     ` Fabio Estevam
  0 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2018-05-09 14:14 UTC (permalink / raw)
  To: Mark Brown; +Cc: Fabio Estevam, Peter Ujfalusi, alsa-devel

Hi Mark,

On Wed, May 9, 2018 at 5:34 AM, Mark Brown <broonie@kernel.org> wrote:
> On Sun, May 06, 2018 at 12:47:44PM -0300, Fabio Estevam wrote:
>> From: Fabio Estevam <fabio.estevam@nxp.com>
>>
>> '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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: pcm_native: Use 'snd_pcm_format_t' type
  2018-05-06 15:47 [PATCH 1/3] ASoC: pcm_native: Use 'snd_pcm_format_t' type Fabio Estevam
                   ` (2 preceding siblings ...)
  2018-05-06 20:05 ` [PATCH 1/3] ASoC: pcm_native: " kbuild test robot
@ 2018-05-09 17:42 ` Takashi Sakamoto
  3 siblings, 0 replies; 10+ messages in thread
From: Takashi Sakamoto @ 2018-05-09 17:42 UTC (permalink / raw)
  To: Fabio Estevam, broonie; +Cc: Fabio Estevam, alsa-devel

Hi,

On May 7 2018 00:47, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> '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.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
>   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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] ASoC: davinci-mcasp: Use 'snd_pcm_format_t' type
  2018-05-06 15:47 ` [PATCH 2/3] ASoC: davinci-mcasp: " Fabio Estevam
  2018-05-06 20:30   ` kbuild test robot
  2018-05-09  8:34   ` Mark Brown
@ 2018-05-09 20:49   ` Peter Ujfalusi
  2 siblings, 0 replies; 10+ messages in thread
From: Peter Ujfalusi @ 2018-05-09 20:49 UTC (permalink / raw)
  To: Fabio Estevam, broonie; +Cc: Fabio Estevam, alsa-devel

Hi,

On 05/06/2018 06:47 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> '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.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
>  sound/soc/davinci/davinci-mcasp.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
> index 03ba218..bde2252 100644
> --- a/sound/soc/davinci/davinci-mcasp.c
> +++ b/sound/soc/davinci/davinci-mcasp.c
> @@ -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)) {

snd_mask_test(fmt, (__force unsigned int)i)

and the same for the snd_mask_set()

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

-- 
Péter

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-05-09 20:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-06 15:47 [PATCH 1/3] ASoC: pcm_native: Use 'snd_pcm_format_t' type Fabio Estevam
2018-05-06 15:47 ` [PATCH 2/3] ASoC: davinci-mcasp: " Fabio Estevam
2018-05-06 20:30   ` kbuild test robot
2018-05-09  8:34   ` Mark Brown
2018-05-09 14:14     ` Fabio Estevam
2018-05-09 20:49   ` Peter Ujfalusi
2018-05-06 15:47 ` [PATCH 3/3] ASoC: omap-pcm: " Fabio Estevam
2018-05-09  8:33   ` Mark Brown
2018-05-06 20:05 ` [PATCH 1/3] ASoC: pcm_native: " kbuild test robot
2018-05-09 17:42 ` Takashi Sakamoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.