diff options
Diffstat (limited to 'sound/pci/ac97/ac97_codec.c')
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index cbf790270c30..33dba10f03e8 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -1813,6 +1813,39 @@ int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops, | |||
1813 | return 0; | 1813 | return 0; |
1814 | } | 1814 | } |
1815 | 1815 | ||
1816 | /* stop no dev release warning */ | ||
1817 | static void ac97_device_release(struct device * dev) | ||
1818 | { | ||
1819 | } | ||
1820 | |||
1821 | /* register ac97 codec to bus */ | ||
1822 | static int snd_ac97_dev_register(snd_device_t *device) | ||
1823 | { | ||
1824 | ac97_t *ac97 = device->device_data; | ||
1825 | int err; | ||
1826 | |||
1827 | ac97->dev.bus = &ac97_bus_type; | ||
1828 | ac97->dev.parent = ac97->bus->card->dev; | ||
1829 | ac97->dev.platform_data = ac97; | ||
1830 | ac97->dev.release = ac97_device_release; | ||
1831 | strncpy(ac97->dev.bus_id, snd_ac97_get_short_name(ac97), BUS_ID_SIZE); | ||
1832 | if ((err = device_register(&ac97->dev)) < 0) { | ||
1833 | snd_printk(KERN_ERR "Can't register ac97 bus\n"); | ||
1834 | ac97->dev.bus = NULL; | ||
1835 | return err; | ||
1836 | } | ||
1837 | return 0; | ||
1838 | } | ||
1839 | |||
1840 | /* unregister ac97 codec */ | ||
1841 | static int snd_ac97_dev_unregister(snd_device_t *device) | ||
1842 | { | ||
1843 | ac97_t *ac97 = device->device_data; | ||
1844 | if (ac97->dev.bus) | ||
1845 | device_unregister(&ac97->dev); | ||
1846 | return snd_ac97_free(ac97); | ||
1847 | } | ||
1848 | |||
1816 | /* build_ops to do nothing */ | 1849 | /* build_ops to do nothing */ |
1817 | static struct snd_ac97_build_ops null_build_ops; | 1850 | static struct snd_ac97_build_ops null_build_ops; |
1818 | 1851 | ||
@@ -1846,6 +1879,8 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
1846 | const ac97_codec_id_t *pid; | 1879 | const ac97_codec_id_t *pid; |
1847 | static snd_device_ops_t ops = { | 1880 | static snd_device_ops_t ops = { |
1848 | .dev_free = snd_ac97_dev_free, | 1881 | .dev_free = snd_ac97_dev_free, |
1882 | .dev_register = snd_ac97_dev_register, | ||
1883 | .dev_unregister = snd_ac97_dev_unregister, | ||
1849 | }; | 1884 | }; |
1850 | 1885 | ||
1851 | snd_assert(rac97 != NULL, return -EINVAL); | 1886 | snd_assert(rac97 != NULL, return -EINVAL); |