]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/base/firmware_class.c
firmware: enable a debug print for batched requests
[mirror_ubuntu-bionic-kernel.git] / drivers / base / firmware_class.c
index b9f907eedbf770ee32359468d2b8d07e57bde667..68726c8e830659b0d215cd4ea0daa0ad2f8efc73 100644 (file)
@@ -7,6 +7,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/capability.h>
 #include <linux/device.h>
 #include <linux/module.h>
@@ -335,6 +337,7 @@ static struct firmware_buf *__fw_lookup_buf(const char *fw_name)
        return NULL;
 }
 
+/* Returns 1 for batching firmware requests with the same name */
 static int fw_lookup_and_allocate_buf(const char *fw_name,
                                      struct firmware_cache *fwc,
                                      struct firmware_buf **buf, void *dbuf,
@@ -348,6 +351,7 @@ static int fw_lookup_and_allocate_buf(const char *fw_name,
                kref_get(&tmp->ref);
                spin_unlock(&fwc->lock);
                *buf = tmp;
+               pr_debug("batched request - sharing the same struct firmware_buf and lookup for multiple requests\n");
                return 1;
        }
        tmp = __allocate_fw_buf(fw_name, fwc, dbuf, size);
@@ -1089,9 +1093,12 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
                mutex_unlock(&fw_lock);
        }
 
-       if (fw_state_is_aborted(&buf->fw_st))
-               retval = -EAGAIN;
-       else if (buf->is_paged_buf && !buf->data)
+       if (fw_state_is_aborted(&buf->fw_st)) {
+               if (retval == -ERESTARTSYS)
+                       retval = -EINTR;
+               else
+                       retval = -EAGAIN;
+       } else if (buf->is_paged_buf && !buf->data)
                retval = -ENOMEM;
 
        device_del(f_dev);