summaryrefslogtreecommitdiff
path: root/sound/soc/soc-ac97.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-11-10 22:41:53 +0100
committerMark Brown <broonie@kernel.org>2014-11-18 15:38:03 +0000
commit358a8bb5628420529e4f0b77068155ca8fa8973b (patch)
tree864f2cc85356c306157d6ce65d24be1914bbb21e /sound/soc/soc-ac97.c
parentbc2632140435cc84f9817f1c362479b23dbdfebc (diff)
downloadlwn-358a8bb5628420529e4f0b77068155ca8fa8973b.tar.gz
lwn-358a8bb5628420529e4f0b77068155ca8fa8973b.zip
ASoC: ac97: Push snd_ac97 pointer to the driver level
Now that the ASoC core no longer needs a handle to the AC'97 device that is associated with a CODEC we can remove it from the snd_soc_codec struct and push it into the individual driver state structs like we do for other communication buses. Doing so creates a clean separation between the AC'97 bus support and the ASoC core. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-ac97.c')
-rw-r--r--sound/soc/soc-ac97.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/sound/soc/soc-ac97.c b/sound/soc/soc-ac97.c
index 920d76c43827..2e10e9a38376 100644
--- a/sound/soc/soc-ac97.c
+++ b/sound/soc/soc-ac97.c
@@ -53,30 +53,33 @@ static void soc_ac97_device_release(struct device *dev)
*
* Initialises AC97 codec resources for use by ad-hoc devices only.
*/
-int snd_soc_new_ac97_codec(struct snd_soc_codec *codec)
+struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec)
{
+ struct snd_ac97 *ac97;
int ret;
- codec->ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
- if (codec->ac97 == NULL)
- return -ENOMEM;
+ ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
+ if (ac97 == NULL)
+ return ERR_PTR(-ENOMEM);
- codec->ac97->bus = &soc_ac97_bus;
- codec->ac97->num = 0;
+ ac97->bus = &soc_ac97_bus;
+ ac97->num = 0;
- codec->ac97->dev.bus = &ac97_bus_type;
- codec->ac97->dev.parent = codec->component.card->dev;
- codec->ac97->dev.release = soc_ac97_device_release;
+ ac97->dev.bus = &ac97_bus_type;
+ ac97->dev.parent = codec->component.card->dev;
+ ac97->dev.release = soc_ac97_device_release;
- dev_set_name(&codec->ac97->dev, "%d-%d:%s",
+ dev_set_name(&ac97->dev, "%d-%d:%s",
codec->component.card->snd_card->number, 0,
codec->component.name);
- ret = device_register(&codec->ac97->dev);
- if (ret)
- put_device(&codec->ac97->dev);
+ ret = device_register(&ac97->dev);
+ if (ret) {
+ put_device(&ac97->dev);
+ return ERR_PTR(ret);
+ }
- return ret;
+ return ac97;
}
EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec);
@@ -86,12 +89,11 @@ EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec);
*
* Frees AC97 codec device resources.
*/
-void snd_soc_free_ac97_codec(struct snd_soc_codec *codec)
+void snd_soc_free_ac97_codec(struct snd_ac97 *ac97)
{
- device_del(&codec->ac97->dev);
- codec->ac97->bus = NULL;
- put_device(&codec->ac97->dev);
- codec->ac97 = NULL;
+ device_del(&ac97->dev);
+ ac97->bus = NULL;
+ put_device(&ac97->dev);
}
EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec);