On Thu, Jan 27, 2011 at 11:56:56AM -0700, Stephen Warren wrote:
This patch reworks the exported PM functions to take the card instead of the dev, thus allowing machine drivers to use a custom drvdata type. The disadvantage is that every machine driver that does this must then implement something similar to the soc_suspend/resume_dev functions in this patch.
This is exactly why I didn't implement them this way - almost all drivers are just going to want to use the exact same boilerplate pm_ops so we don't want them having to all implement the same mapping functions. There's also enough callbacks from the core into the machine drivers to mean that I'm not sure we'd need to do anything else, and keeping things in the ASoC model is much more in the flow of pushing PM into the core.
An alternative might be to add a drvdata field to struct snd_soc_card, accompanied by snd_soc_set/get_drvdata functions.
Another alternative would be to wrap the snd_soc_card stored in the drvdata within another type, and use container_of whenever the machine driver needed the data in the wrapper type.
Either of these would work. The former is going to be much more friendly for users.