[alsa-devel] [PATCH v12 2/6] ASoC: amd: Refactoring of DAI from DMA driver
Pierre-Louis Bossart
pierre-louis.bossart at linux.intel.com
Fri Nov 22 16:33:52 CET 2019
> static int acp3x_audio_probe(struct platform_device *pdev)
> {
> - int status;
> struct resource *res;
> struct i2s_dev_data *adata;
> unsigned int irqflags;
> + int status, ret;
>
> if (!pdev->dev.platform_data) {
> dev_err(&pdev->dev, "platform_data not retrieved\n");
> @@ -622,7 +426,7 @@ static int acp3x_audio_probe(struct platform_device *pdev)
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!res) {
> - dev_err(&pdev->dev, "IORESOURCE_IRQ FAILED\n");
> + dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n");
> return -ENODEV;
> }
>
> @@ -632,60 +436,64 @@ static int acp3x_audio_probe(struct platform_device *pdev)
>
> adata->acp3x_base = devm_ioremap(&pdev->dev, res->start,
> resource_size(res));
> + if (!adata->acp3x_base)
> + return -ENOMEM;
>
> res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> if (!res) {
> dev_err(&pdev->dev, "IORESOURCE_IRQ FAILED\n");
> - return -ENODEV;
> + return -ENOMEM;
it's odd for a -ENOMEM code to returned for IRQs?
> }
>
> adata->i2s_irq = res->start;
> - adata->play_stream = NULL;
> - adata->capture_stream = NULL;
>
> dev_set_drvdata(&pdev->dev, adata);
> /* Initialize ACP */
> status = acp3x_init(adata->acp3x_base);
> if (status)
> return -ENODEV;
> +
> status = devm_snd_soc_register_component(&pdev->dev,
> &acp3x_i2s_component,
> - &acp3x_i2s_dai_driver, 1);
> + NULL, 0);
> if (status) {
> - dev_err(&pdev->dev, "Fail to register acp i2s dai\n");
> + dev_err(&pdev->dev, "Fail to register acp i2s component\n");
> + ret = -ENODEV;
> goto dev_err;
> }
> status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
> irqflags, "ACP3x_I2S_IRQ", adata);
> if (status) {
> dev_err(&pdev->dev, "ACP3x I2S IRQ request failed\n");
> + ret = -ENODEV;
> goto dev_err;
> }
>
> - pm_runtime_set_autosuspend_delay(&pdev->dev, 10000);
> + pm_runtime_set_autosuspend_delay(&pdev->dev, 5000);
> pm_runtime_use_autosuspend(&pdev->dev);
> pm_runtime_enable(&pdev->dev);
> return 0;
> +
> dev_err:
> status = acp3x_deinit(adata->acp3x_base);
> if (status)
> dev_err(&pdev->dev, "ACP de-init failed\n");
> else
> - dev_info(&pdev->dev, "ACP de-initialized\n");
> - /*ignore device status and return driver probe error*/
> - return -ENODEV;
> + dev_dbg(&pdev->dev, "ACP de-initialized\n");
> + return ret;
> }
More information about the Alsa-devel
mailing list