[alsa-devel] [PATCH v2 3/3] ASoC: tegra: add tegra machine driver using wm9712 codec

Stephen Warren swarren at wwwdotorg.org
Tue Jan 8 23:17:37 CET 2013


On 01/04/2013 06:18 PM, Lucas Stach wrote:
> This adds a very simple machine driver using the Wolfson wm9712 AC97
> codec.

> diff --git a/sound/soc/tegra/tegra_wm9712.c b/sound/soc/tegra/tegra_wm9712.c


> +static int tegra_wm9712_init(struct snd_soc_pcm_runtime *rtd)

> +	err = snd_soc_dapm_sync(dapm);
> +	if (err)
> +		return err;
> +
> +	return 0;

That block is just "return snd_soc_dapm_sync(dapm);"

> +static int tegra_wm9712_driver_probe(struct platform_device *pdev)

> +	machine->codec = platform_device_alloc("wm9712-codec", -1);

Hmmm. I thought that could be auto-instantiated based on probing the
AC'97 bus for whatever was there?

> +	ret = platform_device_add(machine->codec);
> +	if (ret)
> +		goto codec_put;

After this point, ...

> +	ret = snd_soc_of_parse_card_name(card, "nvidia,model");
> +	if (ret)
> +		goto codec_put;

don't the error paths need to undo platform_device_add()? Or does
platform_device_put() do that automatically?

> +codec_put:
> +	platform_device_put(machine->codec);
> +	return ret;
> +}

> +static int tegra_wm9712_driver_remove(struct platform_device *pdev)

> +	platform_device_put(machine->codec);

Same comment here.



More information about the Alsa-devel mailing list