diff options
author | Luis R. Rodriguez <mcgrof@kernel.org> | 2017-05-02 04:31:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-03 06:15:49 -0400 |
commit | a669f04ab4b4d7e5a7ac8250f0b688a07e10b04c (patch) | |
tree | 53d4133d09648d8a8b999a04d9ae2a90f4466060 /drivers/base/firmware_class.c | |
parent | c4b768934be613fb882e4e4090946218d76c8e1b (diff) |
firmware: always enable the reboot notifier
Now that we've have proper wrappers for the fallback mechanism
we can easily share the reboot notifier for the firmware_class
at all times.
This change will make subsequent modifications to the reboot
notifier easier to review.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/firmware_class.c')
-rw-r--r-- | drivers/base/firmware_class.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 58b661df6d34..dd9b7f3d0927 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -575,23 +575,6 @@ static void kill_pending_fw_fallback_reqs(bool only_kill_custom) | |||
575 | mutex_unlock(&fw_lock); | 575 | mutex_unlock(&fw_lock); |
576 | } | 576 | } |
577 | 577 | ||
578 | /* reboot notifier for avoid deadlock with usermode_lock */ | ||
579 | static int fw_shutdown_notify(struct notifier_block *unused1, | ||
580 | unsigned long unused2, void *unused3) | ||
581 | { | ||
582 | /* | ||
583 | * Kill all pending fallback requests to avoid both stalling shutdown, | ||
584 | * and avoid a deadlock with the usermode_lock. | ||
585 | */ | ||
586 | kill_pending_fw_fallback_reqs(false); | ||
587 | |||
588 | return NOTIFY_DONE; | ||
589 | } | ||
590 | |||
591 | static struct notifier_block fw_shutdown_nb = { | ||
592 | .notifier_call = fw_shutdown_notify, | ||
593 | }; | ||
594 | |||
595 | static ssize_t timeout_show(struct class *class, struct class_attribute *attr, | 578 | static ssize_t timeout_show(struct class *class, struct class_attribute *attr, |
596 | char *buf) | 579 | char *buf) |
597 | { | 580 | { |
@@ -1782,11 +1765,27 @@ static void __init fw_cache_init(void) | |||
1782 | #endif | 1765 | #endif |
1783 | } | 1766 | } |
1784 | 1767 | ||
1768 | static int fw_shutdown_notify(struct notifier_block *unused1, | ||
1769 | unsigned long unused2, void *unused3) | ||
1770 | { | ||
1771 | /* | ||
1772 | * Kill all pending fallback requests to avoid both stalling shutdown, | ||
1773 | * and avoid a deadlock with the usermode_lock. | ||
1774 | */ | ||
1775 | kill_pending_fw_fallback_reqs(false); | ||
1776 | |||
1777 | return NOTIFY_DONE; | ||
1778 | } | ||
1779 | |||
1780 | static struct notifier_block fw_shutdown_nb = { | ||
1781 | .notifier_call = fw_shutdown_notify, | ||
1782 | }; | ||
1783 | |||
1785 | static int __init firmware_class_init(void) | 1784 | static int __init firmware_class_init(void) |
1786 | { | 1785 | { |
1787 | fw_cache_init(); | 1786 | fw_cache_init(); |
1788 | #ifdef CONFIG_FW_LOADER_USER_HELPER | ||
1789 | register_reboot_notifier(&fw_shutdown_nb); | 1787 | register_reboot_notifier(&fw_shutdown_nb); |
1788 | #ifdef CONFIG_FW_LOADER_USER_HELPER | ||
1790 | return class_register(&firmware_class); | 1789 | return class_register(&firmware_class); |
1791 | #else | 1790 | #else |
1792 | return 0; | 1791 | return 0; |
@@ -1799,8 +1798,8 @@ static void __exit firmware_class_exit(void) | |||
1799 | unregister_syscore_ops(&fw_syscore_ops); | 1798 | unregister_syscore_ops(&fw_syscore_ops); |
1800 | unregister_pm_notifier(&fw_cache.pm_notify); | 1799 | unregister_pm_notifier(&fw_cache.pm_notify); |
1801 | #endif | 1800 | #endif |
1802 | #ifdef CONFIG_FW_LOADER_USER_HELPER | ||
1803 | unregister_reboot_notifier(&fw_shutdown_nb); | 1801 | unregister_reboot_notifier(&fw_shutdown_nb); |
1802 | #ifdef CONFIG_FW_LOADER_USER_HELPER | ||
1804 | class_unregister(&firmware_class); | 1803 | class_unregister(&firmware_class); |
1805 | #endif | 1804 | #endif |
1806 | } | 1805 | } |