Commit a67e503b authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by Greg Kroah-Hartman

firmware: add helper to unregister pm ops

This will be used later to unfold on error on init.
Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4fbd8d19
...@@ -1767,11 +1767,20 @@ static int fw_suspend(void) ...@@ -1767,11 +1767,20 @@ static int fw_suspend(void)
static struct syscore_ops fw_syscore_ops = { static struct syscore_ops fw_syscore_ops = {
.suspend = fw_suspend, .suspend = fw_suspend,
}; };
static inline void unregister_fw_pm_ops(void)
{
unregister_syscore_ops(&fw_syscore_ops);
unregister_pm_notifier(&fw_cache.pm_notify);
}
#else #else
static int fw_cache_piggyback_on_request(const char *name) static int fw_cache_piggyback_on_request(const char *name)
{ {
return 0; return 0;
} }
static inline void unregister_fw_pm_ops(void)
{
}
#endif #endif
static void __init fw_cache_init(void) static void __init fw_cache_init(void)
...@@ -1823,10 +1832,7 @@ static int __init firmware_class_init(void) ...@@ -1823,10 +1832,7 @@ static int __init firmware_class_init(void)
static void __exit firmware_class_exit(void) static void __exit firmware_class_exit(void)
{ {
#ifdef CONFIG_PM_SLEEP unregister_fw_pm_ops();
unregister_syscore_ops(&fw_syscore_ops);
unregister_pm_notifier(&fw_cache.pm_notify);
#endif
unregister_reboot_notifier(&fw_shutdown_nb); unregister_reboot_notifier(&fw_shutdown_nb);
#ifdef CONFIG_FW_LOADER_USER_HELPER #ifdef CONFIG_FW_LOADER_USER_HELPER
class_unregister(&firmware_class); class_unregister(&firmware_class);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment