[alsa-devel] ASoC: Correct way to set private data in machine driver?

Stephen Warren swarren at nvidia.com
Wed Oct 19 16:57:44 CEST 2011

Abdullah, Omair M wrote at Wednesday, October 19, 2011 12:42 AM:
>   Looking at the code of soc and any machine driver, soc-core uses
> dev_set_drvdata() and dev_get_drvdata() to pass a snd_soc_card
> structure. This needs to be set in the probe to the machine driver's
> snd_soc_card structure. Then how can the machine driver's private data
> be passed around (eg. in probe and remove)?

I imagine all machine drivers do the same, but use:

snd_soc_card_set_drvdata(card, machine);

For example, see sound/soc/tegra/tegra_wm8903.c's probe function about
half-way through. Then, functions use snd_soc_card_get_drvdata to
retrieve that later.


More information about the Alsa-devel mailing list