aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2016-10-20 13:53:58 -0700
committerroot-expert <20chris09@gmail.com>2018-08-24 19:21:37 +0200
commit0b49a6bda346b6562fbbc0ad95f9b81d1f121775 (patch)
treef35a5b00ce763bb1e6324840cf2a9c3d4cd8fed4
parentce2e4759303ad6494e72389e540466cddf151dbb (diff)
firmware_class: make firmware caching configurableo8.1
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 32180327 Change-Id: I69bc3faaa106d3e7b1420734f0616ed31671a5ee Signed-off-by: Ajay Dudani <adudani@google.com>
-rw-r--r--drivers/base/Kconfig5
-rw-r--r--drivers/base/firmware_class.c16
2 files changed, 16 insertions, 5 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index a1251a6c3c0..823d65f2164 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -156,6 +156,11 @@ config FW_LOADER_USER_HELPER
no longer required unless you have a special firmware file that
resides in a non-standard path.
+config FW_CACHE
+ bool "Enable firmware caching during suspend"
+ depends on PM_SLEEP
+ default n
+
config DEBUG_DRIVER
bool "Driver Core verbose debug messages"
depends on DEBUG_KERNEL
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 4861cdf1e3f..700f54bf009 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -101,7 +101,13 @@ struct firmware_cache {
struct list_head head;
int state;
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_FW_CACHE
+ /*
+ * Names of firmware images which have been cached successfully
+ * will be added into the below list so that device uncache
+ * helper can trace which firmware images have been cached
+ * before.
+ */
spinlock_t name_lock;
struct list_head fw_names;
@@ -397,7 +403,7 @@ static void fw_set_page_data(struct firmware_buf *buf, struct firmware *fw)
(unsigned int)buf->size);
}
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_FW_CACHE
static void fw_name_devm_release(struct device *dev, void *res)
{
struct fw_name_devm *fwn = res;
@@ -1356,7 +1362,7 @@ int uncache_firmware(const char *fw_name)
return -EINVAL;
}
-#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_FW_CACHE
static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain);
static struct fw_cache_entry *alloc_fw_cache_entry(const char *name)
@@ -1585,7 +1591,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);
@@ -1611,7 +1617,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