[alsa-devel] [PATCH v3 4/6] ASoC: zx: Add zx296702 SPDIF support

Lars-Peter Clausen lars at metafoo.de
Fri May 29 16:03:38 CEST 2015


On 05/29/2015 03:31 PM, Jun Nie wrote:
[...]
> +static int zx_spdif_probe(struct platform_device *pdev)
> +{
> +	struct resource *res;
> +	struct zx_spdif_info *zx_spdif;
> +	int ret;
> +
> +	zx_spdif =  kzalloc(sizeof(*zx_spdif), GFP_KERNEL);

extra space and devm_

> +	if (!zx_spdif)
> +		return -ENOMEM;
> +
> +	zx_spdif->dai_clk = devm_clk_get(&pdev->dev, "tx");
> +	if (IS_ERR(zx_spdif->dai_clk)) {
> +		dev_err(&pdev->dev, "Fail to get clk\n");
> +		return PTR_ERR(zx_spdif->dai_clk);
> +	}
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	zx_spdif->mapbase = res->start;
> +	zx_spdif->reg_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (!zx_spdif->reg_base) {
> +		dev_err(&pdev->dev, "ioremap failed!\n");
> +		return -EIO;
> +	}
> +
> +	zx_spdif_dev_init(zx_spdif->reg_base);
> +	platform_set_drvdata(pdev, zx_spdif);
> +
> +	ret = snd_soc_register_component(&pdev->dev, &zx_spdif_component,
> +					 &zx_spdif_dai, 1);

devm_

> +	if (ret) {
> +		dev_err(&pdev->dev, "Register DAI failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
> +	if (ret)
> +		dev_err(&pdev->dev, "Register platform PCM failed: %d\n", ret);
> +
> +	return ret;



More information about the Alsa-devel mailing list