diff options
| author | Ajay Dudani <adudani@google.com> | 2017-09-01 16:49:19 -0700 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-12-19 14:54:22 +0100 |
| commit | 95df9393016ee9d5f339eac3a2003689dfc0f161 (patch) | |
| tree | 73a50f0637187a927ddb5e0f10560ca7407118ac | |
| parent | d6b16200598a3d46852afedbb429d3d9a7ee79c2 (diff) | |
firmware_class: make firmware caching configurable
Because firmware caching generates uevent messages that are sent over a
netlink socket, it can prevent suspend on many platforms. It's also not
always useful, so make it a configurable option.
Bug: 38289596
Change-Id: I1c62227129590f564b127de6dbcaf0001b2c22ad
Signed-off-by: Ajay Dudani <adudani@google.com>
| -rw-r--r-- | drivers/base/Kconfig | 5 | ||||
| -rw-r--r-- | drivers/base/firmware_class.c | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index aaf62a062..c8d1ba190 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -82,6 +82,11 @@ config FW_LOADER require userspace firmware loading support, but a module built out-of-tree does. +config FW_CACHE + bool "Enable firmware caching during suspend" + depends on PM_SLEEP + default n + config FIRMWARE_IN_KERNEL bool "Include in-kernel firmware blobs in kernel binary" depends on FW_LOADER diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 30d575a09..ef4f38f05 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -217,6 +217,7 @@ static int fw_lookup_and_allocate_buf(const char *fw_name, return tmp ? 0 : -ENOMEM; } +#ifdef CONFIG_FW_CACHE static struct firmware_buf *fw_lookup_buf(const char *fw_name) { struct firmware_buf *tmp; @@ -228,6 +229,7 @@ static struct firmware_buf *fw_lookup_buf(const char *fw_name) return tmp; } +#endif static void __fw_free_buf(struct kref *ref) { @@ -1233,6 +1235,9 @@ request_firmware_nowait( return 0; } +#ifdef CONFIG_FW_CACHE +static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain); + /** * cache_firmware - cache one firmware image in kernel memory space * @fw_name: the firmware image name @@ -1293,9 +1298,6 @@ int uncache_firmware(const char *fw_name) return -EINVAL; } -#ifdef CONFIG_PM_SLEEP -static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain); - static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) { struct fw_cache_entry *fce; @@ -1559,7 +1561,7 @@ static void __init fw_cache_init(void) INIT_LIST_HEAD(&fw_cache.head); fw_cache.state = FW_LOADER_NO_CACHE; -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_FW_CACHE spin_lock_init(&fw_cache.name_lock); INIT_LIST_HEAD(&fw_cache.fw_names); @@ -1586,7 +1588,7 @@ static int __init firmware_class_init(void) static void __exit firmware_class_exit(void) { -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_FW_CACHE unregister_syscore_ops(&fw_syscore_ops); unregister_pm_notifier(&fw_cache.pm_notify); #endif |
