2020-05-04 07:31:12

by Tang Bin

[permalink] [raw]
Subject: [PATCH] ASoC: qcom: Use devm_platform_ioremap_resource_byname() to simplify code

Use devm_platform_ioremap_resource_byname() instead of
platform_get_resource_byname() + devm_ioremap_resource().

Signed-off-by: Zhang Shengju <[email protected]>
Signed-off-by: Tang Bin <[email protected]>
---
sound/soc/qcom/lpass-cpu.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index dbce7e92b..885c1f2e7 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -417,7 +417,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
{
struct lpass_data *drvdata;
struct device_node *dsp_of_node;
- struct resource *res;
struct lpass_variant *variant;
struct device *dev = &pdev->dev;
const struct of_device_id *match;
@@ -442,9 +441,8 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
drvdata->variant = (struct lpass_variant *)match->data;
variant = drvdata->variant;

- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-lpaif");
-
- drvdata->lpaif = devm_ioremap_resource(&pdev->dev, res);
+ drvdata->lpaif = devm_platform_ioremap_resource_byname(pdev,
+ "lpass-lpaif")
if (IS_ERR((void const __force *)drvdata->lpaif)) {
dev_err(&pdev->dev, "error mapping reg resource: %ld\n",
PTR_ERR((void const __force *)drvdata->lpaif));
--
2.20.1.windows.1




2020-05-05 05:38:28

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] ASoC: qcom: Use devm_platform_ioremap_resource_byname() to simplify code

Hi Tang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on v5.7-rc4 next-20200504]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Tang-Bin/ASoC-qcom-Use-devm_platform_ioremap_resource_byname-to-simplify-code/20200505-051041
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=sh

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>

All errors (new ones prefixed by >>):

sound/soc/qcom/lpass-cpu.c: In function 'asoc_qcom_lpass_cpu_platform_probe':
>> sound/soc/qcom/lpass-cpu.c:445:21: error: expected ';' before 'if'
445 | "lpass-lpaif")
| ^
| ;
446 | if (IS_ERR((void const __force *)drvdata->lpaif)) {
| ~~

vim +445 sound/soc/qcom/lpass-cpu.c

415
416 int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
417 {
418 struct lpass_data *drvdata;
419 struct device_node *dsp_of_node;
420 struct lpass_variant *variant;
421 struct device *dev = &pdev->dev;
422 const struct of_device_id *match;
423 int ret, i, dai_id;
424
425 dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0);
426 if (dsp_of_node) {
427 dev_err(&pdev->dev, "DSP exists and holds audio resources\n");
428 return -EBUSY;
429 }
430
431 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct lpass_data),
432 GFP_KERNEL);
433 if (!drvdata)
434 return -ENOMEM;
435 platform_set_drvdata(pdev, drvdata);
436
437 match = of_match_device(dev->driver->of_match_table, dev);
438 if (!match || !match->data)
439 return -EINVAL;
440
441 drvdata->variant = (struct lpass_variant *)match->data;
442 variant = drvdata->variant;
443
444 drvdata->lpaif = devm_platform_ioremap_resource_byname(pdev,
> 445 "lpass-lpaif")
446 if (IS_ERR((void const __force *)drvdata->lpaif)) {
447 dev_err(&pdev->dev, "error mapping reg resource: %ld\n",
448 PTR_ERR((void const __force *)drvdata->lpaif));
449 return PTR_ERR((void const __force *)drvdata->lpaif);
450 }
451
452 lpass_cpu_regmap_config.max_register = LPAIF_WRDMAPER_REG(variant,
453 variant->wrdma_channels +
454 variant->wrdma_channel_start);
455
456 drvdata->lpaif_map = devm_regmap_init_mmio(&pdev->dev, drvdata->lpaif,
457 &lpass_cpu_regmap_config);
458 if (IS_ERR(drvdata->lpaif_map)) {
459 dev_err(&pdev->dev, "error initializing regmap: %ld\n",
460 PTR_ERR(drvdata->lpaif_map));
461 return PTR_ERR(drvdata->lpaif_map);
462 }
463
464 if (variant->init)
465 variant->init(pdev);
466
467 for (i = 0; i < variant->num_dai; i++) {
468 dai_id = variant->dai_driver[i].id;
469 drvdata->mi2s_osr_clk[dai_id] = devm_clk_get(&pdev->dev,
470 variant->dai_osr_clk_names[i]);
471 if (IS_ERR(drvdata->mi2s_osr_clk[dai_id])) {
472 dev_warn(&pdev->dev,
473 "%s() error getting optional %s: %ld\n",
474 __func__,
475 variant->dai_osr_clk_names[i],
476 PTR_ERR(drvdata->mi2s_osr_clk[dai_id]));
477
478 drvdata->mi2s_osr_clk[dai_id] = NULL;
479 }
480
481 drvdata->mi2s_bit_clk[dai_id] = devm_clk_get(&pdev->dev,
482 variant->dai_bit_clk_names[i]);
483 if (IS_ERR(drvdata->mi2s_bit_clk[dai_id])) {
484 dev_err(&pdev->dev,
485 "error getting %s: %ld\n",
486 variant->dai_bit_clk_names[i],
487 PTR_ERR(drvdata->mi2s_bit_clk[dai_id]));
488 return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]);
489 }
490 }
491
492 drvdata->ahbix_clk = devm_clk_get(&pdev->dev, "ahbix-clk");
493 if (IS_ERR(drvdata->ahbix_clk)) {
494 dev_err(&pdev->dev, "error getting ahbix-clk: %ld\n",
495 PTR_ERR(drvdata->ahbix_clk));
496 return PTR_ERR(drvdata->ahbix_clk);
497 }
498
499 ret = clk_set_rate(drvdata->ahbix_clk, LPASS_AHBIX_CLOCK_FREQUENCY);
500 if (ret) {
501 dev_err(&pdev->dev, "error setting rate on ahbix_clk: %d\n",
502 ret);
503 return ret;
504 }
505 dev_dbg(&pdev->dev, "set ahbix_clk rate to %lu\n",
506 clk_get_rate(drvdata->ahbix_clk));
507
508 ret = clk_prepare_enable(drvdata->ahbix_clk);
509 if (ret) {
510 dev_err(&pdev->dev, "error enabling ahbix_clk: %d\n", ret);
511 return ret;
512 }
513
514 ret = devm_snd_soc_register_component(&pdev->dev,
515 &lpass_cpu_comp_driver,
516 variant->dai_driver,
517 variant->num_dai);
518 if (ret) {
519 dev_err(&pdev->dev, "error registering cpu driver: %d\n", ret);
520 goto err_clk;
521 }
522
523 ret = asoc_qcom_lpass_platform_register(pdev);
524 if (ret) {
525 dev_err(&pdev->dev, "error registering platform driver: %d\n",
526 ret);
527 goto err_clk;
528 }
529
530 return 0;
531
532 err_clk:
533 clk_disable_unprepare(drvdata->ahbix_clk);
534 return ret;
535 }
536 EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_probe);
537

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (5.99 kB)
.config.gz (53.41 kB)
Download all attachments

