Skip to content

Commit

Permalink
ALSA: hdac: Add API for removing hdac extended device
Browse files Browse the repository at this point in the history
The HDAC extended device objects are created by HDAC extended bus on probe.
When controller is removed they should be removed as well, so add API
snd_hdac_ext_bus_device_remove for this

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Vinod Koul authored and tiwai committed Aug 21, 2015
1 parent 9430e54 commit ee2d51b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/sound/hdaudio_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ int snd_hdac_ext_bus_init(struct hdac_ext_bus *sbus, struct device *dev,
void snd_hdac_ext_bus_exit(struct hdac_ext_bus *sbus);
int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *sbus, int addr);
void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev);
void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus);

#define ebus_to_hbus(ebus) (&(ebus)->bus)
#define hbus_to_ebus(_bus) \
Expand Down
19 changes: 19 additions & 0 deletions sound/hda/ext/hdac_ext_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,22 @@ void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev)
kfree(hdev);
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit);

/**
* snd_hdac_ext_bus_device_remove - remove HD-audio extended codec base devices
*
* @ebus: HD-audio extended bus
*/
void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus)
{
struct hdac_device *codec, *__codec;
/*
* we need to remove all the codec devices objects created in the
* snd_hdac_ext_bus_device_init
*/
list_for_each_entry_safe(codec, __codec, &ebus->bus.codec_list, list) {
snd_hdac_device_unregister(codec);
put_device(&codec->dev);
}
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);

0 comments on commit ee2d51b

Please sign in to comment.