summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_bind.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-17 21:46:37 +0100
committerTakashi Iwai <tiwai@suse.de>2015-03-23 13:15:51 +0100
commite3d280fc6d42017b2379503fbda83655a05294fe (patch)
treecc89c4b22054d620163f0d6bdad901f43957dbf5 /sound/pci/hda/hda_bind.c
parent3372dbdd8ca11f51be8c6a30b2bc79eb04c4a902 (diff)
ALSA: hda - Make snd_hda_bus_type public
Define the common hd-audio driver and device types to bind over snd_hda_bus_type publicly. This allows to implement other type of device and driver code over hd-audio bus. Now both struct hda_codec and struct hda_codec_driver inherit these new struct hdac_device and struct hdac_driver, respectively. The bus registration is done in subsys_initcall() to assure it before any other driver registrations. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_bind.c')
-rw-r--r--sound/pci/hda/hda_bind.c47
1 files changed, 14 insertions, 33 deletions
diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index 1f40ce3c1696..e3bd2807b644 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -47,11 +47,11 @@ static struct hda_vendor_id hda_vendor_ids[] = {
/*
* find a matching codec preset
*/
-static int hda_bus_match(struct device *dev, struct device_driver *drv)
+static int hda_codec_match(struct hdac_device *dev, struct hdac_driver *drv)
{
- struct hda_codec *codec = container_of(dev, struct hda_codec, dev);
+ struct hda_codec *codec = container_of(dev, struct hda_codec, core);
struct hda_codec_driver *driver =
- container_of(drv, struct hda_codec_driver, driver);
+ container_of(drv, struct hda_codec_driver, core);
const struct hda_codec_preset *preset;
/* check probe_id instead of vendor_id if set */
u32 id = codec->probe_id ? codec->probe_id : codec->vendor_id;
@@ -154,20 +154,22 @@ static void hda_codec_driver_shutdown(struct device *dev)
int __hda_codec_driver_register(struct hda_codec_driver *drv, const char *name,
struct module *owner)
{
- drv->driver.name = name;
- drv->driver.owner = owner;
- drv->driver.bus = &snd_hda_bus_type;
- drv->driver.probe = hda_codec_driver_probe;
- drv->driver.remove = hda_codec_driver_remove;
- drv->driver.shutdown = hda_codec_driver_shutdown;
- drv->driver.pm = &hda_codec_driver_pm;
- return driver_register(&drv->driver);
+ drv->core.driver.name = name;
+ drv->core.driver.owner = owner;
+ drv->core.driver.bus = &snd_hda_bus_type;
+ drv->core.driver.probe = hda_codec_driver_probe;
+ drv->core.driver.remove = hda_codec_driver_remove;
+ drv->core.driver.shutdown = hda_codec_driver_shutdown;
+ drv->core.driver.pm = &hda_codec_driver_pm;
+ drv->core.type = HDA_DEV_LEGACY;
+ drv->core.match = hda_codec_match;
+ return driver_register(&drv->core.driver);
}
EXPORT_SYMBOL_GPL(__hda_codec_driver_register);
void hda_codec_driver_unregister(struct hda_codec_driver *drv)
{
- driver_unregister(&drv->driver);
+ driver_unregister(&drv->core.driver);
}
EXPORT_SYMBOL_GPL(hda_codec_driver_unregister);
@@ -319,24 +321,3 @@ int snd_hda_codec_configure(struct hda_codec *codec)
return err;
}
EXPORT_SYMBOL_GPL(snd_hda_codec_configure);
-
-/*
- * bus registration
- */
-struct bus_type snd_hda_bus_type = {
- .name = "hdaudio",
- .match = hda_bus_match,
-};
-
-static int __init hda_codec_init(void)
-{
- return bus_register(&snd_hda_bus_type);
-}
-
-static void __exit hda_codec_exit(void)
-{
- bus_unregister(&snd_hda_bus_type);
-}
-
-module_init(hda_codec_init);
-module_exit(hda_codec_exit);