2020-05-06 13:50:30

by Tang Bin

[permalink] [raw]
Subject: Re: [PATCH] ASoC: qcom: Use devm_platform_ioremap_resource_byname()to simplify code


On 2020/5/5 13:35, kbuild test robot wrote:
> Hi Tang,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on asoc/for-next]
> [also build test ERROR on v5.7-rc4 next-20200504]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
>
> url: https://github.com/0day-ci/linux/commits/Tang-Bin/ASoC-qcom-Use-devm_platform_ioremap_resource_byname-to-simplify-code/20200505-051041
> base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
> config: sh-allmodconfig (attached as .config)
> compiler: sh4-linux-gcc (GCC) 9.3.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=sh
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <[email protected]>
>
> All errors (new ones prefixed by >>):
>
> sound/soc/qcom/lpass-cpu.c: In function 'asoc_qcom_lpass_cpu_platform_probe':
>>> sound/soc/qcom/lpass-cpu.c:445:21: error: expected ';' before 'if'

Sorry, please forget this patch, it's my fault.

Thanks



2020-05-08 17:17:01

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] ASoC: qcom: Use devm_platform_ioremap_resource_byname() to simplify code

On Mon, 4 May 2020 15:28:20 +0800, Tang Bin wrote:
> Use devm_platform_ioremap_resource_byname() instead of
> platform_get_resource_byname() + devm_ioremap_resource().
>
> Signed-off-by: Zhang Shengju <[email protected]>
> Signed-off-by: Tang Bin <[email protected]>
> ---
> sound/soc/qcom/lpass-cpu.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> [...]

Applied to

local tree regulator/for-5.7

Thanks!

[1/1] ASoC: qcom: Use devm_platform_ioremap_resource_byname() to simplify code
(no commit info)

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark