diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/ac97/snd_ac97_compat.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sound/ac97/snd_ac97_compat.c b/sound/ac97/snd_ac97_compat.c index 61544e0d8de4..8bab44f74bb8 100644 --- a/sound/ac97/snd_ac97_compat.c +++ b/sound/ac97/snd_ac97_compat.c | |||
@@ -15,6 +15,11 @@ | |||
15 | 15 | ||
16 | #include "ac97_core.h" | 16 | #include "ac97_core.h" |
17 | 17 | ||
18 | static void compat_ac97_release(struct device *dev) | ||
19 | { | ||
20 | kfree(to_ac97_t(dev)); | ||
21 | } | ||
22 | |||
18 | static void compat_ac97_reset(struct snd_ac97 *ac97) | 23 | static void compat_ac97_reset(struct snd_ac97 *ac97) |
19 | { | 24 | { |
20 | struct ac97_codec_device *adev = to_ac97_device(ac97->private_data); | 25 | struct ac97_codec_device *adev = to_ac97_device(ac97->private_data); |
@@ -65,21 +70,31 @@ static struct snd_ac97_bus compat_soc_ac97_bus = { | |||
65 | struct snd_ac97 *snd_ac97_compat_alloc(struct ac97_codec_device *adev) | 70 | struct snd_ac97 *snd_ac97_compat_alloc(struct ac97_codec_device *adev) |
66 | { | 71 | { |
67 | struct snd_ac97 *ac97; | 72 | struct snd_ac97 *ac97; |
73 | int ret; | ||
68 | 74 | ||
69 | ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL); | 75 | ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL); |
70 | if (ac97 == NULL) | 76 | if (ac97 == NULL) |
71 | return ERR_PTR(-ENOMEM); | 77 | return ERR_PTR(-ENOMEM); |
72 | 78 | ||
73 | ac97->dev = adev->dev; | ||
74 | ac97->private_data = adev; | 79 | ac97->private_data = adev; |
75 | ac97->bus = &compat_soc_ac97_bus; | 80 | ac97->bus = &compat_soc_ac97_bus; |
81 | |||
82 | ac97->dev.parent = &adev->dev; | ||
83 | ac97->dev.release = compat_ac97_release; | ||
84 | dev_set_name(&ac97->dev, "%s-compat", dev_name(&adev->dev)); | ||
85 | ret = device_register(&ac97->dev); | ||
86 | if (ret) { | ||
87 | put_device(&ac97->dev); | ||
88 | return ERR_PTR(ret); | ||
89 | } | ||
90 | |||
76 | return ac97; | 91 | return ac97; |
77 | } | 92 | } |
78 | EXPORT_SYMBOL_GPL(snd_ac97_compat_alloc); | 93 | EXPORT_SYMBOL_GPL(snd_ac97_compat_alloc); |
79 | 94 | ||
80 | void snd_ac97_compat_release(struct snd_ac97 *ac97) | 95 | void snd_ac97_compat_release(struct snd_ac97 *ac97) |
81 | { | 96 | { |
82 | kfree(ac97); | 97 | device_unregister(&ac97->dev); |
83 | } | 98 | } |
84 | EXPORT_SYMBOL_GPL(snd_ac97_compat_release); | 99 | EXPORT_SYMBOL_GPL(snd_ac97_compat_release); |
85 | 100 | ||