diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-06-26 19:24:45 +0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-06-26 20:00:01 +0400 |
commit | 703c759f38cce7950ab460552236ca1d15adb916 (patch) | |
tree | b451c198836b0a7daff82d2e564017d17e3cd32c /sound/pci/hda/hda_controller.c | |
parent | 9a34af4a33270acbd60a85f819553463866aecbb (diff) | |
download | linux-703c759f38cce7950ab460552236ca1d15adb916.tar.xz |
ALSA: hda - Use common reboot notifier
The very same notifier code is used in both hda_intel.c and
hda_tegra.c. Move it to the generic code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_controller.c')
-rw-r--r-- | sound/pci/hda/hda_controller.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index a562d86c02fb..8d9398a4c7c9 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -27,6 +27,7 @@ #include <linux/module.h> #include <linux/pm_runtime.h> #include <linux/slab.h> +#include <linux/reboot.h> #include <sound/core.h> #include <sound/initval.h> #include "hda_priv.h" @@ -1946,5 +1947,30 @@ int azx_init_stream(struct azx *chip) } EXPORT_SYMBOL_GPL(azx_init_stream); +/* + * reboot notifier for hang-up problem at power-down + */ +static int azx_halt(struct notifier_block *nb, unsigned long event, void *buf) +{ + struct azx *chip = container_of(nb, struct azx, reboot_notifier); + snd_hda_bus_reboot_notify(chip->bus); + azx_stop_chip(chip); + return NOTIFY_OK; +} + +void azx_notifier_register(struct azx *chip) +{ + chip->reboot_notifier.notifier_call = azx_halt; + register_reboot_notifier(&chip->reboot_notifier); +} +EXPORT_SYMBOL_GPL(azx_notifier_register); + +void azx_notifier_unregister(struct azx *chip) +{ + if (chip->reboot_notifier.notifier_call) + unregister_reboot_notifier(&chip->reboot_notifier); +} +EXPORT_SYMBOL_GPL(azx_notifier_unregister); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Common HDA driver funcitons"); |