Merge tag 'defconfig-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / drivers / base / firmware_loader / main.c
index 68c549d..bdbedc6 100644 (file)
@@ -165,7 +165,7 @@ static inline int fw_state_wait(struct fw_priv *fw_priv)
        return __fw_state_wait_common(fw_priv, MAX_SCHEDULE_TIMEOUT);
 }
 
-static int fw_cache_piggyback_on_request(const char *name);
+static void fw_cache_piggyback_on_request(struct fw_priv *fw_priv);
 
 static struct fw_priv *__allocate_fw_priv(const char *fw_name,
                                          struct firmware_cache *fwc,
@@ -707,10 +707,8 @@ int assign_fw(struct firmware *fw, struct device *device)
         * on request firmware.
         */
        if (!(fw_priv->opt_flags & FW_OPT_NOCACHE) &&
-           fw_priv->fwc->state == FW_LOADER_START_CACHE) {
-               if (fw_cache_piggyback_on_request(fw_priv->fw_name))
-                       kref_get(&fw_priv->ref);
-       }
+           fw_priv->fwc->state == FW_LOADER_START_CACHE)
+               fw_cache_piggyback_on_request(fw_priv);
 
        /* pass the pages buffer to driver at the last minute */
        fw_set_page_data(fw_priv, fw);
@@ -1259,11 +1257,11 @@ static int __fw_entry_found(const char *name)
        return 0;
 }
 
-static int fw_cache_piggyback_on_request(const char *name)
+static void fw_cache_piggyback_on_request(struct fw_priv *fw_priv)
 {
-       struct firmware_cache *fwc = &fw_cache;
+       const char *name = fw_priv->fw_name;
+       struct firmware_cache *fwc = fw_priv->fwc;
        struct fw_cache_entry *fce;
-       int ret = 0;
 
        spin_lock(&fwc->name_lock);
        if (__fw_entry_found(name))
@@ -1271,13 +1269,12 @@ static int fw_cache_piggyback_on_request(const char *name)
 
        fce = alloc_fw_cache_entry(name);
        if (fce) {
-               ret = 1;
                list_add(&fce->list, &fwc->fw_names);
+               kref_get(&fw_priv->ref);
                pr_debug("%s: fw: %s\n", __func__, name);
        }
 found:
        spin_unlock(&fwc->name_lock);
-       return ret;
 }
 
 static void free_fw_cache_entry(struct fw_cache_entry *fce)
@@ -1508,9 +1505,8 @@ static inline void unregister_fw_pm_ops(void)
        unregister_pm_notifier(&fw_cache.pm_notify);
 }
 #else
-static int fw_cache_piggyback_on_request(const char *name)
+static void fw_cache_piggyback_on_request(struct fw_priv *fw_priv)
 {
-       return 0;
 }
 static inline int register_fw_pm_ops(void)
 {