Re: [PATCH v0] ASoC: rsnd: core: Check convert rate in rsnd_hw_params
On 03.12.2020 08:57, Kuninori Morimoto wrote: I think you want to add "fallthrough" between case 1/3/4 and case 0 ? Hi Morimoto-san, Yes, I will add it in the updated version of the patch. Thanks. The checkpatch script did not tell me about that. Best regards, Misha
Re: [PATCH v0] ASoC: rsnd: core: Check convert rate in rsnd_hw_params
Hi Mikhail Thank you for your patch > + switch (rsnd_mod_id(src_mod)) { > + /* > + * SRC0 can downsample 4, 6 and 8 channel audio up to 4 > times. > + * SRC1, SRC3 and SRC4 can downsample 4 channel audio > + * up to 4 times. > + * SRC1, SRC3 and SRC4 can downsample 6 and 8 channel > audio > + * no more than twice. > + */ > + case 1: > + case 3: > + case 4: > + if (channel > 4) { > + k_down = 2; > + break; > + } > + case 0: > + if (channel > 2) > + k_down = 4; > + break; > + > + /* Other SRC units do not support more than 2 channels > */ > + default: > + if (channel > 2) > + return -EINVAL; > + } I think you want to add "fallthrough" between case 1/3/4 and case 0 ? Thank you for your help !! Best regards --- Kuninori Morimoto
Re: [PATCH v0] ASoC: rsnd: core: Check convert rate in rsnd_hw_params
Hi, Thank you for the patch! Yet something to improve: [auto build test ERROR on asoc/for-next] [also build test ERROR on v5.10-rc6 next-20201201] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/mdurnev-gmail-com/ASoC-rsnd-core-Check-convert-rate-in-rsnd_hw_params/20201202-191131 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: arm64-randconfig-r012-20201202 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 2671fccf0381769276ca8246ec0499adcb9b0355) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/2ffb6c8ec578fd78d5962f7bc7c38eeb5c6a4bd1 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review mdurnev-gmail-com/ASoC-rsnd-core-Check-convert-rate-in-rsnd_hw_params/20201202-191131 git checkout 2ffb6c8ec578fd78d5962f7bc7c38eeb5c6a4bd1 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All error/warnings (new ones prefixed by >>): >> sound/soc/sh/rcar/core.c:1447:56: error: use of undeclared identifier >> 'fe_channel'; did you mean 'channel'? channel = io->converted_chan ? io->converted_chan : fe_channel; ^~ channel sound/soc/sh/rcar/core.c:1444:8: note: 'channel' declared here int channel; ^ >> sound/soc/sh/rcar/core.c:1442:8: warning: ISO C90 forbids mixing >> declarations and code [-Wdeclaration-after-statement] int k_up = 6; ^ 1 warning and 1 error generated. vim +1447 sound/soc/sh/rcar/core.c 1391 1392 /* 1393 * pcm ops 1394 */ 1395 static int rsnd_hw_params(struct snd_soc_component *component, 1396struct snd_pcm_substream *substream, 1397struct snd_pcm_hw_params *hw_params) 1398 { 1399 struct snd_soc_dai *dai = rsnd_substream_to_dai(substream); 1400 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); 1401 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); 1402 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); 1403 1404 /* 1405 * rsnd assumes that it might be used under DPCM if user want to use 1406 * channel / rate convert. Then, rsnd should be FE. 1407 * And then, this function will be called *after* BE settings. 1408 * this means, each BE already has fixuped hw_params. 1409 * see 1410 * dpcm_fe_dai_hw_params() 1411 * dpcm_be_dai_hw_params() 1412 */ 1413 io->converted_rate = 0; 1414 io->converted_chan = 0; 1415 if (fe->dai_link->dynamic) { 1416 struct rsnd_priv *priv = rsnd_io_to_priv(io); 1417 struct device *dev = rsnd_priv_to_dev(priv); 1418 struct snd_soc_dpcm *dpcm; 1419 struct snd_pcm_hw_params *be_params; 1420 int stream = substream->stream; 1421 1422 for_each_dpcm_be(fe, stream, dpcm) { 1423 be_params = >hw_params; 1424 if (params_channels(hw_params) != params_channels(be_params)) 1425 io->converted_chan = params_channels(be_params); 1426 if (params_rate(hw_params) != params_rate(be_params)) 1427 io->converted_rate = params_rate(be_params); 1428 } 1429 if (io->converted_chan) 1430 dev_dbg(dev, "convert channels = %d\n", io->converted_chan); 1431 if (io->converted_rate) { 1432 dev_dbg(dev, "convert rate = %d\n", io->converted_rate); 1433 1434 /* 1435 * SRC supports convert rates from params_rate(hw_params)/k_down 1436 * to params_rate(hw_params)*k_up, where k_up is always 6, and 1437
Re: [PATCH v0] ASoC: rsnd: core: Check convert rate in rsnd_hw_params
Hi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on asoc/for-next] [also build test WARNING on v5.10-rc6 next-20201201] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/mdurnev-gmail-com/ASoC-rsnd-core-Check-convert-rate-in-rsnd_hw_params/20201202-191131 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: riscv-allyesconfig (attached as .config) compiler: riscv64-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/2ffb6c8ec578fd78d5962f7bc7c38eeb5c6a4bd1 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review mdurnev-gmail-com/ASoC-rsnd-core-Check-convert-rate-in-rsnd_hw_params/20201202-191131 git checkout 2ffb6c8ec578fd78d5962f7bc7c38eeb5c6a4bd1 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): sound/soc/sh/rcar/core.c: In function 'rsnd_hw_params': >> sound/soc/sh/rcar/core.c:1442:4: warning: ISO C90 forbids mixed declarations >> and code [-Wdeclaration-after-statement] 1442 |int k_up = 6; |^~~ sound/soc/sh/rcar/core.c:1447:56: error: 'fe_channel' undeclared (first use in this function); did you mean 'channel'? 1447 |channel = io->converted_chan ? io->converted_chan : fe_channel; |^~ |channel sound/soc/sh/rcar/core.c:1447:56: note: each undeclared identifier is reported only once for each function it appears in >> sound/soc/sh/rcar/core.c:1460:8: warning: this statement may fall through >> [-Wimplicit-fallthrough=] 1460 | if (channel > 4) { |^ sound/soc/sh/rcar/core.c:1464:4: note: here 1464 |case 0: |^~~~ vim +1442 sound/soc/sh/rcar/core.c 1391 1392 /* 1393 * pcm ops 1394 */ 1395 static int rsnd_hw_params(struct snd_soc_component *component, 1396struct snd_pcm_substream *substream, 1397struct snd_pcm_hw_params *hw_params) 1398 { 1399 struct snd_soc_dai *dai = rsnd_substream_to_dai(substream); 1400 struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); 1401 struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); 1402 struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); 1403 1404 /* 1405 * rsnd assumes that it might be used under DPCM if user want to use 1406 * channel / rate convert. Then, rsnd should be FE. 1407 * And then, this function will be called *after* BE settings. 1408 * this means, each BE already has fixuped hw_params. 1409 * see 1410 * dpcm_fe_dai_hw_params() 1411 * dpcm_be_dai_hw_params() 1412 */ 1413 io->converted_rate = 0; 1414 io->converted_chan = 0; 1415 if (fe->dai_link->dynamic) { 1416 struct rsnd_priv *priv = rsnd_io_to_priv(io); 1417 struct device *dev = rsnd_priv_to_dev(priv); 1418 struct snd_soc_dpcm *dpcm; 1419 struct snd_pcm_hw_params *be_params; 1420 int stream = substream->stream; 1421 1422 for_each_dpcm_be(fe, stream, dpcm) { 1423 be_params = >hw_params; 1424 if (params_channels(hw_params) != params_channels(be_params)) 1425 io->converted_chan = params_channels(be_params); 1426 if (params_rate(hw_params) != params_rate(be_params)) 1427 io->converted_rate = params_rate(be_params); 1428 } 1429 if (io->converted_chan) 1430 dev_dbg(dev, "convert channels = %d\n", io->converted_chan); 1431 if (io->converted_rate) { 1432 dev_dbg(dev, "convert rate = %d\n", io->converted_rate); 1433 1434 /* 1435 * SRC supports convert rates from params_rate(hw_params)/k_down 1436 * to params_rate(hw_params)*k_up, where k_up is always 6, and 1437