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>
This commit is contained in:
parent
8d60216075
commit
7f3ad4062f
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue