diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 01e11bf31017..ae3753b0d462 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 bb741889769f..e61e720dcb63 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -241,6 +241,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; @@ -252,6 +253,7 @@ static struct firmware_buf *fw_lookup_buf(const char *fw_name) return tmp; } +#endif static void __fw_free_buf(struct kref *ref) { @@ -1501,6 +1503,9 @@ request_firmware_nowait_direct( map_data); } +#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 @@ -1561,9 +1566,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; @@ -1827,7 +1829,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); @@ -1854,7 +1856,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